Skip to content

Commit d5a5312

Browse files
Merge pull request #20086 from bparees/mysql
re-enable slave restart test
2 parents d1dc615 + e8f63fe commit d5a5312

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

test/extended/image_ecosystem/mysql_replica.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
testutil "github.com/openshift/origin/test/util"
1414

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

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

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

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

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

182181
// NOTE: Commented out, current template does not support multiple replicas.
183182
/*

test/extended/util/db/mysql.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ func (m MySQL) IsReady(oc *util.CLI) (bool, error) {
3636
if err != nil {
3737
return false, err
3838
}
39+
masterConf, err := getPodConfig(oc.KubeClient().CoreV1().Pods(oc.Namespace()), m.masterPodName)
40+
if err != nil {
41+
return false, err
42+
}
43+
3944
out, err := oc.Run("exec").Args(m.podName, "-c", conf.Container, "--", "bash", "-c",
40-
"mysqladmin -h localhost -uroot ping").Output()
45+
fmt.Sprintf("mysqladmin -h localhost -u%s -p%s ping", masterConf.Env["MYSQL_USER"], masterConf.Env["MYSQL_PASSWORD"])).Output()
4146
if err != nil {
4247
switch err.(type) {
4348
case *util.ExitError, *exec.ExitError:

0 commit comments

Comments
 (0)