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

Introduce support for Waiting for given cluster conditions #60

Closed
vladimirvivien opened this issue Oct 8, 2021 · 4 comments · Fixed by #73
Closed

Introduce support for Waiting for given cluster conditions #60

vladimirvivien opened this issue Oct 8, 2021 · 4 comments · Fixed by #73
Assignees

Comments

@vladimirvivien
Copy link
Contributor

As a test writer of components running on Kubernetes, it would be extremely useful to have the capability to wait for one or more cluster conditions before proceeding in the test.

A framework for Waiting

A new package klient/wait could be the starting point for an API to express conditions for waiting by leveraging the wait package in API machinery "k8s.io/apimachinery/pkg/util/wait"):

package wait

func For(cond func() (bool, error)){...}

So, a test writer may have condition as follows:

func TestSomething(t *testing.T){
    wait.For(t, func() (bool, error) {
        var ns coreV1.Namespace
        cfg.client.List(ns)
        ...
    )}
}

Pre-defined conditions

The framework could have a collection of pre-defined conditions that can be used by test writers:

func TestSomething(t *testing.T) {
   var pod coreV1.Pod
   wait.For(PodReadyCondition(pod))
}
@harshanarayana
Copy link
Contributor

@vladimirvivien Would you mind assigning this issue to me so that I can take a stab at this if not already being looked at by someone else. ?

@vladimirvivien
Copy link
Contributor Author

@harshanarayana I missed that ping. Sorry.

@harshanarayana
Copy link
Contributor

No worries @vladimirvivien Let me open a PR with some prototype for a feedback.

@harshanarayana
Copy link
Contributor

@vladimirvivien I have opened a draft PR for the same. Hope the changes in there matches with what you had in mind for this behavior.

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

Successfully merging a pull request may close this issue.

2 participants