tests: add timeout to key version destruction test (#3537)

This commit is contained in:
Johan Brandhorst-Satzkorn authored and GitHub committed 2023-08-03 11:08:28 -07:00
1 parent 65f20f3d6f
commit 5e78fc72c5
1 file changed
+4
@@ -4,6 +4,7 @@
package credentials_test
import (
"context"
"fmt"
"net/http"
"testing"
@@ -493,6 +494,8 @@ func TestUpdateAfterKeyRotation(t *testing.T) {
// Should start asynchronous rewrapping of the encrypted JSON credential
assert.Equal("pending", result.State)
ctx, cancel := context.WithTimeout(ctx, time.Minute)
defer cancel()
for {
jobs, err := scopesClient.ListKeyVersionDestructionJobs(ctx, proj.PublicId)
require.NoError(err)
@@ -501,6 +504,7 @@ func TestUpdateAfterKeyRotation(t *testing.T) {
}
select {
case <-ctx.Done():
t.Fatalf("Timed out waiting for key version destruction job, got jobs: %#v", jobs.Items)
break
case <-time.After(time.Millisecond * 100):
}