From ee6049bdc390bf3d4155f7ba0566a7c344de52bf Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Wed, 20 Nov 2024 18:29:43 +0100 Subject: [PATCH] test cases: fix some random failures Signed-off-by: Nicola Murino --- internal/httpd/httpd_test.go | 4 +++- internal/sftpd/sftpd_test.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/httpd/httpd_test.go b/internal/httpd/httpd_test.go index 9e1dd4c0..064a7488 100644 --- a/internal/httpd/httpd_test.go +++ b/internal/httpd/httpd_test.go @@ -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 } diff --git a/internal/sftpd/sftpd_test.go b/internal/sftpd/sftpd_test.go index 3ddf3fa7..56e8b703 100644 --- a/internal/sftpd/sftpd_test.go +++ b/internal/sftpd/sftpd_test.go @@ -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 }