Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions tests/e2e/ambient/ambient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ var _ = Describe("Ambient configuration ", Label("ambient", "slow"), Ordered, fu
SetDefaultEventuallyTimeout(time.Duration(defaultTimeout) * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)

debugInfoLogged := false

Describe("for supported versions", func() {
for _, version := range istioversion.GetLatestPatchVersions() {
// The minimum supported version is 1.24 (and above)
Expand Down Expand Up @@ -118,6 +116,13 @@ profile: ambient`
Success("All ambient components created in reverse order to test order independence")
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
}
})

When("the ambient components are deployed", func() {
// IstioCNI tests
It("deploys the CNI DaemonSet", func(ctx SpecContext) {
Expand Down Expand Up @@ -329,12 +334,7 @@ profile: ambient`
})

AfterAll(func(ctx SpecContext) {
// Log debug info before Cleanup: Cleaner removes CRs created after Record()
// (e.g. Istio), and parent AfterAll hooks run after this AfterAll.
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
debugInfoLogged = true
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
Expand All @@ -343,20 +343,6 @@ profile: ambient`
})
})
}

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

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

Expand Down
60 changes: 28 additions & 32 deletions tests/e2e/ambient/ambient_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
var _ = Describe("Ambient Update & Lifecycle", Label("ambient", "update", "slow"), Ordered, func() {
SetDefaultEventuallyTimeout(time.Duration(defaultTimeout) * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)
debugInfoLogged := false

// Get two consecutive minor versions for update testing
baseVersion, newVersion, err := update.GetTwoConsecutiveAmbientVersions(fipsCluster)
Expand All @@ -59,6 +58,13 @@ var _ = Describe("Ambient Update & Lifecycle", Label("ambient", "update", "slow"
Expect(k.CreateNamespace(ztunnelNamespace)).To(Succeed())
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
}
})

When("all components are created with base version", func() {
BeforeAll(func(ctx SpecContext) {
// Create IstioCNI
Expand Down Expand Up @@ -282,12 +288,9 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
debugInfoLogged = true
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
clr.Cleanup(ctx)
})
Expand Down Expand Up @@ -344,6 +347,12 @@ spec:

Success("Shared dependencies created at base version")
})
// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
}
})

When("Istio CR is created with base version (default revision)", func() {
BeforeAll(func() {
Expand Down Expand Up @@ -527,12 +536,9 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
debugInfoLogged = true
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
clr.Cleanup(ctx)
})
Expand Down Expand Up @@ -585,6 +591,12 @@ spec:

Success("Control plane and IstioCNI created for lifecycle tests")
})
// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
}
})

When("spec.values is updated on ZTunnel", func() {
BeforeAll(func(ctx SpecContext) {
Expand Down Expand Up @@ -685,28 +697,12 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.Ambient, k)
debugInfoLogged = true
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
clr.Cleanup(ctx)
})
})
})

AfterAll(func() {
if CurrentSpecReport().Failed() {
if !debugInfoLogged {
common.LogDebugInfo(common.Ambient, k)
debugInfoLogged = true

if keepOnFailure {
return
}
}
}
})
})
20 changes: 8 additions & 12 deletions tests/e2e/controlplane/control_plane_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import (
var _ = Describe("Control Plane Installation", Label("control-plane", "slow", "sidecar"), Ordered, func() {
SetDefaultEventuallyTimeout(time.Duration(env.GetInt("DEFAULT_TEST_TIMEOUT", 180)) * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)
debugInfoLogged := false

Describe("defaulting", func() {
DescribeTable("IstioCNI",
Expand Down Expand Up @@ -101,6 +100,13 @@ metadata:
Expect(k.CreateNamespace(istioCniNamespace)).To(Succeed(), "IstioCNI namespace failed to be created")
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
}
})

When("the IstioCNI CR is created", func() {
BeforeAll(func() {
common.CreateIstioCNI(k, version.Name)
Expand Down Expand Up @@ -226,11 +232,7 @@ metadata:
})

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

// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
Expand All @@ -240,10 +242,4 @@ metadata:
})
}
})

AfterAll(func() {
if CurrentSpecReport().Failed() && !debugInfoLogged {
common.LogDebugInfo(common.ControlPlane, k)
}
})
})
60 changes: 30 additions & 30 deletions tests/e2e/controlplane/control_plane_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
var _ = Describe("Control Plane updates", Label("control-plane", "update", "slow", "sidecar"), Ordered, func() {
SetDefaultEventuallyTimeout(time.Duration(env.GetInt("DEFAULT_TEST_TIMEOUT", 180)) * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)
debugInfoLogged := false

Describe("using IstioRevisionTag", func() {
var baseVersion, newVersion istioversion.VersionInfo
Expand All @@ -67,6 +66,13 @@ var _ = Describe("Control Plane updates", Label("control-plane", "update", "slow
common.AwaitCondition(ctx, v1.IstioCNIConditionReady, kube.Key(istioCniName), &v1.IstioCNI{}, k, cl)
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
}
})

When(fmt.Sprintf("the Istio CR is created with RevisionBased updateStrategy for base version %s", baseVersion.Name), func() {
BeforeAll(func() {
common.CreateIstio(k, baseVersion.Name, `
Expand Down Expand Up @@ -319,30 +325,14 @@ spec:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
debugInfoLogged = true
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}

clr.Cleanup(ctx)
})
})

