op-e2e: Reduce flakiness in p2p tests (#9333)
P2P tests were flaking sometimes due to the checks asserting that everything received was published. `require.ElementsMatch` requires that lists be equal, sans duplicates. Sometimes, however, messages would get sent multiple times/not be picked up in time for the assertions leading to errors like this following:
```
listA:
([]string) (len=29) {
... elided
(string) (len=68) "0xd770621d3b0a196087ace7efcb0a8a61b353736526f6095946c714ec134b1648:1",
(string) (len=69) "0x71a364bf88d4e7e049cfe1635e95c31c9d93435b03a4d20c8863637fc0eb319f:28",
(string) (len=68) "0xd770621d3b0a196087ace7efcb0a8a61b353736526f6095946c714ec134b1648:1"
}
listB:
([]string) (len=29) {
(string) (len=68) "0xd770621d3b0a196087ace7efcb0a8a61b353736526f6095946c714ec134b1648:1",
... elided
(string) (len=69) "0xf84acde28fb7b630f9e5d91bddc7c2d4d2e1f4ce29a7d1a4551fee9ac828b10f:29"
}
extra elements in list A:
([]interface {}) (len=1) {
(string) (len=68) "0xd770621d3b0a196087ace7efcb0a8a61b353736526f6095946c714ec134b1648:1"
}
extra elements in list B:
([]interface {}) (len=1) {
(string) (len=69) "0xf84acde28fb7b630f9e5d91bddc7c2d4d2e1f4ce29a7d1a4551fee9ac828b10f:29"
}
```
This PR refactors to use `require.Subset` which handles this case while still asserting that everything received was in fact published.
Showing
Please register or sign in to comment