Skip to content

Commit 37bf502

Browse files
Merge pull request #16274 from bparees/postgres
Automatic merge from submit-queue better failure reporting in postgres test (use offset, dump pods)
2 parents d6b9e3c + 809ac3c commit 37bf502

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

test/extended/image_ecosystem/mysql_replica.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func CreateMySQLReplicationHelpers(c kcoreclient.PodInterface, masterDeployment,
7474
}
7575

7676
func cleanup(oc *exutil.CLI) {
77-
exutil.DumpImageStreams(oc)
77+
//exutil.DumpImageStreams(oc)
7878
oc.AsAdmin().Run("delete").Args("all", "--all", "-n", oc.Namespace()).Execute()
79-
exutil.DumpImageStreams(oc)
79+
//exutil.DumpImageStreams(oc)
8080
oc.AsAdmin().Run("delete").Args("pvc", "--all", "-n", oc.Namespace()).Execute()
8181
exutil.CleanupHostPathVolumes(oc.AdminKubeClient().CoreV1().PersistentVolumes(), oc.Namespace())
8282
}

test/extended/image_ecosystem/postgresql_replica.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func PostgreSQLReplicationTestFactory(oc *exutil.CLI, image string) func() {
9898
exutil.DumpApplicationPodLogs("postgresql-master", oc)
9999
exutil.DumpApplicationPodLogs("postgresql-slave", oc)
100100
}
101-
o.Expect(err).NotTo(o.HaveOccurred())
101+
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
102102
}
103103

104104
tableCounter++
@@ -110,7 +110,7 @@ func PostgreSQLReplicationTestFactory(oc *exutil.CLI, image string) func() {
110110
exutil.DumpApplicationPodLogs("postgresql-master", oc)
111111
exutil.DumpApplicationPodLogs("postgresql-helper", oc)
112112
}
113-
o.Expect(err).NotTo(o.HaveOccurred())
113+
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
114114

115115
err = exutil.WaitUntilAllHelpersAreUp(oc, slaves)
116116
check(err)
@@ -153,19 +153,32 @@ func PostgreSQLReplicationTestFactory(oc *exutil.CLI, image string) func() {
153153
err = oc.Run("env").Args("dc", "postgresql-master", "POSTGRESQL_ADMIN_PASSWORD=newpass").Execute()
154154
o.Expect(err).NotTo(o.HaveOccurred())
155155
err = exutil.WaitUntilPodIsGone(oc.KubeClient().CoreV1().Pods(oc.Namespace()), master.PodName(), 1*time.Minute)
156+
if err != nil {
157+
e2e.Logf("Checking if pod %s still exists", master.PodName())
158+
oc.Run("get").Args("pod", master.PodName(), "-o", "yaml")
159+
}
160+
o.Expect(err).NotTo(o.HaveOccurred())
156161
master, _, _ = assertReplicationIsWorking("postgresql-master-2", "postgresql-slave-1", 1)
157162

158163
g.By("after master is restarted by deleting the pod")
159164
err = oc.Run("delete").Args("pod", "-l", "deployment=postgresql-master-2").Execute()
160165
o.Expect(err).NotTo(o.HaveOccurred())
161166
err = exutil.WaitUntilPodIsGone(oc.KubeClient().CoreV1().Pods(oc.Namespace()), master.PodName(), 1*time.Minute)
167+
if err != nil {
168+
e2e.Logf("Checking if pod %s still exists", master.PodName())
169+
oc.Run("get").Args("pod", master.PodName(), "-o", "yaml")
170+
}
162171
o.Expect(err).NotTo(o.HaveOccurred())
163172
_, slaves, _ := assertReplicationIsWorking("postgresql-master-2", "postgresql-slave-1", 1)
164173

165174
g.By("after slave is restarted by deleting the pod")
166175
err = oc.Run("delete").Args("pod", "-l", "deployment=postgresql-slave-1").Execute()
167176
o.Expect(err).NotTo(o.HaveOccurred())
168177
err = exutil.WaitUntilPodIsGone(oc.KubeClient().CoreV1().Pods(oc.Namespace()), slaves[0].PodName(), 1*time.Minute)
178+
if err != nil {
179+
e2e.Logf("Checking if pod %s still exists", slaves[0].PodName())
180+
oc.Run("get").Args("pod", slaves[0].PodName(), "-o", "yaml")
181+
}
169182
o.Expect(err).NotTo(o.HaveOccurred())
170183
assertReplicationIsWorking("postgresql-master-2", "postgresql-slave-1", 1)
171184

@@ -177,6 +190,10 @@ func PostgreSQLReplicationTestFactory(oc *exutil.CLI, image string) func() {
177190
err = oc.Run("scale").Args("dc", "postgresql-slave", "--replicas=0").Execute()
178191
o.Expect(err).NotTo(o.HaveOccurred())
179192
err = exutil.WaitUntilPodIsGone(oc.KubeClient().CoreV1().Pods(oc.Namespace()), pods.Items[0].Name, 1*time.Minute)
193+
if err != nil {
194+
e2e.Logf("Checking if pod %s still exists", pods.Items[0].Name)
195+
oc.Run("get").Args("pod", pods.Items[0].Name, "-o", "yaml")
196+
}
180197
o.Expect(err).NotTo(o.HaveOccurred())
181198
err = oc.Run("scale").Args("dc", "postgresql-slave", "--replicas=4").Execute()
182199
o.Expect(err).NotTo(o.HaveOccurred())

0 commit comments

Comments
 (0)