-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix all hanging tests, reduce flakyness of other tests #2186
Conversation
…udes a protobuf change. * Bugfix: change gracefulDiconnect into notification (it was previously partly treated as a notification) * Bugfix: do not open new connections when ConnectionManager is in Stopping state * Make timeouts unique by single milliseconds to make it easier to recognize in debug tools which timeout is which * Force SimulatorConnection to send 'disconnect' event in close() the same way as websocket connections * Add constructor option 'stopGivenTransport' DhtNode to indicate that the given transport should not be stopped when the DhtNode is stopped. * Use the 'stopGivenTransport' in trackerless tests (the transports were not previously stopped at all) * Call stop() on simulator in tests if it was started
@@ -68,6 +69,10 @@ describe('inspect', () => { | |||
Simulator.useFakeTimers(false) | |||
}) | |||
|
|||
afterAll(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to afterEach
@@ -32,6 +32,9 @@ export class SimulatorConnector { | |||
} | |||
|
|||
public connect(targetPeerDescriptor: PeerDescriptor): ManagedConnection { | |||
if (this.stopped) { | |||
console.error('connect() called on stopped SimulatorConnector') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove console.error
@@ -30,7 +30,8 @@ describe('inspect', () => { | |||
layer0: { | |||
entryPoints: [publisherDescriptor], | |||
peerDescriptor, | |||
transport | |||
transport, | |||
stopGivenTransport: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could use the same pattern as in dht
test utils:
network/packages/dht/test/utils/utils.ts
Lines 75 to 76 in e88eaca
const node = new class extends DhtNode { | |
async stop(): Promise<void> { |
Or we could add e.g. stop
event which the creator of the instance could listen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about passing a transport factory instead the transport itself?
…m:streamr-dev/network-monorepo into fix-all-dht-and-trackerless-hanging-tests
…m:streamr-dev/network-monorepo into fix-all-dht-and-trackerless-hanging-tests
Fix all hanging tests. Includes a protobuf change.
Bugfix: change gracefulDiconnect into notification (it was previously partly treated as a notification)
Bugfix: do not open new connections when ConnectionManager is in Stopping state
Make timeouts unique by single milliseconds to make it easier to recognize in debug tools which timeout is which
Force SimulatorConnection to send 'disconnect' event in close() the same way as websocket connections
Add constructor option 'stopGivenTransport' DhtNode to indicate that the given transport should not be stopped when the DhtNode is stopped.
Use the 'stopGivenTransport' in trackerless tests (the transports were not previously stopped at all)
Call stop() on simulator in tests if it was started
remove --force-exit from test scripts
remove memory leaks from client by adding handling of destroy signal to many places and by removing closures
fix mqtt bridge test to properly wait for arriving messages
fix websocket connection establishment in broker websocket plugin test (previously 'error' waitForEvent would time out and cause unhandled promise exception on slower machines)
await for sub1.unsubscribe() in memory leak test to get the subscription to non-random state before testing for memory leaks