test cases: fix some random failures

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2024-11-20 18:29:43 +01:00
parent 6bc2f8d16e
commit ee6049bdc3
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
2 changed files with 6 additions and 2 deletions

View file

@ -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
}

View file

@ -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
}