Skip to content

Commit

Permalink
Tests: retry VaultConnection updates (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
benashz committed May 15, 2024
1 parent 5b0a602 commit 0565d6e
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions test/integration/vaultdynamicsecret_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,29 @@ func TestVaultDynamicSecret_vaultClientCallback(t *testing.T) {
Name: obj.Spec.VaultAuthRef,
})
if assert.NoError(t, err) {
connObj, err := common.GetVaultConnection(ctx, crdClient, ctrlclient.ObjectKey{
Namespace: obj.Namespace,
Name: authObj.Spec.VaultConnectionRef,
})
if assert.NoError(t, err) {
var updateErr error
assert.Eventually(t, func() bool {
connObj, err := common.GetVaultConnection(ctx, crdClient, ctrlclient.ObjectKey{
Namespace: obj.Namespace,
Name: authObj.Spec.VaultConnectionRef,
})
if err != nil {
updateErr = err
return false
}

connObj.Spec.Headers = map[string]string{
"X-test-it": "true",
}
assert.NoError(t, crdClient.Update(ctx, connObj))
}
if err := crdClient.Update(ctx, connObj); err != nil {
updateErr = err
return false
}

updateErr = nil
return true
}, 5*time.Second, 1*time.Second, "failed to update VaultConnection after 5s")
assert.NoError(t, updateErr, "failed to update VaultConnection")
}
}
},
Expand Down

0 comments on commit 0565d6e

Please sign in to comment.