diff --git a/conformance/utils/suite/suite.go b/conformance/utils/suite/suite.go index 5b30598886..d8ccfe0e8c 100644 --- a/conformance/utils/suite/suite.go +++ b/conformance/utils/suite/suite.go @@ -519,6 +519,12 @@ func (suite *ConformanceTestSuite) Report() (*confv1.ConformanceReport, error) { } defer suite.lock.RUnlock() + if suite.supportedFeaturesSource == supportedFeaturesSourceManual && + !hasMeshFeatures(suite.SupportedFeatures) && + !suite.conformanceProfiles.HasAny(MeshHTTPConformanceProfileName, MeshGRPCConformanceProfileName) { + return nil, fmt.Errorf("can't generate report: Gateway's supported features should be read from Status and not supplied through flags") + } + testNames := make([]string, 0, len(suite.results)) for tN := range suite.results { testNames = append(testNames, tN) diff --git a/conformance/utils/suite/suite_test.go b/conformance/utils/suite/suite_test.go index 311da616a2..cadaaa6510 100644 --- a/conformance/utils/suite/suite_test.go +++ b/conformance/utils/suite/suite_test.go @@ -412,6 +412,46 @@ func TestSuiteReport(t *testing.T) { } } +func TestSuiteReportBlocksManualSource(t *testing.T) { + testCases := []struct { + name string + supportedFeatures FeaturesSet + profiles sets.Set[ConformanceProfileName] + wantErr bool + }{ + { + name: "should block with no mesh features", + supportedFeatures: namesToFeatureSet(statusFeatureNames), + profiles: sets.New(testProfileName), + wantErr: true, + }, + { + name: "should not block with mesh features", + supportedFeatures: sets.New(features.SupportMeshClusterIPMatching, features.SupportMeshConsumerRoute), + }, + { + name: "should not block with mesh profile", + supportedFeatures: namesToFeatureSet(statusFeatureNames), + profiles: sets.New(MeshHTTPConformanceProfileName), + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + conformanceProfileMap[testProfileName] = testProfile + + suite := ConformanceTestSuite{ + supportedFeaturesSource: supportedFeaturesSourceManual, + conformanceProfiles: tc.profiles, + SupportedFeatures: tc.supportedFeatures, + } + _, err := suite.Report() + if tc.wantErr && err == nil { + t.Errorf("Expected an error but got nil") + } + }) + } +} + var statusFeatureNames = []string{ "Gateway", "GatewayPort8080",