fix: wait until clusters are running in tests
before we try to do anything on them
@@ -79,6 +79,9 @@ var _ = SynchronizedBeforeSuite(func() []byte {
ensureCluster()
os.Setenv("KUBECONFIG", nodeTmpDir+"/kubeconfig")
+ out, err = waitUntilClusterNodeReady()
+ Expect(err).ToNot(HaveOccurred(), out)
+
os.Setenv("EPINIO_CONFIG", nodeTmpDir+"/epinio.yaml")
if os.Getenv("REGISTRY_USERNAME") != "" && os.Getenv("REGISTRY_PASSWORD") != "" {
@@ -222,6 +225,15 @@ func ensureCluster() {
}
}
+func waitUntilClusterNodeReady() (string, error) {
+ nodeName, err := RunProc("kubectl get nodes -o name", nodeTmpDir, false)
+ if err != nil {
+ return "", err
+ }
+
+ return RunProc("kubectl wait --for=condition=Ready "+nodeName, nodeTmpDir, false)
+}
+
func deleteCluster() {
name := fmt.Sprintf("epinio-acceptance-%s", nodeSuffix)
