Skip to content

Commit

Permalink
Merge pull request #20086 from bparees/mysql
Browse files Browse the repository at this point in the history
re-enable slave restart test
  • Loading branch information
openshift-merge-robot authored Jun 23, 2018
2 parents d1dc615 + e8f63fe commit d5a5312
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 4 additions & 5 deletions test/extended/image_ecosystem/mysql_replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
testutil "github.com/openshift/origin/test/util"

kapiv1 "k8s.io/api/core/v1"
//metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kcoreclient "k8s.io/client-go/kubernetes/typed/core/v1"
e2e "k8s.io/kubernetes/test/e2e/framework"
)
Expand Down Expand Up @@ -102,7 +102,7 @@ func replicationTestFactory(oc *exutil.CLI, tc testCase, cleanup func()) func()

g.By("creating replication helpers")
master, slaves, helper := CreateMySQLReplicationHelpers(oc.KubeClient().CoreV1().Pods(oc.Namespace()), masterDeployment, slaveDeployment, fmt.Sprintf("%s-1", helperName), slaveCount)
o.Expect(exutil.WaitUntilAllHelpersAreUp(oc, []exutil.Database{master, helper})).NotTo(o.HaveOccurred())
o.Expect(exutil.WaitUntilAllHelpersAreUp(oc, []exutil.Database{master})).NotTo(o.HaveOccurred())
o.Expect(exutil.WaitUntilAllHelpersAreUp(oc, slaves)).NotTo(o.HaveOccurred())

// Test if we can query as root
Expand Down Expand Up @@ -161,9 +161,8 @@ func replicationTestFactory(oc *exutil.CLI, tc testCase, cleanup func()) func()
}
o.Expect(err).NotTo(o.HaveOccurred())
assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)
/*_, slaves, _ := assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)
_, slaves, _ := assertReplicationIsWorking("mysql-master-2", "mysql-slave-1", 1)

// NOTE: slave restart with PVs does not work since https://github.com/sclorg/mysql-container/pull/215/
g.By("after slave is restarted by deleting the pod")
err = oc.Run("delete").Args("pod", "-l", "deployment=mysql-slave-1").Execute()
o.Expect(err).NotTo(o.HaveOccurred())
Expand All @@ -177,7 +176,7 @@ func replicationTestFactory(oc *exutil.CLI, tc testCase, cleanup func()) func()

pods, err := oc.KubeClient().CoreV1().Pods(oc.Namespace()).List(metav1.ListOptions{LabelSelector: exutil.ParseLabelsOrDie("deployment=mysql-slave-1").String()})
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(len(pods.Items)).To(o.Equal(1))*/
o.Expect(len(pods.Items)).To(o.Equal(1))

// NOTE: Commented out, current template does not support multiple replicas.
/*
Expand Down
7 changes: 6 additions & 1 deletion test/extended/util/db/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ func (m MySQL) IsReady(oc *util.CLI) (bool, error) {
if err != nil {
return false, err
}
masterConf, err := getPodConfig(oc.KubeClient().CoreV1().Pods(oc.Namespace()), m.masterPodName)
if err != nil {
return false, err
}

out, err := oc.Run("exec").Args(m.podName, "-c", conf.Container, "--", "bash", "-c",
"mysqladmin -h localhost -uroot ping").Output()
fmt.Sprintf("mysqladmin -h localhost -u%s -p%s ping", masterConf.Env["MYSQL_USER"], masterConf.Env["MYSQL_PASSWORD"])).Output()
if err != nil {
switch err.(type) {
case *util.ExitError, *exec.ExitError:
Expand Down

0 comments on commit d5a5312

Please sign in to comment.