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

Improve vCenter refresh stability in tests by using runWithRetry #740

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Didainius
Copy link
Collaborator

@Didainius Didainius commented Jan 24, 2025

Test improvements only:

This PR enables retry of vCenter "refresh" and "refresh policies" operations for testing. It also removes some of the "sleep" behavior for tests.

Signed-off-by: Dainius Serplis <dserplis@vmware.com>
Signed-off-by: Dainius Serplis <dserplis@vmware.com>
@Didainius Didainius changed the title Improve vCenter refresh stability by using runWithRetry Improve vCenter refresh stability tests by using runWithRetry Jan 24, 2025
@Didainius Didainius marked this pull request as ready for review January 24, 2025 15:01
@Didainius Didainius changed the title Improve vCenter refresh stability tests by using runWithRetry Improve vCenter refresh stability in tests by using runWithRetry Jan 24, 2025
var maximumVcenterRetryTime = 120 * time.Second // The maximum time a single operation will be retried before giving up
var vCenterEntityBusyRegexp = regexp.MustCompile(`(is currently busy|400|BUSY_ENTITY)`) // Regexp to match entity busy error

func runWithRetry(runOperation func() error, errRegexp *regexp.Regexp, duration time.Duration) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We decided to pull this logic out of tests, and out of Terraform provider level https://github.com/vmware/terraform-provider-vcfa/pull/11/files#diff-f4455ddd79cb9237ff3f5c05d6d2c74431b01fa40dd231c43adcc48a00e419c0
We'll move to SDK level instead.

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

Successfully merging this pull request may close these issues.

4 participants