-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Electrum integration tests for mainnet servers #3599
Conversation
We add test vectors for mainnet and extract exisitng test data for testnet from integration test to the test data package.
We extract functions to assert the server messages, the responses depend not only on the electrum server implementation but a daemon running behind it. It's hard to maintain the exact response for the particular server, so we just define a list of responses that are fine.
We need to cancel the connections for electrum client so nothing is dangling in the background.
We want to execute the whole suite of tests for all the servers including the embedded ones. To do that we have to get the list from the config package, we use go:linkname for that, instead of exposing the readEmbeddedServers function publicly. We combine testnet and mainnet servers in the config, distinguishing it with by bitcoin network property. We renamed the package to `electrum_test` to overcome the cyclic dependency problem that we have between the config and electrum packages. We read the servers in init function and then remove duplicates (by URL), so we don't execute the test twice for the same server.
Handle testnet and mainnet, read testdata from common package, improve latest block check to confirm all servers are on the same page.
This file is no longer needed as we test the embedded servers in pkg/bitcoin/electrum/electrum_integration_test.go
Version 1.18.3 was causing tests execution to fail with panic, e.g. https://github.com/keep-network/keep-core/actions/runs/5210502339/jobs/9402113717?pr=3599 With the latest release for 1.18 everything works fine.
The server is unstable, we have other servers for testing TCP client.
The script helps to run the integration tests consistently with the CI job as it's based on the same solutions as defined in the workflow.
func assertConfirmationsCloseTo(t *testing.T, expected uint, actual uint) { | ||
delta := uint(2) | ||
|
||
func assertNumberCloseTo(t *testing.T, expected uint, actual uint, delta uint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make it a part of testutils
. Non-blocking, it does not come from this PR.
I've executed several attempts locally and I was not able to get a green build. However, the problems that occurred are not caused by this code. This code reveals those problems which is great. One problem is a panic in Other problems are timeouts for individual tests that should lead to tweaks in the number of retries and timeouts. That being said, I would recommend:
And then, I am happy to merge. The last two items are already done based on what I know, but please confirm. |
These are details of transactions swept from actual mainnet wallet.
We want to workaround the strange panic in CI, so maybe this sleep will help.
We use consistent timeouts, with exception for blockstream's servers which need to set them longer.
We should remove entry from the test configs.
We need to capture `testName` and `testConfig` if we use `t.Parallel()`. See `TestGroupedParallel` example [here](https://pkg.go.dev/testing).
The tag got removed by accident.
We need the details for debugging, it will help.
I was able to run tests locally. All of them but |
In this PR we implement support for mainnet servers in the electrum client integration tests.
We also include the embedded electrum servers in the verification.
To run the tests execute:
go test -v -tags=integration ./pkg/bitcoin/electrum -count=1
Closes: #3594