diff --git a/conformance/apis/v1alpha1/conformancereport.go b/conformance/apis/v1alpha1/conformancereport.go index d3cb97b425..044a107340 100644 --- a/conformance/apis/v1alpha1/conformancereport.go +++ b/conformance/apis/v1alpha1/conformancereport.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -71,7 +68,7 @@ type Implementation struct { // addresses. // Rather than Github usernames or email addresses you can provide a URL to the relevant // support pages for the project. Ideally this would be something like the issue creation page - // on a repository, but for projects without a publicly exposed repository a general support + // on a repository, but for projects without a publicly exposed repository a general support // page URL can be provided. Contact []string `json:"contact"` } diff --git a/conformance/apis/v1alpha1/doc.go b/conformance/apis/v1alpha1/doc.go index d9581574ae..a51862f386 100644 --- a/conformance/apis/v1alpha1/doc.go +++ b/conformance/apis/v1alpha1/doc.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -30,7 +27,7 @@ limitations under the License. // features, then you should not use them. If you would like to opt into these // unreleased features use Go build tags to enable them, e.g.: // -// $ GOFLAGS='-tags=experimental' go test ./conformance/... -args ${CONFORMANCE_ARGS} +// $ go test ./conformance/... -args ${CONFORMANCE_ARGS} // // Please note that everything here is considered experimental and subject to // change. Expect breaking changes and/or complete removals if you start using diff --git a/conformance/apis/v1alpha1/profilereport.go b/conformance/apis/v1alpha1/profilereport.go index f321435eac..865a9d4aba 100644 --- a/conformance/apis/v1alpha1/profilereport.go +++ b/conformance/apis/v1alpha1/profilereport.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. diff --git a/conformance/apis/v1alpha1/result.go b/conformance/apis/v1alpha1/result.go index 8f47272af9..ec7ed44445 100644 --- a/conformance/apis/v1alpha1/result.go +++ b/conformance/apis/v1alpha1/result.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. diff --git a/conformance/apis/v1alpha1/statistics.go b/conformance/apis/v1alpha1/statistics.go index e64451a674..cc20d3a5e0 100644 --- a/conformance/apis/v1alpha1/statistics.go +++ b/conformance/apis/v1alpha1/statistics.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. diff --git a/conformance/experimental_conformance_test.go b/conformance/experimental_conformance_test.go index cabf8d7784..12b6ea826a 100644 --- a/conformance/experimental_conformance_test.go +++ b/conformance/experimental_conformance_test.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -84,7 +81,7 @@ func TestExperimentalConformance(t *testing.T) { implementation, err = suite.ParseImplementation( *flags.ImplementationOrganization, *flags.ImplementationProject, - *flags.ImplementationUrl, + *flags.ImplementationURL, *flags.ImplementationVersion, *flags.ImplementationContact, ) @@ -143,7 +140,7 @@ func writeReport(logf func(string, ...any), report confv1a1.ConformanceReport, o } if output != "" { - if err = os.WriteFile(output, rawReport, 0644); err != nil { + if err = os.WriteFile(output, rawReport, 0o600); err != nil { return err } } diff --git a/conformance/utils/flags/experimental_flags.go b/conformance/utils/flags/experimental_flags.go index a53350ddf2..3ab6f15de8 100644 --- a/conformance/utils/flags/experimental_flags.go +++ b/conformance/utils/flags/experimental_flags.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -27,7 +24,7 @@ import "flag" var ( ImplementationOrganization = flag.String("organization", "", "Implementation's Organization to issue conformance to") ImplementationProject = flag.String("project", "", "Implementation's project to issue conformance to") - ImplementationUrl = flag.String("url", "", "Implementation's url to issue conformance to") + ImplementationURL = flag.String("url", "", "Implementation's url to issue conformance to") ImplementationVersion = flag.String("version", "", "Implementation's version to issue conformance to") ImplementationContact = flag.String("contact", "", "Comma-separated list of contact information for the maintainers") ConformanceProfiles = flag.String("conformance-profiles", "", "Comma-separated list of the conformance profiles to run") diff --git a/conformance/utils/suite/experimental_profiles.go b/conformance/utils/suite/experimental_profiles.go index 1efd054dc6..0f3de7668f 100644 --- a/conformance/utils/suite/experimental_profiles.go +++ b/conformance/utils/suite/experimental_profiles.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -70,7 +67,7 @@ var ( SupportReferenceGrant, SupportHTTPRoute, ), - ExtendedFeatures: HTTPExtendedFeatures, + ExtendedFeatures: HTTPRouteExtendedFeatures, } // TLSConformanceProfile is a ConformanceProfile that covers testing TLS @@ -118,7 +115,7 @@ func getConformanceProfileForName(name ConformanceProfileName) (ConformanceProfi } // getConformanceProfilesForTest retrieves the ConformanceProfiles a test belongs to. -func getConformanceProfilesForTest(test ConformanceTest, conformanceProfiles sets.Set[ConformanceProfileName]) (sets.Set[*ConformanceProfile], error) { +func getConformanceProfilesForTest(test ConformanceTest, conformanceProfiles sets.Set[ConformanceProfileName]) sets.Set[*ConformanceProfile] { matchingConformanceProfiles := sets.New[*ConformanceProfile]() for _, conformanceProfileName := range conformanceProfiles.UnsortedList() { cp := conformanceProfileMap[conformanceProfileName] @@ -134,5 +131,5 @@ func getConformanceProfilesForTest(test ConformanceTest, conformanceProfiles set } } - return matchingConformanceProfiles, nil + return matchingConformanceProfiles } diff --git a/conformance/utils/suite/experimental_reports.go b/conformance/utils/suite/experimental_reports.go index f5efba1dca..516bdaec68 100644 --- a/conformance/utils/suite/experimental_reports.go +++ b/conformance/utils/suite/experimental_reports.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -21,6 +18,7 @@ package suite import ( "k8s.io/apimachinery/pkg/util/sets" + confv1a1 "sigs.k8s.io/gateway-api/conformance/apis/v1alpha1" ) @@ -66,7 +64,6 @@ func (p profileReportsMap) addTestResults(conformanceProfile ConformanceProfile, report.Extended = &confv1a1.ExtendedStatus{} } report.Extended.Statistics.Passed++ - } else { report.Core.Statistics.Passed++ } @@ -118,21 +115,23 @@ func (p profileReportsMap) list() (profileReports []confv1a1.ProfileReport) { func (p profileReportsMap) compileResults(supportedFeaturesMap map[ConformanceProfileName]sets.Set[SupportedFeature], unsupportedFeaturesMap map[ConformanceProfileName]sets.Set[SupportedFeature]) { for key, report := range p { // report the overall result for core features - if report.Core.Failed > 0 { + switch { + case report.Core.Failed > 0: report.Core.Result = confv1a1.Failure - } else if report.Core.Skipped > 0 { + case report.Core.Skipped > 0: report.Core.Result = confv1a1.Partial - } else { + default: report.Core.Result = confv1a1.Success } if report.Extended != nil { // report the overall result for extended features - if report.Extended.Failed > 0 { + switch { + case report.Extended.Failed > 0: report.Extended.Result = confv1a1.Failure - } else if report.Extended.Skipped > 0 { + case report.Extended.Skipped > 0: report.Extended.Result = confv1a1.Partial - } else { + default: report.Extended.Result = confv1a1.Success } } diff --git a/conformance/utils/suite/experimental_suite.go b/conformance/utils/suite/experimental_suite.go index 560f65cb9b..ff79c26589 100644 --- a/conformance/utils/suite/experimental_suite.go +++ b/conformance/utils/suite/experimental_suite.go @@ -1,6 +1,3 @@ -//go:build experimental -// +build experimental - /* Copyright 2023 The Kubernetes Authors. @@ -29,6 +26,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/sets" + "sigs.k8s.io/gateway-api/conformance" confv1a1 "sigs.k8s.io/gateway-api/conformance/apis/v1alpha1" "sigs.k8s.io/gateway-api/conformance/utils/config" @@ -196,7 +194,7 @@ func (suite *ExperimentalConformanceTestSuite) Run(t *testing.T, tests []Conform suite.lock.Lock() if suite.running { suite.lock.Unlock() - return fmt.Errorf("can't run the test suite multiple times in parallel: the test suite is already running.") + return fmt.Errorf("can't run the test suite multiple times in parallel: the test suite is already running") } // if the test suite is not currently running, reset reporting and start a @@ -251,11 +249,7 @@ func (suite *ExperimentalConformanceTestSuite) Report() (*confv1a1.ConformanceRe profileReports := newReports() for _, testResult := range suite.results { - conformanceProfiles, err := getConformanceProfilesForTest(testResult.test, suite.conformanceProfiles) - if err != nil { - return nil, err - } - + conformanceProfiles := getConformanceProfilesForTest(testResult.test, suite.conformanceProfiles) for _, profile := range conformanceProfiles.UnsortedList() { profileReports.addTestResults(*profile, testResult) } @@ -290,7 +284,7 @@ func ParseImplementation(org, project, url, version, contact string) (*confv1a1. if version == "" { return nil, errors.New("implementation's version can not be empty") } - contacts := strings.SplitN(contact, ",", -1) + contacts := strings.Split(contact, ",") if len(contacts) == 0 { return nil, errors.New("implementation's contact can not be empty") }