From 62bf8ce7e9908d3537cee2ffffeb0f2556e999ac Mon Sep 17 00:00:00 2001 From: Matthias Hanel Date: Tue, 19 Jul 2022 21:38:58 +0200 Subject: [PATCH] fix jwt unit test by ensuring activation issue time is bigger than expiration (#3275) Signed-off-by: Matthias Hanel --- server/jwt_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server/jwt_test.go b/server/jwt_test.go index a148ecf1..48e8a99e 100644 --- a/server/jwt_test.go +++ b/server/jwt_test.go @@ -4326,9 +4326,15 @@ func TestJWTActivationRevocation(t *testing.T) { aExp1Jwt := encodeClaim(t, aExpClaim, aExpPub) aExpCreds := newUser(t, aExpKp) - time.Sleep(1100 * time.Millisecond) aImpKp, aImpPub := createKey(t) + ac := &jwt.ActivationClaims{} + ac.Subject = aImpPub + ac.ImportSubject = "foo" + ac.ImportType = jwt.Stream + token, err := ac.Encode(aExpKp) + require_NoError(t, err) + revPubKey := aImpPub if all { revPubKey = jwt.All @@ -4340,13 +4346,6 @@ func TestJWTActivationRevocation(t *testing.T) { aExpClaim.Exports[0].ClearRevocation(revPubKey) aExp3Jwt := encodeClaim(t, aExpClaim, aExpPub) - ac := &jwt.ActivationClaims{} - ac.Subject = aImpPub - ac.ImportSubject = "foo" - ac.ImportType = jwt.Stream - token, err := ac.Encode(aExpKp) - require_NoError(t, err) - aImpClaim := jwt.NewAccountClaims(aImpPub) aImpClaim.Name = "Import" aImpClaim.Imports.Add(&jwt.Import{