-
Notifications
You must be signed in to change notification settings - Fork 54
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
fix: Rework the P2P integration tests #989
fix: Rework the P2P integration tests #989
Conversation
b9727e5
to
4800cd3
Compare
Codecov Report
@@ Coverage Diff @@
## develop #989 +/- ##
===========================================
+ Coverage 57.74% 58.02% +0.28%
===========================================
Files 174 174
Lines 19563 19563
===========================================
+ Hits 11297 11352 +55
+ Misses 7265 7215 -50
+ Partials 1001 996 -5
|
I'm happy to see that you dived into the P2P related code. I wasn't expecting this much change on the test utility though haha. There are a few things you changed that I think shouldn't have been changed. The peer test was done in that way because it allowed for testing the pubsub process in a deterministic fashion. For each updates, the test would wait for the receiving peer to acknowledge reception and then the result would be asserted. Eventual consistency is the outcome of processing a log but not the intent of the test. The pubsub network can only update documents that where at first created exactly the same on both nodes. Hence why the check is on a specific document and a The key points to keep in mind is that pubsub configuration happens during the node setup while replicators are added to an already running node. Peers on the pubsub network subscribe to a specific document's updates while replicators subscribe to all actions on a collection (or any number of collections). If you want me to get on a call to discuss this with you tomorrow feel free to reach out. |
No, but it is ultimately what we care about, and far more intuitive to read IMO (as well as being more consistent with all our other tests).
Correction - created records should not be synced - this is untested and needs to be tested, and previously could not be tested. We also need to test that newly created records should also not break the peer system.
I understand this, and there are large test holes described in the description that are now possible to fill. It sounds like it would be prudent to hold off on further review until I add those tests as they will do a better job at describing these holes, as well as the duplication/conflicts present in the old system. |
The way you changed the test makes it impossible to test that the peer got the update as the test will pass even if the value stays the same. |
I dont follow. You are talking about on update? The tests show that the values have been synced, and are the same across both systems (something the prior version was unable to assert). It does not check the commit history, but that is easy enough to add if we want, and I would suggest that is highly secondary to the fact that they both have the same head value (especially given that the history is somewhat required to achieve that state, or the test would be flacky as it would only pass ~half of the time). |
You are asserting with |
This is incorrect. |
Actions discussed outside of github:
|
0451f2e
to
70121bb
Compare
There was a typo, and the name suggests it tests everything replicator related - and that no further tests are required
This commit merges the properties associated with the peer-tests with the properties associated with the replicator tests. There was a lot of duplication, and it prevented testing of both peer and replicator tests within the same test case due to id/index clashes. It also reworks the code so that the two elements work in largely the same way. It should allow replicators to test updates, and peers to test creates. The both peer and replicator tests now assert on the final state of all databases for all nodes. This feels both more meaningful and clearer IMO, although it does add a few lines to each test, as well as some fanciness required to deal with the non-deterministic results of the peer sync tests.
Looks both overly defensive, and enables a silent failure
Is about to get crowded :)
Good spot by Fred, due to the containing if this is only ever done once anyway making the spread pointless
Not requested, but it is inconsistent with create and just generally ambiguous
Not requested, but it is inconsistent with create and just generally ambiguous
Previous behaviour was a bug that has now been fixed
Production bug has been fixed
Behaviour was correct, linked ticket has been closed
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 is great. Thank for engaging with the suggestions :)
Thank you for suggesting them (and all the other related work around this) :) |
* Duplicate net tests In order to preserve the order driven tests * Rework replicator tests so that each expected result is asserted upon Deletion of pretty much any property/item in the test case will now cause it to fail, before many of these deletions would permit it to pass without asserting the expected results. Much of this commit has been moved and reworked later, however I chose to preserve it as it highlights the behavioural change specific to this commit. * Expand replicator tests There was a typo, and the name suggests it tests everything replicator related - and that no further tests are required * Refactor test library This commit merges the properties associated with the peer-tests with the properties associated with the replicator tests. There was a lot of duplication, and it prevented testing of both peer and replicator tests within the same test case due to id/index clashes. It also reworks the code so that the two elements work in largely the same way. It should allow replicators to test updates, and peers to test creates. The both peer and replicator tests now assert on the final state of all databases for all nodes. This feels both more meaningful and clearer IMO, although it does add a few lines to each test, as well as some fanciness required to deal with the non-deterministic results of the peer sync tests. * Remove uneeded check Looks both overly defensive, and enables a silent failure * Breakup P2P test file Is about to get crowded :) * Expand tests
* Duplicate net tests In order to preserve the order driven tests * Rework replicator tests so that each expected result is asserted upon Deletion of pretty much any property/item in the test case will now cause it to fail, before many of these deletions would permit it to pass without asserting the expected results. Much of this commit has been moved and reworked later, however I chose to preserve it as it highlights the behavioural change specific to this commit. * Expand replicator tests There was a typo, and the name suggests it tests everything replicator related - and that no further tests are required * Refactor test library This commit merges the properties associated with the peer-tests with the properties associated with the replicator tests. There was a lot of duplication, and it prevented testing of both peer and replicator tests within the same test case due to id/index clashes. It also reworks the code so that the two elements work in largely the same way. It should allow replicators to test updates, and peers to test creates. The both peer and replicator tests now assert on the final state of all databases for all nodes. This feels both more meaningful and clearer IMO, although it does add a few lines to each test, as well as some fanciness required to deal with the non-deterministic results of the peer sync tests. * Remove uneeded check Looks both overly defensive, and enables a silent failure * Breakup P2P test file Is about to get crowded :) * Expand tests
Relevant issue(s)
Resolves #985
Description
I started changing stuff as the Replicator tests permitted tests to pass when they shouldn't (first commit). This PR then goes on to expand the replicator tests. Then, as my understanding grew I reworked the rest for the reasons laid out in the message body of the 3rd commit.
I am planning to expand the replicator and peer tests further (create for peer, update for replicator, and tests that configure both). I am quite new to this part of the codebase though, so it is very possible that some of that will not be possible due to me misunderstanding the desired behaviour (will probs badger Fred here). This expansion may take place in this PR if no one gets back to me before I resume work tomorrow - do let me know your thoughts in the meantime though :)New tests have been includedNo production bugs have been found yet.Probable production bug found: #1000Another prod bug found: #1031 - Waiting on this to be merged before finalizing the test code.