From a41d1b24f282f91be71355f002c823ddc8ef479c Mon Sep 17 00:00:00 2001 From: Kazuhito MATSUDA Date: Thu, 5 Nov 2020 16:57:40 +0900 Subject: [PATCH] Fix tests. Signed-off-by: Kazuhito MATSUDA --- controllers/mysql_clustering_test.go | 4 ++-- e2e/kubectl_moco_test.go | 3 ++- e2e/run_test.go | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/mysql_clustering_test.go b/controllers/mysql_clustering_test.go index 98ca13690..f19e4dce9 100644 --- a/controllers/mysql_clustering_test.go +++ b/controllers/mysql_clustering_test.go @@ -159,7 +159,7 @@ func TestDecideNextOperation(t *testing.T) { ), }, want: &Operation{ - Wait: false, + Wait: true, Operators: []ops.Operator{ops.SetCloneDonorListOp([]int{1}, hostName(0)+":"+strconv.Itoa(moco.MySQLAdminPort)), ops.CloneOp(1, false)}, Phase: moco.PhaseRestoreInstance, Event: &moco.EventRestoringReplicaInstances, @@ -176,7 +176,7 @@ func TestDecideNextOperation(t *testing.T) { ), }, want: &Operation{ - Wait: false, + Wait: true, Operators: []ops.Operator{ops.SetCloneDonorListOp([]int{1}, hostName(0)+":"+strconv.Itoa(moco.MySQLAdminPort)), ops.CloneOp(1, false)}, Phase: moco.PhaseRestoreInstance, Event: &moco.EventRestoringReplicaInstances, diff --git a/e2e/kubectl_moco_test.go b/e2e/kubectl_moco_test.go index f090a8a09..b52146563 100644 --- a/e2e/kubectl_moco_test.go +++ b/e2e/kubectl_moco_test.go @@ -2,6 +2,7 @@ package e2e import ( "fmt" + "strconv" "strings" "github.com/cybozu-go/moco" @@ -27,7 +28,7 @@ func testKubectlMoco() { stdout, stderr, err := execAtLocal("./bin/kubectl-moco", []byte("select count(*) from moco_e2e.replication_test"), "-n", cluster.Namespace, "mysql", "-u", "moco-readonly", "-i", cluster.Name) Expect(err).ShouldNot(HaveOccurred(), "stdout=%s, stderr=%s", stdout, stderr) - Expect(string(stdout)).Should(ContainSubstring("100000")) + Expect(string(stdout)).Should(ContainSubstring(strconv.Itoa(lineCount))) }) It("should fetch credential for root", func() { diff --git a/e2e/run_test.go b/e2e/run_test.go index 10a414738..4190ef1c0 100644 --- a/e2e/run_test.go +++ b/e2e/run_test.go @@ -34,7 +34,6 @@ func kubectl(args ...string) ([]byte, []byte, error) { return execAtLocal("./bin/kubectl", nil, args...) } -//lint:ignore U1000 This func may be used in the future. func kubectlWithInput(input []byte, args ...string) ([]byte, []byte, error) { return execAtLocal("./bin/kubectl", input, args...) }