This commit is contained in:
Zoltán Papp
2025-06-02 17:11:25 +02:00
parent 2a3623d6ac
commit 8be95a2efb

View File

@@ -1,6 +1,7 @@
package peer
import (
"context"
"errors"
"sync"
"testing"
@@ -99,10 +100,12 @@ func TestGetPeerStateChangeNotifierLogic(t *testing.T) {
err := status.UpdatePeerRelayedStateToDisconnected(peerState)
assert.NoError(t, err, "shouldn't return error")
timeoutCtx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
select {
case <-sub.eventsChan:
default:
t.Errorf("channel wasn't closed after update")
case <-timeoutCtx.Done():
t.Errorf("timed out waiting for event")
}
}