Skip to content

Commit a315414

Browse files
authored
Tests: retry VaultAuth updates (#754)
1 parent 17f8448 commit a315414

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

test/integration/vaultdynamicsecret_integration_test.go

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -691,14 +691,27 @@ func TestVaultDynamicSecret_vaultClientCallback(t *testing.T) {
691691
triggerFunc: func(t *testing.T, reconciledObjs []*secretsv1beta1.VaultDynamicSecret) {
692692
t.Helper()
693693
for _, obj := range reconciledObjs {
694-
authObj, err := common.GetVaultAuth(ctx, crdClient, ctrlclient.ObjectKey{
695-
Namespace: obj.Namespace,
696-
Name: obj.Spec.VaultAuthRef,
697-
})
698-
if assert.NoError(t, err) {
694+
var updateErr error
695+
assert.Eventually(t, func() bool {
696+
authObj, err := common.GetVaultAuth(ctx, crdClient, ctrlclient.ObjectKey{
697+
Namespace: obj.Namespace,
698+
Name: obj.Spec.VaultAuthRef,
699+
})
700+
if err != nil {
701+
updateErr = err
702+
return false
703+
}
704+
699705
authObj.Spec.Kubernetes.TokenAudiences = []string{"vault", "test"}
700-
assert.NoError(t, crdClient.Update(ctx, authObj))
701-
}
706+
if err := crdClient.Update(ctx, authObj); err != nil {
707+
updateErr = err
708+
return false
709+
}
710+
711+
updateErr = nil
712+
return true
713+
}, 5*time.Second, 1*time.Second, "failed to update VaultAuth after 5s")
714+
assert.NoError(t, updateErr, "failed to update VaultAuth")
702715
}
703716
},
704717
},

0 commit comments

Comments
 (0)