Skip to content

Commit

Permalink
fix(BRIDGE-276): add margin to tests checking for 1sec jails. (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
xmichelo authored Nov 21, 2024
1 parent f4ac4c4 commit 364b828
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/authenticate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestAuthenticateTooManyAttemptsMany(t *testing.T) {
c[i].C(tag + " AUTHENTICATE PLAIN")
c[i].S("+")
c[i].C(authString).NO(tag)
}), time.Second)
}), 990*time.Millisecond)
})
}

Expand Down
8 changes: 4 additions & 4 deletions tests/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestLoginCapabilities(t *testing.T) {
})
}

func TestLoginTooManyAttemps(t *testing.T) {
func TestLoginTooManyAttempts(t *testing.T) {
runOneToOneTest(t, defaultServerOptions(t), func(c *testConnection, _ *testSession) {
// 3 attempts.
c.C("A001 login user badpass").NO("A001")
Expand All @@ -109,12 +109,12 @@ func TestLoginTooManyAttemps(t *testing.T) {
// The client should be jailed for 1 sec.
require.Greater(t, timeFunc(func() {
c.C("A001 login user badpass").NO("A001")
}), time.Second)
}), 990*time.Millisecond)

// After unjailed, get direct answer.
require.Less(t, timeFunc(func() {
c.C("A001 login user pass").OK("A001")
}), time.Second)
}), 990*time.Millisecond)
})
}

Expand All @@ -134,7 +134,7 @@ func TestLoginTooManyAttemptsMany(t *testing.T) {
wg.Go(func() {
require.Greater(t, timeFunc(func() {
c[i].C("A001 login user badpass").NO("A001")
}), time.Second)
}), 990*time.Millisecond)
})
}

Expand Down

0 comments on commit 364b828

Please sign in to comment.