Merge pull request #1556 from tkleczek/conformance_tests_improvements
storage: conformance tests improvements
This commit is contained in:
commit
1baf48f83c
@ -160,6 +160,9 @@ func testAuthRequestCRUD(t *testing.T, s storage.Storage) {
|
|||||||
if err := s.DeleteAuthRequest(a2.ID); err != nil {
|
if err := s.DeleteAuthRequest(a2.ID); err != nil {
|
||||||
t.Fatalf("failed to delete auth request: %v", err)
|
t.Fatalf("failed to delete auth request: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_, err = s.GetAuthRequest(a1.ID)
|
||||||
|
mustBeErrNotFound(t, "auth request", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAuthCodeCRUD(t *testing.T, s storage.Storage) {
|
func testAuthCodeCRUD(t *testing.T, s storage.Storage) {
|
||||||
@ -213,7 +216,7 @@ func testAuthCodeCRUD(t *testing.T, s storage.Storage) {
|
|||||||
|
|
||||||
got, err := s.GetAuthCode(a1.ID)
|
got, err := s.GetAuthCode(a1.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to get auth req: %v", err)
|
t.Fatalf("failed to get auth code: %v", err)
|
||||||
}
|
}
|
||||||
if a1.Expiry.Unix() != got.Expiry.Unix() {
|
if a1.Expiry.Unix() != got.Expiry.Unix() {
|
||||||
t.Errorf("auth code expiry did not match want=%s vs got=%s", a1.Expiry, got.Expiry)
|
t.Errorf("auth code expiry did not match want=%s vs got=%s", a1.Expiry, got.Expiry)
|
||||||
@ -812,7 +815,7 @@ func testGC(t *testing.T, s storage.Storage) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, err := s.GetAuthRequest(a.ID); err != nil {
|
if _, err := s.GetAuthRequest(a.ID); err != nil {
|
||||||
t.Errorf("expected to be able to get auth code after GC: %v", err)
|
t.Errorf("expected to be able to get auth request after GC: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,7 +826,7 @@ func testGC(t *testing.T, s storage.Storage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := s.GetAuthRequest(a.ID); err == nil {
|
if _, err := s.GetAuthRequest(a.ID); err == nil {
|
||||||
t.Errorf("expected auth code to be GC'd")
|
t.Errorf("expected auth request to be GC'd")
|
||||||
} else if err != storage.ErrNotFound {
|
} else if err != storage.ErrNotFound {
|
||||||
t.Errorf("expected storage.ErrNotFound, got %v", err)
|
t.Errorf("expected storage.ErrNotFound, got %v", err)
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,8 @@ func testKeysConcurrentUpdate(t *testing.T, s storage.Storage) {
|
|||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
n := time.Now().UTC().Round(time.Second)
|
n := time.Now().UTC().Round(time.Second)
|
||||||
keys1 := storage.Keys{
|
keys1 := storage.Keys{
|
||||||
SigningKey: jsonWebKeys[0].Private,
|
SigningKey: jsonWebKeys[i].Private,
|
||||||
SigningKeyPub: jsonWebKeys[0].Public,
|
SigningKeyPub: jsonWebKeys[i].Public,
|
||||||
NextRotation: n,
|
NextRotation: n,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user