trezor / blockbook

:blue_book: Trezor address/account balance backend
https://trezor.io
GNU Affero General Public License v3.0
671 stars 655 forks source link

How to test the testnet #1130

Open wakiyamap opened 2 months ago

wakiyamap commented 2 months ago

I am currently creating a pull request for testnet4. https://github.com/wakiyamap/blockbook/commits/testnet4-bitcoin/

The testing method seems to be different from before, so I would like to confirm it. If I were to test it, would the following command be okay? make test

# make test
Image blockbook-build is up to date
docker run -t --rm -e PACKAGER=0:0 -v "/root/blockbook:/src" --network="host" blockbook-build make test ARGS=""
rm -rf /go/src/github.com/trezor/blockbook
mkdir -p /go/src/github.com/trezor
cp -r /src /go/src/github.com/trezor/blockbook
cd /go/src/github.com/trezor/blockbook && go mod download
sed -i 's/wsMessageSizeLimit\ =\ 15\ \*\ 1024\ \*\ 1024/wsMessageSizeLimit = 80 * 1024 * 1024/g' /go/pkg/mod/github.com/ava-labs/coreth*/rpc/websocket.go
cd /go/src/github.com/trezor/blockbook && go test -tags 'unittest' `go list ./... | grep -vP '^github.com/trezor/blockbook/(contrib|tests)'` 
?       github.com/trezor/blockbook     [no test files]
?       github.com/trezor/blockbook/bchain/coins        [no test files]
?       github.com/trezor/blockbook/bchain/coins/avalanche      [no test files]
ok      github.com/trezor/blockbook/api 0.076s
ok      github.com/trezor/blockbook/bchain      0.073s
ok      github.com/trezor/blockbook/bchain/coins/bch    0.070s
?       github.com/trezor/blockbook/bchain/coins/bsc    [no test files]
ok      github.com/trezor/blockbook/bchain/coins/bellcoin       0.080s
ok      github.com/trezor/blockbook/bchain/coins/bitcore        0.100s
ok      github.com/trezor/blockbook/bchain/coins/bitzeny        0.072s
?       github.com/trezor/blockbook/bchain/coins/cpuchain       [no test files]
ok      github.com/trezor/blockbook/bchain/coins/btc    0.107s
ok      github.com/trezor/blockbook/bchain/coins/btg    0.113s
ok      github.com/trezor/blockbook/bchain/coins/dash   0.088s
ok      github.com/trezor/blockbook/bchain/coins/dcr    0.107s
ok      github.com/trezor/blockbook/bchain/coins/deeponion      0.104s
ok      github.com/trezor/blockbook/bchain/coins/digibyte       0.079s
ok      github.com/trezor/blockbook/bchain/coins/divi   0.102s
ok      github.com/trezor/blockbook/bchain/coins/dogecoin       0.090s
ok      github.com/trezor/blockbook/bchain/coins/ecash  0.073s
ok      github.com/trezor/blockbook/bchain/coins/eth    0.082s
ok      github.com/trezor/blockbook/bchain/coins/firo   0.108s
ok      github.com/trezor/blockbook/bchain/coins/flo    0.083s
ok      github.com/trezor/blockbook/bchain/coins/fujicoin       0.118s
ok      github.com/trezor/blockbook/bchain/coins/gamecredits    0.115s
ok      github.com/trezor/blockbook/bchain/coins/grs    0.098s
ok      github.com/trezor/blockbook/bchain/coins/koto   0.078s
ok      github.com/trezor/blockbook/bchain/coins/liquid 0.105s
ok      github.com/trezor/blockbook/bchain/coins/litecoin       0.071s
ok      github.com/trezor/blockbook/bchain/coins/monacoin       0.112s
ok      github.com/trezor/blockbook/bchain/coins/monetaryunit   0.115s
ok      github.com/trezor/blockbook/bchain/coins/myriad 0.077s
ok      github.com/trezor/blockbook/bchain/coins/namecoin       0.082s
ok      github.com/trezor/blockbook/bchain/coins/nuls   0.065s
?       github.com/trezor/blockbook/bchain/coins/optimism       [no test files]
ok      github.com/trezor/blockbook/bchain/coins/omotenashicoin 0.081s
ok      github.com/trezor/blockbook/bchain/coins/pivx   0.072s
?       github.com/trezor/blockbook/bchain/coins/polygon        [no test files]
ok      github.com/trezor/blockbook/bchain/coins/polis  0.091s
ok      github.com/trezor/blockbook/bchain/coins/qtum   0.100s
ok      github.com/trezor/blockbook/bchain/coins/ravencoin      0.115s
ok      github.com/trezor/blockbook/bchain/coins/ritocoin       0.079s
ok      github.com/trezor/blockbook/bchain/coins/snowgem        0.079s
ok      github.com/trezor/blockbook/bchain/coins/trezarcoin     0.071s
?       github.com/trezor/blockbook/bchain/coins/utils  [no test files]
ok      github.com/trezor/blockbook/bchain/coins/unobtanium     0.106s
ok      github.com/trezor/blockbook/bchain/coins/vertcoin       0.096s
ok      github.com/trezor/blockbook/bchain/coins/viacoin        0.107s
?       github.com/trezor/blockbook/build/templates     [no test files]
?       github.com/trezor/blockbook/build/tools [no test files]
ok      github.com/trezor/blockbook/bchain/coins/vipstarcoin    0.077s
?       github.com/trezor/blockbook/build/tools/trezor-common   [no test files]
ok      github.com/trezor/blockbook/bchain/coins/zec    0.096s
?       github.com/trezor/blockbook/build/tools/typescriptify   [no test files]
ok      github.com/trezor/blockbook/common      0.016s
ok      github.com/trezor/blockbook/db  0.721s
ok      github.com/trezor/blockbook/fiat        0.220s
ok      github.com/trezor/blockbook/fourbyte    0.048s
ok      github.com/trezor/blockbook/server      0.562s

