From fe0cae1b916b0a124c7577e2c056d6a8dae3590d Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 16 Dec 2024 11:25:13 -0800 Subject: [PATCH] rhp4: fix flaky validate test --- rhp/v4/validation_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/rhp/v4/validation_test.go b/rhp/v4/validation_test.go index 77cb187..2bb548c 100644 --- a/rhp/v4/validation_test.go +++ b/rhp/v4/validation_test.go @@ -18,19 +18,16 @@ func TestValidateAccountToken(t *testing.T) { ac := AccountToken{ HostKey: hostKey, Account: account, - ValidUntil: time.Now(), + ValidUntil: time.Now().Add(-time.Minute), } if err := ac.Validate(frand.Entropy256()); !strings.Contains(err.Error(), "host key mismatch") { t.Fatalf("expected host key mismatch, got %v", err) - } - - if err := ac.Validate(hostKey); !strings.Contains(err.Error(), "token expired") { + } else if err := ac.Validate(hostKey); !strings.Contains(err.Error(), "token expired") { t.Fatalf("expected token expired, got %v", err) } ac.ValidUntil = time.Now().Add(time.Minute) - if err := ac.Validate(hostKey); !errors.Is(err, ErrInvalidSignature) { t.Fatalf("expected ErrInvalidSignature, got %v", err) }