Skip to content
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

conformance-profile: Remove experimental build tag #2327

Merged
merged 2 commits into from
Aug 28, 2023
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
5 changes: 1 addition & 4 deletions conformance/apis/v1alpha1/conformancereport.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down Expand Up @@ -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"`
}
5 changes: 1 addition & 4 deletions conformance/apis/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions conformance/apis/v1alpha1/profilereport.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down
3 changes: 0 additions & 3 deletions conformance/apis/v1alpha1/result.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down
3 changes: 0 additions & 3 deletions conformance/apis/v1alpha1/statistics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down
7 changes: 2 additions & 5 deletions conformance/experimental_conformance_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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
}
}
Expand Down
5 changes: 1 addition & 4 deletions conformance/utils/flags/experimental_flags.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand All @@ -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")
Expand Down
9 changes: 3 additions & 6 deletions conformance/utils/suite/experimental_profiles.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down Expand Up @@ -70,7 +67,7 @@ var (
SupportReferenceGrant,
SupportHTTPRoute,
),
ExtendedFeatures: HTTPExtendedFeatures,
ExtendedFeatures: HTTPRouteExtendedFeatures,
}

// TLSConformanceProfile is a ConformanceProfile that covers testing TLS
Expand Down Expand Up @@ -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]
Expand All @@ -134,5 +131,5 @@ func getConformanceProfilesForTest(test ConformanceTest, conformanceProfiles set
}
}

return matchingConformanceProfiles, nil
return matchingConformanceProfiles
}
19 changes: 9 additions & 10 deletions conformance/utils/suite/experimental_reports.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand All @@ -21,6 +18,7 @@ package suite

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

confv1a1 "sigs.k8s.io/gateway-api/conformance/apis/v1alpha1"
)

Expand Down Expand Up @@ -66,7 +64,6 @@ func (p profileReportsMap) addTestResults(conformanceProfile ConformanceProfile,
report.Extended = &confv1a1.ExtendedStatus{}
}
report.Extended.Statistics.Passed++

} else {
report.Core.Statistics.Passed++
}
Expand Down Expand Up @@ -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
}
}
Expand Down
14 changes: 4 additions & 10 deletions conformance/utils/suite/experimental_suite.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build experimental
// +build experimental

/*
Copyright 2023 The Kubernetes Authors.

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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")
}
Expand Down