Commit a04b44e
committed
msglist test: Fix a state leak from mutating eg.selfUser
Fixes zulip#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
that `eg.selfUser` is 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.selfUser` is 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 `NetworkImage`s. 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 `==` and `hashCode` become
finer-grained, and its `toString` more 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.1 parent a3bbee9 commit a04b44e
1 file changed
+6
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1693 | 1693 | | |
1694 | 1694 | | |
1695 | 1695 | | |
| 1696 | + | |
| 1697 | + | |
1696 | 1698 | | |
1697 | | - | |
| 1699 | + | |
1698 | 1700 | | |
1699 | 1701 | | |
1700 | 1702 | | |
1701 | 1703 | | |
1702 | 1704 | | |
1703 | | - | |
1704 | | - | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1705 | 1708 | | |
1706 | 1709 | | |
1707 | 1710 | | |
| |||
0 commit comments