Skip to content

Commit

Permalink
Merge pull request #95 from merlin-northern/2.1.x-tests-timeouts
Browse files Browse the repository at this point in the history
[cherry-picks] test: sudden failures: increasing timeouts.
  • Loading branch information
merlin-northern committed Feb 23, 2023
2 parents de35b7e + cbffc5f commit 84b3483
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion connectionmanager/connectionmanager_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Northern.tech AS
// Copyright 2023 Northern.tech AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +27,8 @@ import (
"github.com/vmihailenco/msgpack/v5"
)

const waitForWebsocketServer = 2 * time.Second

func init() {
DefaultPingWait = 10 * time.Second
}
Expand Down Expand Up @@ -94,6 +96,8 @@ func TestConnect(t *testing.T) {

_ = Close(ws.ProtoTypeShell)

time.Sleep(waitForWebsocketServer)

ctx := context.Background()
err := Connect(ws.ProtoTypeShell, "ws://localhost:8999", "/ws", "token", 1, ctx)
assert.Nil(t, err)
Expand Down Expand Up @@ -123,6 +127,8 @@ func TestReconnect(t *testing.T) {
_ = srv.Shutdown(context.Background())
}()

time.Sleep(waitForWebsocketServer)

_ = Close(ws.ProtoTypeShell)

ctx := context.Background()
Expand Down
4 changes: 3 additions & 1 deletion session/portforward_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2021 Northern.tech AS
// Copyright 2023 Northern.tech AS
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -218,6 +218,8 @@ func TestPortForwardHandlerSuccessfulConnection(t *testing.T) {
}
}(tcpPort)

time.Sleep(2000 * time.Millisecond)

// c1: new
protocol := wspf.PortForwardProtocol(wspf.PortForwardProtocolTCP)
remoteHost := "localhost"
Expand Down

0 comments on commit 84b3483

Please sign in to comment.