Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retries for UPDATE/UPSERT Resource Steps #129

Open
danielhelfand opened this issue Nov 28, 2023 · 0 comments
Open

Retries for UPDATE/UPSERT Resource Steps #129

danielhelfand opened this issue Nov 28, 2023 · 0 comments

Comments

@danielhelfand
Copy link
Contributor

The steps below can be added to feature files that allow them to update/upsert resources during tests.

kubedog/kubedog.go

Lines 48 to 53 in bb3a5e1

kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resource (\S+)$`, kdt.KubeClientSet.ResourceOperation)
kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resource (\S+) in (?:the )?([^"]*) namespace$`, kdt.KubeClientSet.ResourceOperationInNamespace)
kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resources in (\S+)$`, kdt.KubeClientSet.ResourcesOperation)
kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resources in (\S+) in (?:the )?([^"]*) namespace$`, kdt.KubeClientSet.ResourcesOperationInNamespace)
kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resource (\S+), the operation should (succeed|fail)$`, kdt.KubeClientSet.ResourceOperationWithResult)
kdt.scenario.Step(`^(?:I )?(create|submit|delete|update|upsert) (?:the )?resource (\S+) in (?:the )?([^"]*) namespace, the operation should (succeed|fail)$`, kdt.KubeClientSet.ResourceOperationWithResultInNamespace)

In some circumstances, there may be resources that are acted on by other services within a testing environment (e.g. Horizontal Pod Autoscaler). If that resource is updated by another actor, you can get errors like below:

Error: Operation cannot be fulfilled on horizontalpodautoscalers.autoscaling "iks-express-test-asset-rollout-hpa": the object has been modified; please apply your changes to the latest version and try again

To get around this, we can always update the resource version of the resource that is going to be updated in the test. However, we may need to retry in some cases if the resource is being continuously updated in a way that conflicts with the tests updated. If we implement a retry option for these steps, it may help to avoid these conflicts during tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant