Allow more time for certificate creation in live tests
@@ -53,18 +53,18 @@ func pollStatus(t *testing.T, expectedStatus int, fn func() error) {
require.NoError(t, err)
}
-// pollCertOperation polls a certificate operation for up to 20 seconds, stopping when it completes.
-// It fails the test if a poll fails or the operation is cancelled.
+// pollCertOperation polls a certificate operation for up to 40 seconds, stopping when it completes.
+// It fails the test if a poll fails or the operation doesn't complete successfully in the allotted time.
func pollCertOperation(t *testing.T, client *azcertificates.Client, name string) {
var err error
var op azcertificates.GetCertificateOperationResponse
- for i := 0; i < 5; i++ {
+ for i := 0; i < 9; i++ {
op, err = client.GetCertificateOperation(ctx, name, nil)
require.NoError(t, err)
require.NotNil(t, op.Status)
switch s := *op.Status; s {
case "completed":
- break
+ return
case "cancelled":
t.Fatal("cert creation cancelled")
case "inProgress":
@@ -72,11 +72,12 @@ func pollCertOperation(t *testing.T, client *azcertificates.Client, name string)
default:
t.Fatalf(`unexpected status "%s"`, s)
}
- if i < 4 {
+ if i < 8 {
recording.Sleep(5 * time.Second)
+ } else {
+ t.Fatal("cert creation didn't complete in time")
}
}
- require.NoError(t, err)
}
type serdeModel interface {
