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

Set a more reasonable default for gomega eventually's polling interval #3992

Closed
lburgazzoli opened this issue Jan 19, 2023 · 3 comments · Fixed by #4008
Closed

Set a more reasonable default for gomega eventually's polling interval #3992

lburgazzoli opened this issue Jan 19, 2023 · 3 comments · Fixed by #4008
Assignees
Labels
area/continuous integration Related to CI and automated testing good first issue Does not require full understanding of the codebase

Comments

@lburgazzoli
Copy link
Contributor

I noticed that in the e2e tests we don't set any value for the eventually's polling interval so by default is likely to be 10ms.
Given we have tests for which the timeout is set to minutes it could make sense to set a more reasonable poll interval.

The default can be programmatic defined by using SetDefaultEventuallyPollingInterval :

// SetDefaultEventuallyTimeout sets the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses.
func SetDefaultEventuallyTimeout(t time.Duration) {
    Default.SetDefaultEventuallyTimeout(t)
}

// SetDefaultEventuallyPollingInterval sets the default polling interval for Eventually.
func SetDefaultEventuallyPollingInterval(t time.Duration) {
    Default.SetDefaultEventuallyPollingInterval(t)
}

or by setting some env vars:

const (
    EventuallyTimeoutEnvVarName         = "GOMEGA_DEFAULT_EVENTUALLY_TIMEOUT"
    EventuallyPollingIntervalEnvVarName = "GOMEGA_DEFAULT_EVENTUALLY_POLLING_INTERVAL"

    ConsistentlyDurationEnvVarName        = "GOMEGA_DEFAULT_CONSISTENTLY_DURATION"
    ConsistentlyPollingIntervalEnvVarName = "GOMEGA_DEFAULT_CONSISTENTLY_POLLING_INTERVAL"
)

func FetchDefaultDurationBundle() DurationBundle {
    return DurationBundle{
        EventuallyTimeout:         durationFromEnv(EventuallyTimeoutEnvVarName, time.Second),
        EventuallyPollingInterval: durationFromEnv(EventuallyPollingIntervalEnvVarName, 10*time.Millisecond),

        ConsistentlyDuration:        durationFromEnv(ConsistentlyDurationEnvVarName, 100*time.Millisecond),
        ConsistentlyPollingInterval: durationFromEnv(ConsistentlyPollingIntervalEnvVarName, 10*time.Millisecond),
    }
}
@squakez squakez added area/continuous integration Related to CI and automated testing good first issue Does not require full understanding of the codebase labels Jan 19, 2023
@lburgazzoli
Copy link
Contributor Author

What would be the preferred approach ? using env vars or adding something in the e2e support init methods ?

@squakez
Copy link
Contributor

squakez commented Jan 24, 2023

I don't have any preference. Maybe, using env vars makes it a bit more flexible as we can adjust the value depending on the test suite we run.

@tadayosi
Copy link
Member

tadayosi commented Jan 25, 2023

I personally think the default 10ms doesn't make much sense for Camel K E2E in any way, it's too frequent to hit K8s API. Probably a sensible default would be 1s or so. What about hardcoding the default interval to 1s (or other appropriate value) but also enabling us to adjust it via the env vars?

@lburgazzoli lburgazzoli self-assigned this Jan 25, 2023
lburgazzoli added a commit to lburgazzoli/apache-camel-k that referenced this issue Jan 25, 2023
…ing interval apache#3992

This commit set a more reasonable default for gomega inetrnal timeout
and poll interval used for e2e testing.

The defaults are:
- EventuallyTimeout is set to 1s (not changed)
- EventuallyPollingInterval is set to 500ms
- ConsistentlyDuration is set to 100ms (not changed)
- EventuallyPollingInterval is set to 500ms

Values can be configured via env vars:
- E2E_DEFAULT_EVENTUALLY_TIMEOUT
- E2E_DEFAULT_EVENTUALLY_POLLING_INTERVAL
- E2E_DEFAULT_CONSISTENTLY_DURATION
- E2E_DEFAULT_CONSISTENTLY_POLLING_INTERVAL
squakez pushed a commit that referenced this issue Jan 25, 2023
…ing interval #3992

This commit set a more reasonable default for gomega inetrnal timeout
and poll interval used for e2e testing.

The defaults are:
- EventuallyTimeout is set to 1s (not changed)
- EventuallyPollingInterval is set to 500ms
- ConsistentlyDuration is set to 100ms (not changed)
- EventuallyPollingInterval is set to 500ms

Values can be configured via env vars:
- E2E_DEFAULT_EVENTUALLY_TIMEOUT
- E2E_DEFAULT_EVENTUALLY_POLLING_INTERVAL
- E2E_DEFAULT_CONSISTENTLY_DURATION
- E2E_DEFAULT_CONSISTENTLY_POLLING_INTERVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/continuous integration Related to CI and automated testing good first issue Does not require full understanding of the codebase
Projects
None yet
3 participants