fix ci by adding `Eventually` to wait to start topolvm-controller
@@ -5,9 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
- "os"
"strconv"
- "strings"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -45,20 +43,13 @@ func testHook() {
It("should test hooks", func() {
By("creating pod with TopoLVM PVC")
- const minVerDryRun int64 = 18
- kubernetesVersionStr := os.Getenv("TEST_KUBERNETES_VERSION")
- kubernetesVersion := strings.Split(kubernetesVersionStr, ".")
- Expect(len(kubernetesVersion)).To(Equal(2))
- kubernetesMinorVersion, err := strconv.ParseInt(kubernetesVersion[1], 10, 64)
- Expect(err).ShouldNot(HaveOccurred())
-
- if kubernetesMinorVersion < minVerDryRun {
- stdout, stderr, err := kubectlWithInput(podWithPVCYAML, "-n", nsHookTest, "apply", "-f", "-", "--server-dry-run")
- Expect(err).ShouldNot(HaveOccurred(), "stdout=%s, stderr=%s", stdout, stderr)
- } else {
+ Eventually(func() error {
stdout, stderr, err := kubectlWithInput(podWithPVCYAML, "-n", nsHookTest, "apply", "-f", "-", "--dry-run=server")
- Expect(err).ShouldNot(HaveOccurred(), "stdout=%s, stderr=%s", stdout, stderr)
+ if err != nil {
+ return fmt.Errorf("%v: stdout=%s, stderr=%s", err, stdout, stderr)
}
+ return nil
+ }).Should(Succeed())
stdout, stderr, err := kubectlWithInput(podWithPVCYAML, "-n", nsHookTest, "apply", "-f", "-")
Expect(err).ShouldNot(HaveOccurred(), "stdout=%s, stderr=%s", stdout, stderr)
