Skip to content

Commit

Permalink
rhp4: fix flaky validate test
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Dec 16, 2024
1 parent bbb96e6 commit fe0cae1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions rhp/v4/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit fe0cae1

Please sign in to comment.