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
60 changes: 39 additions & 21 deletions internal/gatewayapi/conformance/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,31 @@
)

// SkipTests is a list of tests that are skipped in the conformance suite.
var SkipTests = []suite.ConformanceTest{
tests.GatewayStaticAddresses,
tests.GatewayInfrastructure,
func SkipTests(gatewayNamespaceMode bool) []suite.ConformanceTest {
if gatewayNamespaceMode {
return []suite.ConformanceTest{
tests.GatewayStaticAddresses,
tests.GatewayInfrastructure, // https://github.com/envoyproxy/gateway/pull/5996 will fix this later.
}
}

Check warning on line 22 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L16-L22

Added lines #L16 - L22 were not covered by tests

return []suite.ConformanceTest{
tests.GatewayStaticAddresses,
tests.GatewayInfrastructure,
}

Check warning on line 27 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L24-L27

Added lines #L24 - L27 were not covered by tests
}

// SkipFeatures is a list of features that are skipped in the conformance report.
var SkipFeatures = sets.New[features.FeatureName](
features.GatewayStaticAddressesFeature.Name,
features.GatewayInfrastructurePropagationFeature.Name,
)
func SkipFeatures(gatewayNamespaceMode bool) sets.Set[features.FeatureName] {
if gatewayNamespaceMode {
return sets.New(features.GatewayStaticAddressesFeature.Name)
}

Check warning on line 34 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L31-L34

Added lines #L31 - L34 were not covered by tests

return sets.New(
features.GatewayStaticAddressesFeature.Name,
features.GatewayInfrastructurePropagationFeature.Name,
)

Check warning on line 39 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L36-L39

Added lines #L36 - L39 were not covered by tests
}

func skipTestsShortNames(skipTests []suite.ConformanceTest) []string {
shortNames := make([]string, len(skipTests))
Expand All @@ -33,30 +48,33 @@
}

// EnvoyGatewaySuite is the conformance suite configuration for the Gateway API.
var EnvoyGatewaySuite = suite.ConformanceOptions{
SupportedFeatures: allFeatures(),
ExemptFeatures: meshFeatures(),
SkipTests: skipTestsShortNames(SkipTests),
func EnvoyGatewaySuite(gatewayNamespaceMode bool) suite.ConformanceOptions {
return suite.ConformanceOptions{
SupportedFeatures: allFeatures(gatewayNamespaceMode),
ExemptFeatures: meshFeatures(),
SkipTests: skipTestsShortNames(SkipTests(gatewayNamespaceMode)),
}

Check warning on line 56 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L51-L56

Added lines #L51 - L56 were not covered by tests
}

func allFeatures() sets.Set[features.FeatureName] {
allFeatures := sets.New[features.FeatureName]()
func allFeatures(gatewayNamespaceMode bool) sets.Set[features.FeatureName] {
result := sets.New[features.FeatureName]()
skipped := SkipFeatures(gatewayNamespaceMode)

Check warning on line 61 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L59-L61

Added lines #L59 - L61 were not covered by tests
for _, feature := range features.AllFeatures.UnsortedList() {
// Dont add skipped features in the conformance report.
if !SkipFeatures.Has(feature.Name) {
allFeatures.Insert(feature.Name)
// Don't add skipped features in the conformance report.
if !skipped.Has(feature.Name) {
result.Insert(feature.Name)

Check warning on line 65 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L63-L65

Added lines #L63 - L65 were not covered by tests
}
}
return allFeatures
return result

Check warning on line 68 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L68

Added line #L68 was not covered by tests
}

func meshFeatures() sets.Set[features.FeatureName] {
meshFeatures := sets.New[features.FeatureName]()
result := sets.New[features.FeatureName]()

Check warning on line 72 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L72

Added line #L72 was not covered by tests
for _, feature := range features.MeshCoreFeatures.UnsortedList() {
meshFeatures.Insert(feature.Name)
result.Insert(feature.Name)

Check warning on line 74 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L74

Added line #L74 was not covered by tests
}
for _, feature := range features.MeshExtendedFeatures.UnsortedList() {
meshFeatures.Insert(feature.Name)
result.Insert(feature.Name)

Check warning on line 77 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L77

Added line #L77 was not covered by tests
}
return meshFeatures
return result

Check warning on line 79 in internal/gatewayapi/conformance/suite.go

View check run for this annotation

Codecov / codecov/patch

internal/gatewayapi/conformance/suite.go#L79

Added line #L79 was not covered by tests
}
4 changes: 0 additions & 4 deletions internal/gatewayapi/status/gatewayclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ func computeGatewayClassAcceptedCondition(gatewayClass *gwapiv1.GatewayClass,
}
}

// GatewaySupportedFeatures is a list of supported Gateway-API features,
// based on the running conformance tests suite.
var GatewaySupportedFeatures = getSupportedFeatures(conformance.EnvoyGatewaySuite, conformance.SkipTests)

func getSupportedFeatures(gatewaySuite suite.ConformanceOptions, skippedTests []suite.ConformanceTest) []gwapiv1.SupportedFeature {
supportedFeatures := gatewaySuite.SupportedFeatures.Clone()
unsupportedFeatures := getUnsupportedFeatures(gatewaySuite, skippedTests)
Expand Down
21 changes: 18 additions & 3 deletions test/conformance/conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,34 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/gateway-api/conformance"
"sigs.k8s.io/gateway-api/conformance/tests"
"sigs.k8s.io/gateway-api/conformance/utils/flags"
"sigs.k8s.io/gateway-api/conformance/utils/suite"
"sigs.k8s.io/gateway-api/conformance/utils/tlog"

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

func TestGatewayAPIConformance(t *testing.T) {
flag.Parse()
log.SetLogger(zap.New(zap.WriteTo(os.Stderr), zap.UseDevMode(true)))

if flags.RunTest != nil && *flags.RunTest != "" {
tlog.Logf(t, "Running Conformance test %s with %s GatewayClass\n cleanup: %t\n debug: %t",
*flags.RunTest, *flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug)
} else {
tlog.Logf(t, "Running Conformance tests with %s GatewayClass\n cleanup: %t\n debug: %t",
*flags.GatewayClassName, *flags.CleanupBaseResources, *flags.ShowDebug)
}

gatewayNamespaceMode := ege2etest.IsGatewayNamespaceMode()
internalSuite := internalconf.EnvoyGatewaySuite(gatewayNamespaceMode)

opts := conformance.DefaultOptions(t)
opts.SkipTests = internalconf.EnvoyGatewaySuite.SkipTests
opts.SupportedFeatures = internalconf.EnvoyGatewaySuite.SupportedFeatures
opts.ExemptFeatures = internalconf.EnvoyGatewaySuite.ExemptFeatures
opts.SkipTests = internalSuite.SkipTests
opts.SupportedFeatures = internalSuite.SupportedFeatures
opts.ExemptFeatures = internalSuite.ExemptFeatures
opts.RunTest = *flags.RunTest

cSuite, err := suite.NewConformanceTestSuite(opts)
if err != nil {
Expand Down
9 changes: 6 additions & 3 deletions test/conformance/experimental_conformance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ func TestExperimentalConformance(t *testing.T) {
flag.Parse()
log.SetLogger(zap.New(zap.WriteTo(os.Stderr), zap.UseDevMode(true)))

internalSuite := internalconf.EnvoyGatewaySuite(false)

opts := conformance.DefaultOptions(t)
opts.SkipTests = internalconf.EnvoyGatewaySuite.SkipTests
opts.SupportedFeatures = internalconf.EnvoyGatewaySuite.SupportedFeatures
opts.ExemptFeatures = internalconf.EnvoyGatewaySuite.ExemptFeatures
opts.SkipTests = internalSuite.SkipTests
opts.SupportedFeatures = internalSuite.SupportedFeatures
opts.ExemptFeatures = internalSuite.ExemptFeatures

opts.ConformanceProfiles = sets.New(
suite.GatewayHTTPConformanceProfileName,
suite.GatewayTLSConformanceProfileName,
Expand Down
6 changes: 6 additions & 0 deletions tools/make/kube.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ BENCHMARK_CONNECTIONS ?= 100
BENCHMARK_DURATION ?= 60
BENCHMARK_REPORT_DIR ?= benchmark_report

CONFORMANCE_RUN_TEST ?=

E2E_RUN_TEST ?=
E2E_CLEANUP ?= true
E2E_TIMEOUT ?= 20m
Expand Down Expand Up @@ -295,7 +297,11 @@ run-conformance: prepare-ip-family ## Run Gateway API conformance.
@$(LOG_TARGET)
kubectl wait --timeout=$(WAIT_TIMEOUT) -n envoy-gateway-system deployment/envoy-gateway --for=condition=Available
kubectl apply -f test/config/gatewayclass.yaml
ifeq ($(CONFORMANCE_RUN_TEST),)
go test -v -tags conformance ./test/conformance --gateway-class=envoy-gateway --debug=true
else
go test -v -tags conformance ./test/conformance --gateway-class=envoy-gateway --debug=true --run-test $(CONFORMANCE_RUN_TEST)
endif

CONFORMANCE_REPORT_PATH ?=

Expand Down