mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
flake: Fixes TestServerOperatorModeUserInfoExpiration
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
This commit is contained in:
@@ -6637,7 +6637,14 @@ func TestServerOperatorModeUserInfoExpiration(t *testing.T) {
|
||||
|
||||
userInfo := response.Data.(*UserInfo)
|
||||
require_True(t, userInfo.Expires != 0)
|
||||
require_True(t, expires.Sub(now).Truncate(time.Second) == userInfo.Expires)
|
||||
|
||||
// We need to round the expiration time to the second because the server
|
||||
// will truncate the expiration time to the second.
|
||||
expiresDurRounded := expires.Sub(now).Truncate(time.Second)
|
||||
|
||||
// Checking range to avoid flaky tests where the expiration time is
|
||||
// off by a couple of seconds.
|
||||
require_True(t, expiresDurRounded >= userInfo.Expires-2*time.Second && expiresDurRounded <= userInfo.Expires+2*time.Second)
|
||||
}
|
||||
|
||||
func TestJWTAccountNATSResolverWrongCreds(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user