Skip to content

Commit

Permalink
test cases: fix some random failures
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
  • Loading branch information
drakkan committed Nov 20, 2024
1 parent 6bc2f8d commit ee6049b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion internal/httpd/httpd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13556,7 +13556,9 @@ func TestMaxTransfers(t *testing.T) {
err = os.RemoveAll(user.GetHomeDir())
assert.NoError(t, err)
assert.Len(t, common.Connections.GetStats(""), 0)
assert.Equal(t, int32(0), common.Connections.GetTotalTransfers())
assert.Eventually(t, func() bool {
return common.Connections.GetTotalTransfers() == 0
}, 1000*time.Millisecond, 50*time.Millisecond)

common.Config.MaxPerHostConnections = oldValue
}
Expand Down
4 changes: 3 additions & 1 deletion internal/sftpd/sftpd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4457,7 +4457,9 @@ func TestMaxTransfers(t *testing.T) {
assert.NoError(t, err)
err = os.RemoveAll(user.GetHomeDir())
assert.NoError(t, err)
assert.Equal(t, int32(0), common.Connections.GetTotalTransfers())
assert.Eventually(t, func() bool {
return common.Connections.GetTotalTransfers() == 0
}, 1000*time.Millisecond, 50*time.Millisecond)

common.Config.MaxPerHostConnections = oldValue
}
Expand Down

0 comments on commit ee6049b

Please sign in to comment.