-
Notifications
You must be signed in to change notification settings - Fork 22
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
self-contained tests for tasks #84
Comments
Related to #33 |
Typically, I would recommend abstracting the DB and Chain away, so you don't need to even think about what sea-orm provides. You would then mock the chain query responses and and have a minimal in-memory impl for the DB to use in tests. Since the code already takes a hard dependency on sea-orm, I can only imagine that this would be a pain. Might be worth in in the long-run though :) At least, that's my naive take. |
I've been looking into this a bit more. I have some ideas. I'm thinking it might be possible to decouple On a quick pass, Then I'll try writing some mocks for the new Input trait and the DB traits and making creating a super stupid test Might be a dead end, but then I'll understand better. Break some eggs. |
I don't think we should need to abstract away the If you want to abstract away the |
Yeah. It would definitely be less context to manage to just test the tasks against As a side note, since Then I'd be much more confident that testing the tasks in their crate would be plenty. |
I've made some good progress this weekend. I'm just working on the Genesis tasks for now, while I'm getting to know At first, I decided to do the in-memory I've run through |
The multiple returning is just to make sure the order is the proper order. It's not that important -- you could replace it with a function that zips the input with the index in the list. This felt a little hacky so I preferred using returning since I assumed the perf hit of the added return data would be limited. If it's a blocker for another reason, we could get rid of it. |
Sounds good. I'll give that a shot. |
K. I have a draft PR up here: MitchTurner#2 I was able to remove the I'm not sure yet what you meant by
The order of which values? I didn't end up needing to zip anything, so I'm worried I missed something. Regardless, this is a perfect candidate for a test. |
K. I think this PR for the Genesis Tasks is ready for review: Sorry, it's a little beefy. |
Right now we only have integration tests. These tests are fine, but require a fully synced instance of the node so it's hard to use as a ci test or for internal testing for devs who don't have a synchronized instance yet.
We could add a test system to test tasks individually as an inyegration test of the indexer itself. Unfortunately this is non-trivial because creating mock chains for testing is one of the hardest things you could attempt for blockchains.
Probably the best way to do this while avoiding having to build a mock chain is to have ot work the following way:
This will be really complicated to get correct, really complicated to write correctly and only provide marginal improvements over the existing system which is why I never spent time on it.
You could also buils unit tests for simgle tasks in the same way instead of integration teats for the whole execution graph, but the test infra you would need for this ends up being the same so you may as well try and catch more bugs with integration tests
The text was updated successfully, but these errors were encountered: