Skip to content

Commit e9c6020

Browse files
author
OpenShift Bot
authored
Merge pull request #12921 from smarterclayton/log_differently
Merged by openshift-bot
2 parents 580424b + 66bdebb commit e9c6020

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

test/extended/router/scoped.go

+12-6
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ var _ = g.Describe("[networking][router] openshift routers", func() {
3333
err = oc.Run("create").Args("-f", configPath).Execute()
3434
o.Expect(err).NotTo(o.HaveOccurred())
3535
})
36-
g.AfterEach(func() {
37-
if g.CurrentGinkgoTestDescription().Failed {
38-
log, _ := e2e.GetPodLogs(oc.AdminKubeClient(), oc.KubeFramework().Namespace.Name, "scoped-router", "router")
39-
e2e.Logf("Router logs:\n %s", log)
40-
}
41-
})
4236

4337
g.Describe("The HAProxy router", func() {
4438
g.It("should serve the correct routes when scoped to a single namespace and label set", func() {
39+
defer func() {
40+
if g.CurrentGinkgoTestDescription().Failed {
41+
log, _ := e2e.GetPodLogs(oc.AdminKubeClient(), oc.KubeFramework().Namespace.Name, "scoped-router", "router")
42+
e2e.Logf("Router logs:\n %s", log)
43+
}
44+
}()
4545
oc.SetOutputDir(exutil.TestContext.OutputDir)
4646
ns := oc.KubeFramework().Namespace.Name
4747
execPodName := exutil.CreateExecPodOrFail(oc.AdminKubeClient().Core(), ns, "execpod")
@@ -83,6 +83,12 @@ var _ = g.Describe("[networking][router] openshift routers", func() {
8383
})
8484

8585
g.It("should override the route host with a custom value", func() {
86+
defer func() {
87+
if g.CurrentGinkgoTestDescription().Failed {
88+
log, _ := e2e.GetPodLogs(oc.AdminKubeClient(), oc.KubeFramework().Namespace.Name, "scoped-router", "router")
89+
e2e.Logf("Router logs:\n %s", log)
90+
}
91+
}()
8692
oc.SetOutputDir(exutil.TestContext.OutputDir)
8793
ns := oc.KubeFramework().Namespace.Name
8894
execPodName := exutil.CreateExecPodOrFail(oc.AdminKubeClient().Core(), ns, "execpod")

test/extended/router/weighted.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ var _ = g.Describe("[networking][router] weighted openshift router", func() {
3232
err = oc.Run("create").Args("-f", configPath).Execute()
3333
o.Expect(err).NotTo(o.HaveOccurred())
3434
})
35-
g.AfterEach(func() {
36-
if g.CurrentGinkgoTestDescription().Failed {
37-
log, _ := e2e.GetPodLogs(oc.AdminKubeClient(), oc.KubeFramework().Namespace.Name, "weighted-router", "router")
38-
e2e.Logf("Router logs:\n %s", log)
39-
}
40-
})
4135

4236
g.Describe("The HAProxy router", func() {
4337
g.It("should appropriately serve a route that points to two services", func() {
38+
defer func() {
39+
if g.CurrentGinkgoTestDescription().Failed {
40+
log, _ := e2e.GetPodLogs(oc.AdminKubeClient(), oc.KubeFramework().Namespace.Name, "weighted-router", "router")
41+
e2e.Logf("Router logs:\n %s", log)
42+
}
43+
}()
4444
oc.SetOutputDir(exutil.TestContext.OutputDir)
4545
ns := oc.KubeFramework().Namespace.Name
4646
execPodName := exutil.CreateExecPodOrFail(oc.AdminKubeClient().Core(), ns, "execpod")

0 commit comments

Comments
 (0)