Skip to content

Commit 9fb8dc6

Browse files
authored
Merge pull request #2801 from mlavacca/conformance-report-mode
feat: mode introduced to conformance report API
2 parents d02abe6 + 7f8bd41 commit 9fb8dc6

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

conformance/apis/v1alpha1/conformancereport.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ type ConformanceReport struct {
3434
// test report was made for.
3535
GatewayAPIVersion string `json:"gatewayAPIVersion"`
3636

37+
// Mode is the operating mode the implementation used to run conformance tests.
38+
Mode string `json:"mode"`
39+
3740
// ProfileReports is a list of the individual reports for each conformance
3841
// profile that was enabled for a test run.
3942
ProfileReports []ProfileReport `json:"profiles"`

conformance/experimental_conformance_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545
namespaceLabels map[string]string
4646
namespaceAnnotations map[string]string
4747
implementation *confv1a1.Implementation
48+
mode string
4849
conformanceProfiles sets.Set[suite.ConformanceProfileName]
4950
skipTests []string
5051
)
@@ -77,6 +78,7 @@ func TestExperimentalConformance(t *testing.T) {
7778

7879
// experimental conformance flags
7980
conformanceProfiles = suite.ParseConformanceProfiles(*flags.ConformanceProfiles)
81+
mode = *flags.Mode
8082

8183
if conformanceProfiles.Len() > 0 {
8284
// if some conformance profiles have been set, run the experimental conformance suite...
@@ -119,6 +121,7 @@ func testExperimentalConformance(t *testing.T) {
119121
NamespaceAnnotations: namespaceAnnotations,
120122
SkipTests: skipTests,
121123
},
124+
Mode: mode,
122125
Implementation: *implementation,
123126
ConformanceProfiles: conformanceProfiles,
124127
})

conformance/utils/flags/experimental_flags.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ limitations under the License.
1919
// among the various suites that are all run by the same Makefile invocation.
2020
package flags
2121

22-
import "flag"
22+
import (
23+
"flag"
24+
)
25+
26+
const (
27+
// DefaultMode is the operating mode to default to in case no mode is specified.
28+
DefaultMode = "default"
29+
)
2330

2431
var (
2532
ImplementationOrganization = flag.String("organization", "", "Implementation's Organization to issue conformance to")
2633
ImplementationProject = flag.String("project", "", "Implementation's project to issue conformance to")
2734
ImplementationURL = flag.String("url", "", "Implementation's url to issue conformance to")
2835
ImplementationVersion = flag.String("version", "", "Implementation's version to issue conformance to")
2936
ImplementationContact = flag.String("contact", "", "Comma-separated list of contact information for the maintainers")
37+
Mode = flag.String("mode", DefaultMode, "The operating mode of the implementation.")
3038
ConformanceProfiles = flag.String("conformance-profiles", "", "Comma-separated list of the conformance profiles to run")
3139
ReportOutput = flag.String("report-output", "", "The file where to write the conformance report")
3240
)

conformance/utils/suite/experimental_suite.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"sigs.k8s.io/gateway-api/conformance"
3232
confv1a1 "sigs.k8s.io/gateway-api/conformance/apis/v1alpha1"
3333
"sigs.k8s.io/gateway-api/conformance/utils/config"
34+
"sigs.k8s.io/gateway-api/conformance/utils/flags"
3435
"sigs.k8s.io/gateway-api/conformance/utils/kubernetes"
3536
"sigs.k8s.io/gateway-api/conformance/utils/roundtripper"
3637
)
@@ -47,6 +48,10 @@ import (
4748
type ExperimentalConformanceTestSuite struct {
4849
ConformanceTestSuite
4950

51+
// mode is the operating mode of the implementation.
52+
// The default value for it is "default".
53+
mode string
54+
5055
// implementation contains the details of the implementation, such as
5156
// organization, project, etc.
5257
implementation confv1a1.Implementation
@@ -78,6 +83,7 @@ type ExperimentalConformanceTestSuite struct {
7883
type ExperimentalConformanceOptions struct {
7984
Options
8085

86+
Mode string
8187
Implementation confv1a1.Implementation
8288
ConformanceProfiles sets.Set[ConformanceProfileName]
8389
}
@@ -91,12 +97,18 @@ func NewExperimentalConformanceTestSuite(s ExperimentalConformanceOptions) (*Exp
9197
roundTripper = &roundtripper.DefaultRoundTripper{Debug: s.Debug, TimeoutConfig: s.TimeoutConfig}
9298
}
9399

100+
mode := flags.DefaultMode
101+
if s.Mode != "" {
102+
mode = s.Mode
103+
}
104+
94105
suite := &ExperimentalConformanceTestSuite{
95106
results: make(map[string]testResult),
96107
extendedUnsupportedFeatures: make(map[ConformanceProfileName]sets.Set[SupportedFeature]),
97108
extendedSupportedFeatures: make(map[ConformanceProfileName]sets.Set[SupportedFeature]),
98109
conformanceProfiles: s.ConformanceProfiles,
99110
implementation: s.Implementation,
111+
mode: mode,
100112
}
101113

102114
// test suite callers are required to provide a conformance profile OR at
@@ -281,6 +293,7 @@ func (suite *ExperimentalConformanceTestSuite) Report() (*confv1a1.ConformanceRe
281293
Kind: "ConformanceReport",
282294
},
283295
Date: time.Now().Format(time.RFC3339),
296+
Mode: suite.mode,
284297
Implementation: suite.implementation,
285298
GatewayAPIVersion: "TODO",
286299
ProfileReports: profileReports.list(),

0 commit comments

Comments
 (0)