-
Notifications
You must be signed in to change notification settings - Fork 56
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
Splitting tests #490
Splitting tests #490
Conversation
…ll (to be developed later)
… works just fine locally 💸
After talking with @druiz0992 I removed the wallet-test as it was failing inexplicably and the tests make little sense now given that we will have a brand new shiny wallet |
We have to think about all config files related with tests. They were unified in the config module in the issue #398 about rationalizing configs. |
Hey, add me as a reviewer on that one, let's merge it as it's been here for a while. I'll solve the conflicts with this one. I'm having a hard time making the tests pass reliably anyway. |
fb91cac
to
e035052
Compare
9915b5e
to
f061f15
Compare
b1269af
to
6ca1b30
Compare
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.
Nice code! Just a few minor comments.
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.
This refactor makes the test files more modular and clear to understand.
This looks very clean and much easier to debug.
I requested a few changes as suggested in earlier comments.
0afa0f6
to
d2e79b7
Compare
Fixes #504 |
So we needed e2e tests to be splitted as per #413 . I went ahead and made some more changes to improve them and make them easier to maintain on the long run. Here are some considerations to sustain this:
Organization stuff
no-await-in-loop
rule toeslint.rc
, as we had about 70+ inline eslint rules exceptions. We can think of having them on a per-file basis though. As you know, we use await in loops to avoid nonce issues, mostly.e2e-protocol
ande2e-tokens
, don't mind the naming though. The idea is to have tests related to challengers, proposers, chain-reorgs, future PoS tests, whatever is protocol-related, inside this folder. The other one would be to test anything ERC-related.index.test.mjs
file that imports the tests from that folder. This allows us to skip specific files for development.VERBOSE
env variable you can pass to tests, to see all the info logs (ex.VERBOSE=true npm run test-e2e-tokens
). Otherwise, only error or other very relevant messages show on the console.chain-reorg
, etc.Big changes in tests
describe
.constants.mjs
file with a bunch of key-values, which was cumbersome to read. I created somejson
files to save them nice and tidy and easy to maintain.submitTransaction
,getBalance
,closeWeb3Connection
, etc that we would pass an instance of web3 to. I though it would make sense to make a class to abstract all the things we want with web3. So at the start of the tests we just get an instance of this class and use it without having to juggle with an web3 instance being passed around on every function call. It's also easy to clean up after each test. There's a getter.getWeb3()
that will return you the web3 provider if you want to use the "raw" web3 provider.logCounts
as it looks a bit naive for the uninitiated. I tried to remove it and I failed miserably, we really need it. As per the point above, I created asubcribeTo
method on the newWeb3
class that hopefully abstracts the queueing of the logs. SologCounts
is nowlogs
and is an object with some arrays of logs inside, we just check the length if we actually need to count them. This way we can reuse thesubscribeLogs
method for every kind of blockchain event,newBlockHeaders
,transactionSubmitted
,newCurrentProposer
, you name it. Easier to add some more events in the future.Some other weird changes
getLayer2Balances
wasn't really working. I fixed that, and got rid offilterByCompressedPkd
parameter as it wasn't being used anywhere.getLayer2Balances
retrieves the nf3 instance's balance, and that's all. For the same reason I got rid of/balances-details
, as we don't use it at all.