mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
e2e: enhance SIGDescribe
framework.SIGDescribe is better because: - Ginkgo uses the source code location of the test, not of the wrapper, when reporting progress. - Additional annotations can be passed. To make this a drop-in replacement, framework.SIGDescribe generates a function that can be used instead of the former SIGDescribe functions. windows.SIGDescribe contained some additional code to ensure that tests are skipped when not running with a suitable node OS. This gets moved into a separate wrapper generator, to allow using framework.SIGDescribe as intended. To ensure that all callers were modified, the windows.sigDescribe isn't exported anymore (wasn't necessary in the first place!).
This commit is contained in:
parent
39b6916cbc
commit
f2d34426f8
@ -45,12 +45,10 @@ import (
|
|||||||
// test/e2e/lifecycle/framework.go
|
// test/e2e/lifecycle/framework.go
|
||||||
package lifecycle
|
package lifecycle
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("cluster-lifecycle")
|
||||||
return ginkgo.Describe("[sig-cluster-lifecycle] "+text, body)
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
```golang
|
```golang
|
||||||
// test/e2e/lifecycle/bootstrap/bootstrap_signer.go
|
// test/e2e/lifecycle/bootstrap/bootstrap_signer.go
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package apimachinery
|
package apimachinery
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("api-machinery")
|
||||||
return ginkgo.Describe("[sig-api-machinery] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package apps
|
package apps
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("apps")
|
||||||
return ginkgo.Describe("[sig-apps] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package architecture
|
package architecture
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("architecture")
|
||||||
return ginkgo.Describe("[sig-architecture] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("auth")
|
||||||
return ginkgo.Describe("[sig-auth] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package autoscaling
|
package autoscaling
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("autoscaling")
|
||||||
return ginkgo.Describe("[sig-autoscaling] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package cloud
|
package cloud
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("cloud-provider")
|
||||||
return ginkgo.Describe("[sig-cloud-provider] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package apps
|
package apps
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("apps")
|
||||||
return ginkgo.Describe("[sig-apps] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package auth
|
package auth
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("auth")
|
||||||
return ginkgo.Describe("[sig-auth] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package gcp
|
package gcp
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("cloud-provider-gcp")
|
||||||
return ginkgo.Describe("[sig-cloud-provider-gcp] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package network
|
package network
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("network")
|
||||||
return ginkgo.Describe("[sig-network] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("node")
|
||||||
return ginkgo.Describe("[sig-node] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package network
|
package network
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("network")
|
||||||
return ginkgo.Describe("[sig-network] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,6 @@ limitations under the License.
|
|||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
var SIGDescribe = framework.SIGDescribe("node")
|
||||||
func SIGDescribe(text string, body func()) bool {
|
|
||||||
return ginkgo.Describe("[sig-node] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("storage")
|
||||||
return ginkgo.Describe("[sig-storage] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
@ -123,6 +124,26 @@ func AnnotatedLocationWithOffset(annotation string, offset int) types.CodeLocati
|
|||||||
return codeLocation
|
return codeLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SIGDescribe returns a wrapper function for ginkgo.Describe which injects
|
||||||
|
// the SIG name as annotation. The parameter should be lowercase with
|
||||||
|
// no spaces and no sig- or SIG- prefix.
|
||||||
|
func SIGDescribe(sig string) func(string, ...interface{}) bool {
|
||||||
|
if !sigRE.MatchString(sig) || strings.HasPrefix(sig, "sig-") {
|
||||||
|
panic(fmt.Sprintf("SIG label must be lowercase, no spaces and no sig- prefix, got instead: %q", sig))
|
||||||
|
}
|
||||||
|
return func(text string, args ...interface{}) bool {
|
||||||
|
args = append(args, ginkgo.Label("sig-"+sig))
|
||||||
|
if text == "" {
|
||||||
|
text = fmt.Sprintf("[sig-%s]", sig)
|
||||||
|
} else {
|
||||||
|
text = fmt.Sprintf("[sig-%s] %s", sig, text)
|
||||||
|
}
|
||||||
|
return registerInSuite(ginkgo.Describe, text, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var sigRE = regexp.MustCompile(`^[a-z]+(-[a-z]+)*$`)
|
||||||
|
|
||||||
// ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.
|
// ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.
|
||||||
func ConformanceIt(text string, args ...interface{}) bool {
|
func ConformanceIt(text string, args ...interface{}) bool {
|
||||||
args = append(args, ginkgo.Offset(1), WithConformance())
|
args = append(args, ginkgo.Offset(1), WithConformance())
|
||||||
|
@ -69,7 +69,7 @@ var (
|
|||||||
func Describe() {
|
func Describe() {
|
||||||
// Normally a single line would be better, but this is an extreme example and
|
// Normally a single line would be better, but this is an extreme example and
|
||||||
// thus uses multiple.
|
// thus uses multiple.
|
||||||
framework.Describe("abc",
|
framework.SIGDescribe("testing")("abc",
|
||||||
// Bugs in parameters will be attributed to the Describe call, not the line of the parameter.
|
// Bugs in parameters will be attributed to the Describe call, not the line of the parameter.
|
||||||
"", // buggy: not needed
|
"", // buggy: not needed
|
||||||
" space1", // buggy: leading white space
|
" space1", // buggy: leading white space
|
||||||
@ -123,8 +123,8 @@ ERROR: some/relative/path/buggy.go:200: with spaces
|
|||||||
`
|
`
|
||||||
// Used by unittests/list-tests. It's sorted by test name, not source code location.
|
// Used by unittests/list-tests. It's sorted by test name, not source code location.
|
||||||
ListTestsOutput = `The following spec names can be used with 'ginkgo run --focus/skip':
|
ListTestsOutput = `The following spec names can be used with 'ginkgo run --focus/skip':
|
||||||
../bugs/bugs.go:103: abc space1 space2 [Feature: no-such-feature] [Feature: feature-foo] [Environment: no-such-env] [Environment: Linux] [no-such-node-env] [node-feature-foo] [FeatureGate: no-such-feature-gate] [FeatureGate: TestAlphaFeature] [Alpha] [FeatureGate: TestBetaFeature] [Beta] [FeatureGate: TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz x [foo] should [bar]
|
../bugs/bugs.go:103: [sig-testing] abc space1 space2 [Feature: no-such-feature] [Feature: feature-foo] [Environment: no-such-env] [Environment: Linux] [no-such-node-env] [node-feature-foo] [FeatureGate: no-such-feature-gate] [FeatureGate: TestAlphaFeature] [Alpha] [FeatureGate: TestBetaFeature] [Beta] [FeatureGate: TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz x [foo] should [bar]
|
||||||
../bugs/bugs.go:98: abc space1 space2 [Feature: no-such-feature] [Feature: feature-foo] [Environment: no-such-env] [Environment: Linux] [no-such-node-env] [node-feature-foo] [FeatureGate: no-such-feature-gate] [FeatureGate: TestAlphaFeature] [Alpha] [FeatureGate: TestBetaFeature] [Beta] [FeatureGate: TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz y [foo] should [bar]
|
../bugs/bugs.go:98: [sig-testing] abc space1 space2 [Feature: no-such-feature] [Feature: feature-foo] [Environment: no-such-env] [Environment: Linux] [no-such-node-env] [node-feature-foo] [FeatureGate: no-such-feature-gate] [FeatureGate: TestAlphaFeature] [Alpha] [FeatureGate: TestBetaFeature] [Beta] [FeatureGate: TestGAFeature] [Conformance] [NodeConformance] [Slow] [Serial] [Disruptive] [custom-label] xyz y [foo] should [bar]
|
||||||
|
|
||||||
`
|
`
|
||||||
|
|
||||||
@ -150,6 +150,7 @@ ERROR: some/relative/path/buggy.go:200: with spaces
|
|||||||
foo
|
foo
|
||||||
no-such-node-env
|
no-such-node-env
|
||||||
node-feature-foo
|
node-feature-foo
|
||||||
|
sig-testing
|
||||||
|
|
||||||
`
|
`
|
||||||
)
|
)
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("instrumentation")
|
||||||
return ginkgo.Describe("[sig-instrumentation] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package kubectl
|
package kubectl
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("cli")
|
||||||
return ginkgo.Describe("[sig-cli] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package lifecycle
|
package lifecycle
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("cluster-lifecycle")
|
||||||
return ginkgo.Describe("[sig-cluster-lifecycle] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("network")
|
||||||
return ginkgo.Describe("[sig-network] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package node
|
package node
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("node")
|
||||||
return ginkgo.Describe("[sig-node] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -21,8 +21,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
|
||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/sets"
|
"k8s.io/apimachinery/pkg/util/sets"
|
||||||
@ -33,12 +31,10 @@ import (
|
|||||||
var (
|
var (
|
||||||
timeout = 10 * time.Minute
|
timeout = 10 * time.Minute
|
||||||
waitTime = 2 * time.Second
|
waitTime = 2 * time.Second
|
||||||
)
|
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
SIGDescribe = framework.SIGDescribe("scheduling")
|
||||||
return ginkgo.Describe("[sig-scheduling] "+text, body)
|
)
|
||||||
}
|
|
||||||
|
|
||||||
// WaitForStableCluster waits until all existing pods are scheduled and returns their amount.
|
// WaitForStableCluster waits until all existing pods are scheduled and returns their amount.
|
||||||
func WaitForStableCluster(c clientset.Interface, workerNodes sets.Set[string]) int {
|
func WaitForStableCluster(c clientset.Interface, workerNodes sets.Set[string]) int {
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("storage")
|
||||||
return ginkgo.Describe("[sig-storage] "+text, body)
|
|
||||||
}
|
|
||||||
|
@ -35,7 +35,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Cpu Resources [Serial]", func() {
|
var _ = sigDescribe("[Feature:Windows] Cpu Resources [Serial]", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("cpu-resources-test-windows")
|
f := framework.NewDefaultFramework("cpu-resources-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ var _ = SIGDescribe("[Feature:Windows] Cpu Resources [Serial]", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
// newCPUBurnPods creates a list of pods (specification) with a workload that will consume all available CPU resources up to container limit
|
// newCPUBurnPods creates a list of pods (specification) with a workload that will consume all available CPU resources up to container limit
|
||||||
func newCPUBurnPods(numPods int, image imageutils.Config, cpuLimit string, memoryLimit string) []*v1.Pod {
|
func newCPUBurnPods(numPods int, image imageutils.Config, cpuLimit string, memoryLimit string) []*v1.Pod {
|
||||||
|
@ -40,7 +40,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() {
|
var _ = sigDescribe("[Feature:Windows] Density [Serial] [Slow]", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("density-test-windows")
|
f := framework.NewDefaultFramework("density-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
}))
|
||||||
|
|
||||||
type densityTest struct {
|
type densityTest struct {
|
||||||
// number of pods
|
// number of pods
|
||||||
|
@ -39,7 +39,7 @@ const (
|
|||||||
testSlowMultiplier = 60
|
testSlowMultiplier = 60
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:GPUDevicePlugin] Device Plugin", func() {
|
var _ = sigDescribe("[Feature:GPUDevicePlugin] Device Plugin", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("device-plugin")
|
f := framework.NewDefaultFramework("device-plugin")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -132,4 +132,4 @@ var _ = SIGDescribe("[Feature:GPUDevicePlugin] Device Plugin", func() {
|
|||||||
_, envVarDirectxGpuNameErr := e2eoutput.LookForStringInPodExec(defaultNs, windowsPod.Name, envVarCommand, envVarDirectxGpuName, time.Minute)
|
_, envVarDirectxGpuNameErr := e2eoutput.LookForStringInPodExec(defaultNs, windowsPod.Name, envVarCommand, envVarDirectxGpuName, time.Minute)
|
||||||
framework.ExpectNoError(envVarDirectxGpuNameErr, "failed: didn't find expected environment variable.")
|
framework.ExpectNoError(envVarDirectxGpuNameErr, "failed: didn't find expected environment variable.")
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] DNS", func() {
|
var _ = sigDescribe("[Feature:Windows] DNS", skipUnlessWindows(func() {
|
||||||
|
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
||||||
@ -136,4 +136,4 @@ var _ = SIGDescribe("[Feature:Windows] DNS", func() {
|
|||||||
|
|
||||||
// TODO: Add more test cases for other DNSPolicies.
|
// TODO: Add more test cases for other DNSPolicies.
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
@ -17,19 +17,29 @@ limitations under the License.
|
|||||||
package windows
|
package windows
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// sigDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
// Use this together with skipUnlessWindows to define
|
||||||
return ginkgo.Describe("[sig-windows] "+text, func() {
|
// tests that only run if the node OS is Windows:
|
||||||
|
//
|
||||||
|
// sigDescribe("foo", skipUnlessWindows(func() { ... }))
|
||||||
|
var sigDescribe = framework.SIGDescribe("windows")
|
||||||
|
|
||||||
|
// skipUnlessWindows wraps some other Ginkgo callback such that
|
||||||
|
// a BeforeEach runs before tests defined by that callback which
|
||||||
|
// skips those tests unless the node OS is Windows.
|
||||||
|
func skipUnlessWindows(cb func()) func() {
|
||||||
|
return func() {
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
// all tests in this package are Windows specific
|
// all tests in this package are Windows specific
|
||||||
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
||||||
})
|
})
|
||||||
|
|
||||||
body()
|
cb()
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ const (
|
|||||||
gmsaSharedFolder = "write_test"
|
gmsaSharedFolder = "write_test"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] GMSA Full [Serial] [Slow]", func() {
|
var _ = sigDescribe("[Feature:Windows] GMSA Full [Serial] [Slow]", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("gmsa-full-test-windows")
|
f := framework.NewDefaultFramework("gmsa-full-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ var _ = SIGDescribe("[Feature:Windows] GMSA Full [Serial] [Slow]", func() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
func isValidOutput(output string) bool {
|
func isValidOutput(output string) bool {
|
||||||
return strings.Contains(output, expectedQueryOutput) &&
|
return strings.Contains(output, expectedQueryOutput) &&
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] GMSA Kubelet [Slow]", func() {
|
var _ = sigDescribe("[Feature:Windows] GMSA Kubelet [Slow]", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("gmsa-kubelet-test-windows")
|
f := framework.NewDefaultFramework("gmsa-kubelet-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ var _ = SIGDescribe("[Feature:Windows] GMSA Kubelet [Slow]", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
func generateDummyCredSpecs(domain string) *string {
|
func generateDummyCredSpecs(domain string) *string {
|
||||||
shortName := strings.ToUpper(strings.Split(domain, ".")[0])
|
shortName := strings.ToUpper(strings.Split(domain, ".")[0])
|
||||||
|
@ -85,7 +85,7 @@ var (
|
|||||||
User_NTAuthoritySystem = "NT AUTHORITY\\SYSTEM"
|
User_NTAuthoritySystem = "NT AUTHORITY\\SYSTEM"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersion:1.22] HostProcess containers", func() {
|
var _ = sigDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersion:1.22] HostProcess containers", skipUnlessWindows(func() {
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
||||||
})
|
})
|
||||||
@ -799,7 +799,7 @@ var _ = SIGDescribe("[Feature:WindowsHostProcessContainers] [MinimumKubeletVersi
|
|||||||
gomega.Expect(strings.ToLower(logs)).ShouldNot(gomega.ContainSubstring("nt authority"), "Container runs 'whoami' and logs should not contain 'nt authority'")
|
gomega.Expect(strings.ToLower(logs)).ShouldNot(gomega.ContainSubstring("nt authority"), "Container runs 'whoami' and logs should not contain 'nt authority'")
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
}))
|
||||||
|
|
||||||
func makeTestPodWithVolumeMounts(name string) *v1.Pod {
|
func makeTestPodWithVolumeMounts(name string) *v1.Pod {
|
||||||
hostPathDirectoryOrCreate := v1.HostPathDirectoryOrCreate
|
hostPathDirectoryOrCreate := v1.HostPathDirectoryOrCreate
|
||||||
|
@ -44,7 +44,7 @@ var (
|
|||||||
linuxBusyBoxImage = imageutils.GetE2EImage(imageutils.Nginx)
|
linuxBusyBoxImage = imageutils.GetE2EImage(imageutils.Nginx)
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("Hybrid cluster network", func() {
|
var _ = sigDescribe("Hybrid cluster network", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("hybrid-network")
|
f := framework.NewDefaultFramework("hybrid-network")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ var _ = SIGDescribe("Hybrid cluster network", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
var (
|
var (
|
||||||
warmUpDuration = "30s"
|
warmUpDuration = "30s"
|
||||||
|
@ -35,7 +35,7 @@ var (
|
|||||||
WindowsHyperVContainerRuntimeClass = "runhcs-wcow-hypervisor"
|
WindowsHyperVContainerRuntimeClass = "runhcs-wcow-hypervisor"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:WindowsHyperVContainers] HyperV containers", func() {
|
var _ = sigDescribe("[Feature:WindowsHyperVContainers] HyperV containers", skipUnlessWindows(func() {
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
||||||
})
|
})
|
||||||
@ -143,4 +143,4 @@ var _ = SIGDescribe("[Feature:WindowsHyperVContainers] HyperV containers", func(
|
|||||||
|
|
||||||
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded), "pod should have succeeded")
|
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded), "pod should have succeeded")
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
@ -37,7 +37,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() {
|
var _ = sigDescribe("[Feature:Windows] Kubelet-Stats [Serial]", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("kubelet-stats-test-windows-serial")
|
f := framework.NewDefaultFramework("kubelet-stats-test-windows-serial")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -113,8 +113,9 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats [Serial]", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() {
|
|
||||||
|
var _ = sigDescribe("[Feature:Windows] Kubelet-Stats", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("kubelet-stats-test-windows")
|
f := framework.NewDefaultFramework("kubelet-stats-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -204,7 +205,7 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
// findWindowsNode finds a Windows node that is Ready and Schedulable
|
// findWindowsNode finds a Windows node that is Ready and Schedulable
|
||||||
func findWindowsNode(ctx context.Context, f *framework.Framework) (v1.Node, error) {
|
func findWindowsNode(ctx context.Context, f *framework.Framework) (v1.Node, error) {
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Memory Limits [Serial] [Slow]", func() {
|
var _ = sigDescribe("[Feature:Windows] Memory Limits [Serial] [Slow]", skipUnlessWindows(func() {
|
||||||
|
|
||||||
f := framework.NewDefaultFramework("memory-limit-test-windows")
|
f := framework.NewDefaultFramework("memory-limit-test-windows")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
@ -60,8 +60,7 @@ var _ = SIGDescribe("[Feature:Windows] Memory Limits [Serial] [Slow]", func() {
|
|||||||
overrideAllocatableMemoryTest(ctx, f, framework.TestContext.CloudConfig.NumNodes)
|
overrideAllocatableMemoryTest(ctx, f, framework.TestContext.CloudConfig.NumNodes)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}))
|
||||||
})
|
|
||||||
|
|
||||||
type nodeMemory struct {
|
type nodeMemory struct {
|
||||||
// capacity
|
// capacity
|
||||||
|
@ -34,7 +34,7 @@ import (
|
|||||||
admissionapi "k8s.io/pod-security-admission/api"
|
admissionapi "k8s.io/pod-security-admission/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] [Excluded:WindowsDocker] [MinimumKubeletVersion:1.22] RebootHost containers [Serial] [Disruptive] [Slow]", func() {
|
var _ = sigDescribe("[Feature:Windows] [Excluded:WindowsDocker] [MinimumKubeletVersion:1.22] RebootHost containers [Serial] [Disruptive] [Slow]", skipUnlessWindows(func() {
|
||||||
ginkgo.BeforeEach(func() {
|
ginkgo.BeforeEach(func() {
|
||||||
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
|
||||||
})
|
})
|
||||||
@ -254,4 +254,4 @@ var _ = SIGDescribe("[Feature:Windows] [Excluded:WindowsDocker] [MinimumKubeletV
|
|||||||
framework.ExpectNoError(err, "Error retrieving pod")
|
framework.ExpectNoError(err, "Error retrieving pod")
|
||||||
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded))
|
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded))
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
@ -40,7 +40,7 @@ import (
|
|||||||
|
|
||||||
const runAsUserNameContainerName = "run-as-username-container"
|
const runAsUserNameContainerName = "run-as-username-container"
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] SecurityContext", func() {
|
var _ = sigDescribe("[Feature:Windows] SecurityContext", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("windows-run-as-username")
|
f := framework.NewDefaultFramework("windows-run-as-username")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ var _ = SIGDescribe("[Feature:Windows] SecurityContext", func() {
|
|||||||
expectedEventError := "container's runAsUserName (CONTAINERADMINISTRATOR) which will be regarded as root identity and will break non-root policy"
|
expectedEventError := "container's runAsUserName (CONTAINERADMINISTRATOR) which will be regarded as root identity and will break non-root policy"
|
||||||
gomega.Expect(event.Message).Should(gomega.ContainSubstring(expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
gomega.Expect(event.Message).Should(gomega.ContainSubstring(expectedEventError), "Event error should indicate non-root policy caused container to not start")
|
||||||
})
|
})
|
||||||
})
|
}))
|
||||||
|
|
||||||
func runAsUserNamePod(username *string) *v1.Pod {
|
func runAsUserNamePod(username *string) *v1.Pod {
|
||||||
podName := "run-as-username-" + string(uuid.NewUUID())
|
podName := "run-as-username-" + string(uuid.NewUUID())
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("Services", func() {
|
var _ = sigDescribe("Services", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("services")
|
f := framework.NewDefaultFramework("services")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
|
|
||||||
@ -85,5 +85,4 @@ var _ = SIGDescribe("Services", func() {
|
|||||||
assertConsistentConnectivity(ctx, f, testPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s", net.JoinHostPort(nodeIP, strconv.Itoa(nodePort)))))
|
assertConsistentConnectivity(ctx, f, testPod.ObjectMeta.Name, windowsOS, windowsCheck(fmt.Sprintf("http://%s", net.JoinHostPort(nodeIP, strconv.Itoa(nodePort)))))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}))
|
||||||
})
|
|
||||||
|
@ -44,7 +44,7 @@ var (
|
|||||||
image = imageutils.GetE2EImage(imageutils.Pause)
|
image = imageutils.GetE2EImage(imageutils.Pause)
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("[Feature:Windows] Windows volume mounts", func() {
|
var _ = sigDescribe("[Feature:Windows] Windows volume mounts", skipUnlessWindows(func() {
|
||||||
f := framework.NewDefaultFramework("windows-volumes")
|
f := framework.NewDefaultFramework("windows-volumes")
|
||||||
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
|
||||||
var (
|
var (
|
||||||
@ -86,8 +86,7 @@ var _ = SIGDescribe("[Feature:Windows] Windows volume mounts", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
}))
|
||||||
})
|
|
||||||
|
|
||||||
func doReadOnlyTest(ctx context.Context, f *framework.Framework, source v1.VolumeSource, volumePath string) {
|
func doReadOnlyTest(ctx context.Context, f *framework.Framework, source v1.VolumeSource, volumePath string) {
|
||||||
var (
|
var (
|
||||||
|
@ -16,9 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package e2enode
|
package e2enode
|
||||||
|
|
||||||
import "github.com/onsi/ginkgo/v2"
|
import "k8s.io/kubernetes/test/e2e/framework"
|
||||||
|
|
||||||
// SIGDescribe annotates the test with the SIG label.
|
// SIGDescribe annotates the test with the SIG label.
|
||||||
func SIGDescribe(text string, body func()) bool {
|
var SIGDescribe = framework.SIGDescribe("node")
|
||||||
return ginkgo.Describe("[sig-node] "+text, body)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user