mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
tests: test that erigon can be used as a library (#8494)
This commit is contained in:
parent
3698e7f476
commit
35696afca1
5
.github/workflows/test-integration.yml
vendored
5
.github/workflows/test-integration.yml
vendored
@ -29,6 +29,11 @@ jobs:
|
||||
- name: test-integration
|
||||
run: make test-integration
|
||||
|
||||
- name: Test erigon as a library
|
||||
env:
|
||||
GIT_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
run: make test-erigon-ext GIT_COMMIT=$GIT_COMMIT
|
||||
|
||||
# name: history-v3-test-integration
|
||||
# run: make test3-integration
|
||||
|
||||
|
18
Makefile
18
Makefile
@ -140,22 +140,24 @@ db-tools:
|
||||
rm -rf vendor
|
||||
@echo "Run \"$(GOBIN)/mdbx_stat -h\" to get info about mdbx db file."
|
||||
|
||||
## test: run unit tests with a 100s timeout
|
||||
test:
|
||||
test-erigon-lib:
|
||||
@cd erigon-lib && $(MAKE) test
|
||||
|
||||
test-erigon-ext:
|
||||
@cd tests/erigon-ext-test && ./test.sh $(GIT_COMMIT)
|
||||
|
||||
## test: run unit tests with a 100s timeout
|
||||
test: test-erigon-lib
|
||||
$(GOTEST) --timeout 10m
|
||||
|
||||
test3:
|
||||
@cd erigon-lib && $(MAKE) test
|
||||
test3: test-erigon-lib
|
||||
$(GOTEST) --timeout 10m -tags $(BUILD_TAGS),e3
|
||||
|
||||
## test-integration: run integration tests with a 30m timeout
|
||||
test-integration:
|
||||
@cd erigon-lib && $(MAKE) test
|
||||
test-integration: test-erigon-lib
|
||||
$(GOTEST) --timeout 240m -tags $(BUILD_TAGS),integration
|
||||
|
||||
test3-integration:
|
||||
@cd erigon-lib && $(MAKE) test
|
||||
test3-integration: test-erigon-lib
|
||||
$(GOTEST) --timeout 240m -tags $(BUILD_TAGS),integration,e3
|
||||
|
||||
## lint-deps: install lint dependencies
|
||||
|
1
tests/erigon-ext-test/.gitignore
vendored
Normal file
1
tests/erigon-ext-test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
go.sum
|
2
tests/erigon-ext-test/go.mod
Normal file
2
tests/erigon-ext-test/go.mod
Normal file
@ -0,0 +1,2 @@
|
||||
// this is a dummy file needed to exclude this folder from the root folder unit tests suite
|
||||
// the actual go.mod for the test is generated by test.sh from go.mod.template
|
9
tests/erigon-ext-test/go.mod.template
Normal file
9
tests/erigon-ext-test/go.mod.template
Normal file
@ -0,0 +1,9 @@
|
||||
module example.com/erigon-ext-test
|
||||
|
||||
go 1.20
|
||||
|
||||
require github.com/ledgerwatch/erigon $COMMIT_SHA
|
||||
|
||||
replace github.com/ledgerwatch/erigon-lib => github.com/ledgerwatch/erigon/erigon-lib $COMMIT_SHA
|
||||
|
||||
require github.com/ethereum/go-ethereum v1.13.3
|
18
tests/erigon-ext-test/main.go
Normal file
18
tests/erigon-ext-test/main.go
Normal file
@ -0,0 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
geth_params "github.com/ethereum/go-ethereum/params"
|
||||
// geth_crypto "github.com/ethereum/go-ethereum/crypto"
|
||||
erigon_lib_common "github.com/ledgerwatch/erigon-lib/common"
|
||||
erigon_crypto "github.com/ledgerwatch/erigon/crypto"
|
||||
erigon_params "github.com/ledgerwatch/erigon/params"
|
||||
)
|
||||
|
||||
func main() {
|
||||
println("Erigon version: ", erigon_params.Version)
|
||||
println("geth version: ", geth_params.Version)
|
||||
println("Erigon lib common eth Wei: ", erigon_lib_common.Wei)
|
||||
println("Erigon crypto secp256k1 S256 BitSize: ", erigon_crypto.S256().Params().BitSize)
|
||||
// not working due to duplicate symbols errors
|
||||
// println("geth crypto secp256k1 S256 BitSize: ", geth_crypto.S256().Params().BitSize)
|
||||
}
|
10
tests/erigon-ext-test/test.sh
Executable file
10
tests/erigon-ext-test/test.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
COMMIT_SHA="$1"
|
||||
|
||||
sed "s/\$COMMIT_SHA/$COMMIT_SHA/" go.mod.template > go.mod
|
||||
|
||||
rm -f go.sum
|
||||
go mod tidy
|
||||
|
||||
go run main.go
|
Loading…
Reference in New Issue
Block a user