Skip to content
Merged
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
2 changes: 2 additions & 0 deletions test/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"sigs.k8s.io/gateway-api/conformance/utils/tlog"

internalconf "github.com/envoyproxy/gateway/internal/gatewayapi/conformance"
"github.com/envoyproxy/gateway/test/e2e"
ege2etest "github.com/envoyproxy/gateway/test/e2e/tests"
)

Expand All @@ -44,6 +45,7 @@ func TestGatewayAPIConformance(t *testing.T) {
opts.SupportedFeatures = internalSuite.SupportedFeatures
opts.ExemptFeatures = internalSuite.ExemptFeatures
opts.RunTest = *flags.RunTest
opts.Hook = e2e.Hook

cSuite, err := suite.NewConformanceTestSuite(opts)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions test/conformance/experimental_conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sigs.k8s.io/yaml"

internalconf "github.com/envoyproxy/gateway/internal/gatewayapi/conformance"
"github.com/envoyproxy/gateway/test/e2e"
)

func TestExperimentalConformance(t *testing.T) {
Expand All @@ -42,6 +43,7 @@ func TestExperimentalConformance(t *testing.T) {
suite.GatewayTLSConformanceProfileName,
suite.GatewayGRPCConformanceProfileName,
)
opts.Hook = e2e.Hook

t.Logf("Running experimental conformance tests with %s GatewayClass\n cleanup: %t\n debug: %t\n enable all features: %t \n conformance profiles: [%v]",
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug, *flags.EnableAllSupportedFeatures, opts.ConformanceProfiles)
Expand Down
1 change: 1 addition & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func TestE2E(t *testing.T) {
SupportedFeatures: sets.New(features.SupportGateway),
SkipTests: skipTests,
AllowCRDsMismatch: *flags.AllowCRDsMismatch,
Hook: Hook,
})
if err != nil {
t.Fatalf("Failed to create ConformanceTestSuite: %v", err)
Expand Down
22 changes: 22 additions & 0 deletions test/e2e/hook.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright Envoy Gateway Authors
// SPDX-License-Identifier: Apache-2.0
// The full text of the Apache license is available in the LICENSE file at
// the root of the repo.

package e2e

import (
"testing"

"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/conformance/utils/tlog"

"github.com/envoyproxy/gateway/test/e2e/tests"
)

var Hook = func(t *testing.T, test suite.ConformanceTest, suite *suite.ConformanceTestSuite) {
if t.Failed() {
tlog.Logf(t, "Test %s failed, collecting and dumping resources", test.ShortName)
tests.CollectAndDump(t, suite.RestConfig)
}
}
2 changes: 2 additions & 0 deletions test/e2e/multiple_gc/multiple_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestMultipleGC(t *testing.T) {
// All e2e tests should leave Features empty.
SupportedFeatures: sets.New[features.FeatureName](features.SupportGateway),
SkipTests: []string{},
Hook: e2e.Hook,
})
if err != nil {
t.Fatalf("Failed to create ConformanceTestSuite: %v", err)
Expand Down Expand Up @@ -83,6 +84,7 @@ func TestMultipleGC(t *testing.T) {
// All e2e tests should leave Features empty.
SupportedFeatures: sets.New[features.FeatureName](features.SupportGateway),
SkipTests: []string{},
Hook: e2e.Hook,
})
if err != nil {
t.Fatalf("Failed to create ConformanceTestSuite: %v", err)
Expand Down
5 changes: 0 additions & 5 deletions test/e2e/tests/eg_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ var EGUpgradeTest = suite.ConformanceTest{
t.Errorf("failed to get expected response for the first three requests: %v", err)
}
})
t.Cleanup(func() {
if t.Failed() {
CollectAndDump(t, suite.RestConfig)
}
})
},
}

Expand Down
6 changes: 0 additions & 6 deletions test/e2e/tests/envoyproxy_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ var EnvoyProxyDaemonSetTest = suite.ConformanceTest{
Manifests: []string{"testdata/envoyproxy-daemonset.yaml"},
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
t.Run("RunAndDelete", func(t *testing.T) {
t.Cleanup(func() {
if t.Failed() {
CollectAndDump(t, suite.RestConfig)
}
})

ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "daemonset-route", Namespace: ns}
gwNN := types.NamespacedName{Name: "eg-ds", Namespace: ns}
Expand Down
10 changes: 0 additions & 10 deletions test/e2e/tests/httproute_with_dynamic_resolver_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ var DynamicResolverBackendTest = suite.ConformanceTest{

http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse)
})
t.Cleanup(func() {
if t.Failed() {
CollectAndDump(t, suite.RestConfig)
}
})
},
}

Expand Down Expand Up @@ -142,10 +137,5 @@ var DynamicResolverBackendWithTLSTest = suite.ConformanceTest{
}
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, expectedResponse)
})
t.Cleanup(func() {
if t.Failed() {
CollectAndDump(t, suite.RestConfig)
}
})
},
}
1 change: 1 addition & 0 deletions test/e2e/upgrade/eg_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func TestEGUpgrade(t *testing.T) {
BaseManifests: "upgrade/manifests.yaml",
SupportedFeatures: sets.New(features.SupportGateway),
SkipTests: skipTests,
Hook: e2e.Hook,
})
if err != nil {
t.Fatalf("Failed to create test suite: %v", err)
Expand Down
Loading