mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #27561 from nikhiljindal/fixFedTest
Automatic merge from submit-queue Adding a wait for federation apiserver to be ready in e2e tests Ref #26762 @kubernetes/sig-cluster-federation @mml
This commit is contained in:
commit
d82f3bf305
@ -177,6 +177,10 @@ func (f *Framework) BeforeEach() {
|
||||
f.FederationClientset_1_3, err = LoadFederationClientset_1_3()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
By("Waiting for federation-apiserver to be ready")
|
||||
err := WaitForFederationApiserverReady(f.FederationClientset)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
By("federation-apiserver is ready")
|
||||
}
|
||||
|
||||
By("Building a namespace api object")
|
||||
|
@ -837,6 +837,18 @@ func WaitForDefaultServiceAccountInNamespace(c *client.Client, namespace string)
|
||||
return waitForServiceAccountInNamespace(c, namespace, "default", ServiceAccountProvisionTimeout)
|
||||
}
|
||||
|
||||
// WaitForFederationApiserverReady waits for the federation apiserver to be ready.
|
||||
// It tests the readiness by sending a GET request and expecting a non error response.
|
||||
func WaitForFederationApiserverReady(c *federation_internalclientset.Clientset) error {
|
||||
return wait.PollImmediate(time.Second, 1*time.Minute, func() (bool, error) {
|
||||
_, err := c.Federation().Clusters().List(api.ListOptions{})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
})
|
||||
}
|
||||
|
||||
// WaitForPersistentVolumePhase waits for a PersistentVolume to be in a specific phase or until timeout occurs, whichever comes first.
|
||||
func WaitForPersistentVolumePhase(phase api.PersistentVolumePhase, c *client.Client, pvName string, Poll, timeout time.Duration) error {
|
||||
Logf("Waiting up to %v for PersistentVolume %s to have phase %s", timeout, pvName, phase)
|
||||
|
Loading…
Reference in New Issue
Block a user