msglist test: Fix a state leak from mutating eg.selfUser #1713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1712.
Our CI has been failing in this test file since yesterday; this change fixes that.
This test had been having the store handle a RealmUserUpdateEvent affecting
eg.selfUser. That means the store mutates the actual User object it has... which, in this test context, means the value thateg.selfUseris bound to as a final variable.As a result, when the test gets cleaned up with testBinding.reset, the store gets discarded as usual so that the next test will get a fresh store... but the User object at
eg.selfUseris still the one that's been mutated by this test.That's buggy in principle. Concretely, here, it causes the self-user to have a non-null avatar. When a later test sends a message and causes an outbox-message to appear in the tree, that results in a NetworkImage. And that throws an error, because no HttpClient provider has been set, because that latter test wasn't expecting to create any
NetworkImages. That's the failure we've been seeing in CI.It's still a bit mysterious why this had previously been working (or anyway these tests hadn't been failing). It started failing with an upstream change merged yesterday, which makes changes to NetworkImage that look innocuous: its
==andhashCodebecomefiner-grained, and its
toStringmore detailed. In any case,the bug is ours to fix.
It'd also be good to follow up here by systematically preventing this sort of state leak between tests. But that comes after getting our CI passing again.