From 64ca401a5180d6477050a11ced5a621e3cdb5c60 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 4 Sep 2019 09:55:40 +0530 Subject: [PATCH] Fix mon endpoint issue in E2E in toolbox mon endpoints are not updated properly, this is causing an issue in E2E this PR is a workaround to fix this issue. Signed-off-by: Madhu Rajanna --- e2e/cephfs.go | 1 - e2e/deploy-rook.go | 26 ++++++++++++++++++++++++++ e2e/rbd.go | 1 - e2e/utils.go | 15 --------------- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/e2e/cephfs.go b/e2e/cephfs.go index 89981b311..9cf788121 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -61,7 +61,6 @@ var _ = Describe("cephfs", func() { BeforeEach(func() { updateCephfsDirPath(f.ClientSet) createFileSystem(f.ClientSet) - waitTillMonsAreUp(f) createConfigMap(cephfsDirPath, f.ClientSet, f) deployCephfsPlugin() createCephfsSecret(f.ClientSet, f) diff --git a/e2e/deploy-rook.go b/e2e/deploy-rook.go index 297c0ebec..361d048a2 100644 --- a/e2e/deploy-rook.go +++ b/e2e/deploy-rook.go @@ -3,6 +3,7 @@ package e2e import ( "fmt" "strings" + "time" . "github.com/onsi/gomega" // nolint metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -97,6 +98,31 @@ func deployToolBox(c kubernetes.Interface) { name := getPodName(rookNS, c, opt) err := waitForPodInRunningState(name, rookNS, c, deployTimeout) Expect(err).Should(BeNil()) + waitforToolBoX(name) +} + +// this is a workaround, as we are hitting "unable to get monitor info from DNS SRV with service name: ceph-mon" +func waitforToolBoX(name string) { + cmd := []string{"logs", "-nrook-ceph", name} + for i := 0; i < 20; i++ { + resp, err := framework.RunKubectl(cmd...) + if err != nil { + e2elog.Logf("failed to get logs %v", err) + continue + } + + if !strings.Contains(resp, "=") { + e2elog.Logf("malformed monitor configuration %+v", resp) + time.Sleep(10 * time.Second) + continue + } + + if strings.TrimRight(resp[strings.LastIndex(resp, "=")+1:], "\n") != "" { + break + } + e2elog.Logf("monitor list is empty in ceph.conf %v", resp) + time.Sleep(10 * time.Second) + } } func deployRook() { diff --git a/e2e/rbd.go b/e2e/rbd.go index 270c7a11c..3b6dba942 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -63,7 +63,6 @@ var _ = Describe("RBD", func() { BeforeEach(func() { updaterbdDirPath(f.ClientSet) createRBDPool() - waitTillMonsAreUp(f) createConfigMap(rbdDirPath, f.ClientSet, f) deployRBDPlugin() createRBDStorageClass(f.ClientSet, f) diff --git a/e2e/utils.go b/e2e/utils.go index 64d04e672..160eaad82 100644 --- a/e2e/utils.go +++ b/e2e/utils.go @@ -193,21 +193,6 @@ func getStorageClass(path string) scv1.StorageClass { // return sc // } -// this is a workaround, as we are hitting "unable to get monitor info from DNS SRV with service name: ceph-mon" -func waitTillMonsAreUp(f *framework.Framework) { - opt := metav1.ListOptions{ - LabelSelector: "app=rook-ceph-tools", - } - for i := 0; i < 10; i++ { - _, err := execCommandInPod(f, "ceph fsid", rookNS, &opt) - if err != "" { - time.Sleep(10 * time.Second) - continue - } - break - } -} - func createCephfsStorageClass(c kubernetes.Interface, f *framework.Framework, enablePool bool) { scPath := fmt.Sprintf("%s/%s", cephfsExamplePath, "storageclass.yaml") sc := getStorageClass(scPath)