Skip to content

Commit

Permalink
Add debug info to multicluster e2e tests (#417)
Browse files Browse the repository at this point in the history
In case multicluster e2e test fails, we should be debug information
regarding the failure.

Signed-off-by: Maxim Babushkin <mbabushk@redhat.com>
  • Loading branch information
MaxBab authored Oct 14, 2024
1 parent 55817bc commit e1c447d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/e2e/multicluster/multicluster_multiprimary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
var _ = Describe("Multicluster deployment models", Ordered, func() {
SetDefaultEventuallyTimeout(180 * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)
debugInfoLogged := false

BeforeAll(func(ctx SpecContext) {
if !skipDeploy {
Expand Down Expand Up @@ -251,6 +252,11 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo()
debugInfoLogged = true
}

// Delete namespaces to ensure clean up for new tests iteration
Expect(k1.DeleteNamespaceNoWait(controlPlaneNamespace)).To(Succeed(), "Namespace failed to be deleted on Cluster #1")
Expect(k2.DeleteNamespaceNoWait(controlPlaneNamespace)).To(Succeed(), "Namespace failed to be deleted on Cluster #2")
Expand All @@ -270,6 +276,11 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() && !debugInfoLogged {
common.LogDebugInfo()
debugInfoLogged = true
}

// Delete the Sail Operator from both clusters
Expect(k1.DeleteNamespaceNoWait(namespace)).To(Succeed(), "Namespace failed to be deleted on Cluster #1")
Expect(k2.DeleteNamespaceNoWait(namespace)).To(Succeed(), "Namespace failed to be deleted on Cluster #2")
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e/multicluster/multicluster_primaryremote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
var _ = Describe("Multicluster deployment models", Ordered, func() {
SetDefaultEventuallyTimeout(180 * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)
debugInfoLogged := false

BeforeAll(func(ctx SpecContext) {
if !skipDeploy {
Expand Down Expand Up @@ -293,6 +294,11 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo()
debugInfoLogged = true
}

// Delete namespaces to ensure clean up for new tests iteration
Expect(k1.DeleteNamespaceNoWait(controlPlaneNamespace)).To(Succeed(), "Namespace failed to be deleted on Primary Cluster")
Expect(k2.DeleteNamespaceNoWait(controlPlaneNamespace)).To(Succeed(), "Namespace failed to be deleted on Remote Cluster")
Expand All @@ -312,6 +318,11 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() && !debugInfoLogged {
common.LogDebugInfo()
debugInfoLogged = true
}

// Delete the Sail Operator from both clusters
Expect(k1.DeleteNamespaceNoWait(namespace)).To(Succeed(), "Namespace failed to be deleted on Primary Cluster")
Expect(k2.DeleteNamespaceNoWait(namespace)).To(Succeed(), "Namespace failed to be deleted on Remote Cluster")
Expand Down

0 comments on commit e1c447d

Please sign in to comment.