koinos / koinos-p2p

The p2p microservice orchestrates the distribution of blocks and transactions between peers.
MIT License
6 stars 4 forks source link

Intermittent Test Failure #150

Closed mvandeberg closed 2 years ago

mvandeberg commented 2 years ago

We are seeing an intermittent test failure:

go test -v github.com/[secure]/[secure]-p2p/internal -coverprofile=./build/internal.out -coverpkg=./internal/...
=== RUN   TestSyncNoError
--- PASS: TestSyncNoError (3.02s)
=== RUN   TestSyncChainID
2021-07-07T19:51:07.610Z    ERROR   p2p-gorpc   go-libp2p-gorpc@v0.1.2/call.go:63   msgpack decode error [pos 0]: stream reset
    p2p_test.go:265: Never got expected error
--- FAIL: TestSyncChainID (2.03s)
=== RUN   TestApplyBlockFailure
--- PASS: TestApplyBlockFailure (0.81s)
FAIL
coverage: 51.1% of statements in ./internal/...
FAIL    github.com/[secure]/[secure]-p2p/internal   5.871s
FAIL
mvandeberg commented 2 years ago

The previous test was checking errors on both the sending and receiving peers. However, now that the black list actually works, we have a race condition. One of the peers can check the chain ID and disconnect before the other peer can perform the same check. The correct condition of the test is that one of the peers has the error, not both.