Skip to content
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

Sync blockchain before running e2e tests on public testnet #568

Closed
adambabik opened this issue Jan 24, 2018 · 6 comments
Closed

Sync blockchain before running e2e tests on public testnet #568

adambabik opened this issue Jan 24, 2018 · 6 comments

Comments

@adambabik
Copy link
Contributor

Problem

If e2e tests start on a public testnet and the blockchain is not synced, the tests fail due to timeout.

Implementation

Have a prerequisite that checks if the blockchain is synced. If it's not, sync it before running e2e tests.

Instead of:

make test-e2e networkid=4

Do something like:

./build/bin/statusd -les -networkid 4 -exit-when-synced
make test-e2e networkid=4

This needs to be fixed in .travis.yml.

Acceptance Criteria

  1. E2e tests do not fail because of not synced blockchain.
@dshulyak
Copy link
Contributor

I noticed that new blocks are created during tests, so it makes sense to sync the chain before every test suite or even test (like we do currently). Another problem - it won't be enough to run go test, so even if I want to run a single test I will have to run this prerequisite. It seems like a serious developer experience issue to me :).

@adambabik
Copy link
Contributor Author

adambabik commented Jan 24, 2018

I noticed that new blocks are created during tests, so it makes sense to sync the chain before every test suite or even test (like we do currently).

Correct but if the blockchain is synced in 95%, it will take a few seconds to sync the missing blocks during the test.

Another problem - it won't be enough to run go test, so even if I want to run a single test I will have to run this prerequisite. It seems like a serious developer experience issue to me :).

Yes and no but basically you need to know what you're doing. Preferably, developer should always run it on a private blockchain and if they want to run it on the public testnet, there must be a reason. Also, again, it's enough to sync it once and you will be good for a few hours as syncing the missing blocks will take a few seconds.

@adambabik
Copy link
Contributor Author

Related #571

@dshulyak
Copy link
Contributor

dshulyak commented Jan 29, 2018

There are 2 options how it can be implemented.

  1. This function can be reused https://github.com/status-im/status-go/blob/develop/testing/testing.go#L92-L145 after slight refactoring.

  2. And there is second way that may provide better guarantees.

Following subscription can be used to track the progress of syncing: https://github.com/ethereum/go-ethereum/blob/master/eth/downloader/api.go#L93-L120 . But because we wrapped rpc client it will be required to add ethsubscribe method to it https://github.com/ethereum/go-ethereum/blob/master/rpc/client.go#L352-L355 .

And the link to documentation what objects syncing subscription will return https://github.com/ethereum/go-ethereum/wiki/RPC-PUB-SUB#syncing

GitHub
status-go - The Status module that consumes go-ethereum
GitHub
go-ethereum - Official Go implementation of the Ethereum protocol
GitHub
go-ethereum - Official Go implementation of the Ethereum protocol
GitHub
go-ethereum - Official Go implementation of the Ethereum protocol

@status-open-bounty
Copy link

status-open-bounty commented Jan 29, 2018

Balance: 0.000000 ETH
Tokens: SNT: 735.00
Contract address: 0xe77bda4ec84848f795bd95411140c2ef831bfdbd
Network: Mainnet
Paid to: canercidam
Visit https://openbounty.status.im to learn more.

@canercidam
Copy link
Contributor

Getting a PR ready for this.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants