Replies: 4 comments 1 reply
-
I can chime in here. This would be enormously useful for us. Currently most of the errors we're experiencing with the subsquid indexer involve bad types which are not exposed to polkadotJS until the relevant event is emitted from the chain. When the badly typed/untyped event is emitted, it can crash the indexer. I take it by generating a block with every possible event, we would be able to see these potential type issues before we go to prod. If so, big +1. |
Beta Was this translation helpful? Give feedback.
-
I've said this before but I would rather ensure that we can test things in isolation. If we can't, then we should refactor so that we can. If we have N different subsystems each with M different states, an integration test needs to cover all possible combinations: M^N possible states. This escalates quickly - it becomes impossible to know what is and isn't covered because you have to trace all possible code paths to know what states the system can reach. If we test in isolation, we have M*N states to test. The type checking is a good example: it does not rely in any way on the rpc interface, or building a state chain block, or subscription channels etc. The way to do this is to write a test that takes a serialized event, and tries to deserialize it based on the available metadata. Then we can generate each possible event, serialize it, and run the deserialization test against each event. I think this is more or less what you are proposing, I'm just saying we should not couple this to testing a bunch of other stuff like rpcs or block authorship. For example:
If we can do this (instantiate a block) then we don't need to put it on a running network in order to test it via rpc. |
Beta Was this translation helpful? Give feedback.
-
We should also consider the maintenance and debt we would be creating potentially with a batch of tests which seem to confirming already things known(and well tested) and not testing, as Dan says, in isolation. As our communication between the sub-components(SC, CFE, FE(Indexer)) hinge on events then maybe we should be looking at something which is lighter in terms of mocking. The integration tests for the SC have a simply mock the CFE with the interaction of events and calls across the two. |
Beta Was this translation helpful? Give feedback.
-
Just so this conversation is wrapped up, we decided to go with use a trait to wrap the RPCs that connect to external sources so we can use mockall to mock the responses of any requests made to the state chain (and an ethereum node). See #1130 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Wanted to raise this as a discussion to collect ideas on how to approach this.
Currently testing the CFE is difficult because what it does and what states it gets into is entirely dependent on the State Chain and the events it emits.
Testing the frontend is equally difficult, we depend on a running state chain, and when the state chain crashes, we can no longer test frontend features.
What I think a mock could look like:
Beta Was this translation helpful? Give feedback.
All reactions