and

make test-integration ARGS="-v -run=TestIntegration/bitcoin_testnet4=main"

# make test-integration ARGS="-v -run=TestIntegration/bitcoin_testnet4=main"
Image blockbook-build is up to date
docker run -t --rm -e PACKAGER=0:0 -v "/root/blockbook:/src" --network="host" blockbook-build make test-integration ARGS="-v -run=TestIntegration/bitcoin_testnet4=main"
rm -rf /go/src/github.com/trezor/blockbook
mkdir -p /go/src/github.com/trezor
cp -r /src /go/src/github.com/trezor/blockbook
cd /go/src/github.com/trezor/blockbook && go mod download
sed -i 's/wsMessageSizeLimit\ =\ 15\ \*\ 1024\ \*\ 1024/wsMessageSizeLimit = 80 * 1024 * 1024/g' /go/pkg/mod/github.com/ava-labs/coreth*/rpc/websocket.go
cd /go/src/github.com/trezor/blockbook && go test -tags 'integration' `go list github.com/trezor/blockbook/tests/...` -v -run=TestIntegration/bitcoin_testnet4=main
?       github.com/trezor/blockbook/tests/dbtestdata    [no test files]
?       github.com/trezor/blockbook/tests/rpc   [no test files]
?       github.com/trezor/blockbook/tests/sync  [no test files]
=== RUN   TestIntegration
--- PASS: TestIntegration (0.00s)
testing: warning: no tests to run
PASS
ok      github.com/trezor/blockbook/tests       0.141s [no tests to run]
martinboehm commented 1 month ago

We have added Testnet4 config by this commit d8c68f2b6b7d9a08d99a6a68f8215b84d3f1f8dd. However we did not add integration tests yet. Would you mind if we take them from your fork and integrate them?

wakiyamap commented 1 month ago

It's good, but I don't know if it will work.

wakiyamap commented 1 month ago

Also, testnet4 does not work with the current github.com/martinboehm/btcutil/chaincfg. Changes to bitcoinparser.go are required. https://github.com/wakiyamap/blockbook/commit/a3690b3eb144aeb30cf9e770687942158c351de8#diff-e8f35690e3557a170294ecf41264a45672b4667b0bec0cd08cc06954a34fb072R7

grdddj commented 1 month ago

Hello, thanks for your work here! As mentioned by Martin above, we will cherry-pick your commit and synchronize it with current master - while leaving your authorship. I hope it is fine for you :)

wakiyamap commented 1 month ago

Hello, thanks for your work here! As mentioned by Martin above, we will cherry-pick your commit and synchronize it with current master - while leaving your authorship. I hope it is fine for you :)

ok. no problem.

wakiyamap commented 3 weeks ago

......So what is the correct test command for testnet?