AfterAll(func() {
if CurrentSpecReport().Failed() {
if !debugInfoLogged {
common.LogDebugInfo(common.ControlPlane, k)
debugInfoLogged = true

if keepOnFailure {
return
}
}
}
})
})

Describe("In-Place Updates", func() {
Expand All @@ -369,6 +359,13 @@ spec:
common.AwaitCondition(ctx, v1.IstioCNIConditionReady, kube.Key(istioCniName), &v1.IstioCNI{}, k, cl)
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
}
})

When(fmt.Sprintf("Istio CR is created with InPlace updateStrategy for version %s", baseVersion.Name), func() {
BeforeAll(func() {
common.CreateIstio(k, baseVersion.Name, `
Expand Down Expand Up @@ -504,11 +501,9 @@ updateStrategy:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
clr.Cleanup(ctx)
})
Expand Down Expand Up @@ -548,6 +543,13 @@ updateStrategy:
Success("Istio CR created and ready for lifecycle tests")
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
}
})

When("spec.values is updated on Istio CR", func() {
It("should update istiod deployment when values change", func(ctx SpecContext) {
Log("Updating Istio spec.values")
Expand Down Expand Up @@ -636,11 +638,9 @@ updateStrategy:
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
if keepOnFailure {
return
}
// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
clr.Cleanup(ctx)
})
Expand Down
21 changes: 8 additions & 13 deletions tests/e2e/dualstack/dualstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ var _ = Describe("DualStack configuration ", Label("dualstack", "slow", "sidecar
SetDefaultEventuallyTimeout(time.Duration(env.GetInt("DEFAULT_TEST_TIMEOUT", 180)) * time.Second)
SetDefaultEventuallyPollingInterval(time.Second)

debugInfoLogged := false

Describe("for supported versions", func() {
for _, version := range istioversion.GetLatestPatchVersions() {
// The minimum supported version is 1.23 (and above)
Expand All @@ -64,6 +62,13 @@ var _ = Describe("DualStack configuration ", Label("dualstack", "slow", "sidecar
Expect(k.CreateNamespace(istioCniNamespace)).To(Succeed(), "IstioCNI namespace failed to be created")
})

// Capture debug info immediately on test failure
JustAfterEach(func(ctx SpecContext) {
if CurrentSpecReport().Failed() {
common.LogDebugInfo(common.ControlPlane, k)
}
})

When("the IstioCNI CR is created", func() {
BeforeAll(func() {
common.CreateIstioCNI(k, version.Name)
Expand Down Expand Up @@ -222,11 +227,7 @@ values:
})

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

// Skip cleanup if test failed and keepOnFailure is set
if CurrentSpecReport().Failed() && keepOnFailure {
return
}
Expand All @@ -236,12 +237,6 @@ values:
})
}
})

AfterAll(func(ctx SpecContext) {
if CurrentSpecReport().Failed() && !debugInfoLogged {
common.LogDebugInfo(common.DualStack, k)
}
})
})

func HaveContainersThat(matcher types.GomegaMatcher) types.GomegaMatcher {
Expand Down
Loading
Loading