Skip to content

[GEP-2162] Updated a new field on supported features inference from boolean to enum and remove from report. #3885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
15 changes: 13 additions & 2 deletions conformance/apis/v1/conformancereport.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ type ConformanceReport struct {
// have been successfully run.
SucceededProvisionalTests []string `json:"succeededProvisionalTests,omitempty"`

// InferredSupportedFeatures indicates whether the supported features were
// SupportedFeaturesSource indicates whether the supported features were
// automatically detected by the conformance suite.
InferredSupportedFeatures bool `json:"inferredSupportedFeatures"`
SupportedFeaturesSource SupportedFeaturesSource `json:"SupportedFeaturesSource"`
}

// SupportedFeaturesSource represents the source from which supported features are derived.
// It is used to distinguish between them being inferred from GWC Status or manually
// supplied for the conformance report.
type SupportedFeaturesSource int

const (
SupportedFeaturesSourceUndefined SupportedFeaturesSource = iota
SupportedFeaturesSourceManual
SupportedFeaturesSourceInferred
)

// Implementation provides metadata information on the downstream
// implementation of Gateway API which ran conformance tests.
type Implementation struct {
Expand Down
2 changes: 2 additions & 0 deletions conformance/utils/suite/conformance.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"strings"
"testing"

"k8s.io/apimachinery/pkg/util/sets"

"sigs.k8s.io/gateway-api/conformance/utils/tlog"
"sigs.k8s.io/gateway-api/pkg/features"
)
Expand Down
26 changes: 17 additions & 9 deletions conformance/utils/suite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type ConformanceTestSuite struct {
// If SupportedFeatures are automatically determined from GWC Status.
// This will be required to report in future iterations as the passing
// will be determined based on this.
isInferredSupportedFeatures bool
supportedFeaturesSource confv1.SupportedFeaturesSource

// mode is the operating mode of the implementation.
// The default value for it is "default".
Expand Down Expand Up @@ -191,7 +191,7 @@ const (
// NewConformanceTestSuite is a helper to use for creating a new ConformanceTestSuite.
func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite, error) {
supportedFeatures := options.SupportedFeatures.Difference(options.ExemptFeatures)
isInferred := false
source := confv1.SupportedFeaturesSourceManual
switch {
case options.EnableAllSupportedFeatures:
supportedFeatures = features.SetsToNamesSet(features.AllFeatures)
Expand All @@ -201,11 +201,13 @@ func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite,
if err != nil {
return nil, fmt.Errorf("Cannot infer supported features: %w", err)
}
isInferred = true
source = confv1.SupportedFeaturesSourceInferred
case isOnlyMeshProfile(&options):
source = confv1.SupportedFeaturesSourceUndefined
}

// If features were not inferred from Status, it's a GWC issue.
if isInferred && supportedFeatures.Len() == 0 {
if source == confv1.SupportedFeaturesSourceInferred && supportedFeatures.Len() == 0 {
return nil, fmt.Errorf("no supported features were determined for test suite")
}

Expand Down Expand Up @@ -273,7 +275,7 @@ func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite,
mode: mode,
apiVersion: apiVersion,
apiChannel: apiChannel,
isInferredSupportedFeatures: isInferred,
supportedFeaturesSource: source,
Hook: options.Hook,
}

Expand All @@ -287,6 +289,7 @@ func NewConformanceTestSuite(options ConformanceOptions) (*ConformanceTestSuite,
for _, f := range conformanceProfile.CoreFeatures.UnsortedList() {
if !options.SupportedFeatures.Has(f) {
suite.SupportedFeatures.Insert(f)
suite.supportedFeaturesSource = confv1.SupportedFeaturesSourceManual
}
}
for _, f := range conformanceProfile.ExtendedFeatures.UnsortedList() {
Expand Down Expand Up @@ -394,8 +397,8 @@ func (suite *ConformanceTestSuite) Setup(t *testing.T, tests []ConformanceTest)
}
}

func (suite *ConformanceTestSuite) IsInferredSupportedFeatures() bool {
return suite.isInferredSupportedFeatures
func (suite *ConformanceTestSuite) SupportedFeaturesSource() confv1.SupportedFeaturesSource {
return suite.supportedFeaturesSource
}

func (suite *ConformanceTestSuite) setClientsetForTest(test ConformanceTest) error {
Expand Down Expand Up @@ -552,7 +555,7 @@ func (suite *ConformanceTestSuite) Report() (*confv1.ConformanceReport, error) {
GatewayAPIChannel: suite.apiChannel,
ProfileReports: profileReports.list(),
SucceededProvisionalTests: succeededProvisionalTests,
InferredSupportedFeatures: suite.IsInferredSupportedFeatures(),
SupportedFeaturesSource: suite.SupportedFeaturesSource(),
}, nil
}

Expand Down Expand Up @@ -610,7 +613,6 @@ func shouldInferSupportedFeatures(opts *ConformanceOptions) bool {
return !opts.EnableAllSupportedFeatures &&
opts.SupportedFeatures.Len() == 0 &&
opts.ExemptFeatures.Len() == 0 &&
opts.ConformanceProfiles.Len() == 0 &&
len(opts.SkipTests) == 0 &&
opts.RunTest == ""
}
Expand Down Expand Up @@ -645,3 +647,9 @@ func getAPIVersionAndChannel(crds []apiextensionsv1.CustomResourceDefinition) (v

return version, channel, nil
}

func isOnlyMeshProfile(_ *ConformanceOptions) bool {
// TODO(bexxmodd): Currently a placeholder to add logic that determines if
// it's only Mesh profile without GWC.
return false
}
36 changes: 20 additions & 16 deletions conformance/utils/suite/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func TestSuiteReport(t *testing.T) {
coreProvisionalTest.ShortName,
extendedProvisionalTest.ShortName,
},
InferredSupportedFeatures: true,
SupportedFeaturesSource: confv1.SupportedFeaturesSourceInferred,
},
},
{
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestSuiteReport(t *testing.T) {
},
},
},
InferredSupportedFeatures: true,
SupportedFeaturesSource: confv1.SupportedFeaturesSourceInferred,
},
},
}
Expand Down Expand Up @@ -434,33 +434,37 @@ func TestInferSupportedFeatures(t *testing.T) {
exemptFeatures FeaturesSet
ConformanceProfile sets.Set[ConformanceProfileName]
expectedFeatures FeaturesSet
expectedIsInferred bool
expectedIsInferred confv1.SupportedFeaturesSource
}{
{
name: "properly infer supported features",
expectedFeatures: namesToFeatureSet(statusFeatureNames),
expectedIsInferred: true,
expectedIsInferred: confv1.SupportedFeaturesSourceInferred,
},
{
name: "no features",
supportedFeatures: sets.New[features.FeatureName]("Gateway"),
expectedFeatures: sets.New[features.FeatureName]("Gateway"),
name: "no features",
supportedFeatures: sets.New[features.FeatureName]("Gateway"),
expectedFeatures: sets.New[features.FeatureName]("Gateway"),
expectedIsInferred: confv1.SupportedFeaturesSourceManual,
},
{
name: "remove exempt features",
supportedFeatures: sets.New[features.FeatureName]("Gateway", "HTTPRoute"),
exemptFeatures: sets.New[features.FeatureName]("HTTPRoute"),
expectedFeatures: sets.New[features.FeatureName]("Gateway"),
name: "remove exempt features",
supportedFeatures: sets.New[features.FeatureName]("Gateway", "HTTPRoute"),
exemptFeatures: sets.New[features.FeatureName]("HTTPRoute"),
expectedFeatures: sets.New[features.FeatureName]("Gateway"),
expectedIsInferred: confv1.SupportedFeaturesSourceManual,
},
{
name: "allow all features",
allowAllFeatures: true,
expectedFeatures: features.SetsToNamesSet(features.AllFeatures),
name: "allow all features",
allowAllFeatures: true,
expectedFeatures: features.SetsToNamesSet(features.AllFeatures),
expectedIsInferred: confv1.SupportedFeaturesSourceManual,
},
{
name: "supports conformance profile - core",
ConformanceProfile: sets.New(GatewayHTTPConformanceProfileName),
expectedFeatures: namesToFeatureSet([]string{"Gateway", "HTTPRoute", "ReferenceGrant"}),
expectedIsInferred: confv1.SupportedFeaturesSourceManual,
},
}

Expand Down Expand Up @@ -512,8 +516,8 @@ func TestInferSupportedFeatures(t *testing.T) {
t.Fatalf("error initializing conformance suite: %v", err)
}

if cSuite.IsInferredSupportedFeatures() != tc.expectedIsInferred {
t.Errorf("InferredSupportedFeatures mismatch: got %v, want %v", cSuite.IsInferredSupportedFeatures(), tc.expectedIsInferred)
if cSuite.SupportedFeaturesSource() != tc.expectedIsInferred {
t.Errorf("InferredSupportedFeatures mismatch: got %v, want %v", cSuite.SupportedFeaturesSource(), tc.expectedIsInferred)
}

if equal := cSuite.SupportedFeatures.Equal(tc.expectedFeatures); !equal {
Expand Down