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:
Patrick Ohly 2023-06-19 17:13:37 +02:00
parent 39b6916cbc
commit f2d34426f8
41 changed files with 120 additions and 139 deletions

View File

@ -45,12 +45,10 @@ import (
// test/e2e/lifecycle/framework.go
package lifecycle
import "github.com/onsi/ginkgo"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-cluster-lifecycle] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("cluster-lifecycle")
```
```golang
// test/e2e/lifecycle/bootstrap/bootstrap_signer.go

View File

@ -16,9 +16,7 @@ limitations under the License.
package apimachinery
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-api-machinery] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("api-machinery")

View File

@ -16,9 +16,7 @@ limitations under the License.
package apps
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-apps] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("apps")

View File

@ -16,9 +16,7 @@ limitations under the License.
package architecture
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-architecture] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("architecture")

View File

@ -16,9 +16,7 @@ limitations under the License.
package auth
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-auth] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("auth")

View File

@ -16,9 +16,7 @@ limitations under the License.
package autoscaling
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-autoscaling] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("autoscaling")

View File

@ -16,9 +16,7 @@ limitations under the License.
package cloud
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-cloud-provider] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("cloud-provider")

View File

@ -16,9 +16,7 @@ limitations under the License.
package apps
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-apps] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("apps")

View File

@ -16,9 +16,7 @@ limitations under the License.
package auth
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-auth] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("auth")

View File

@ -16,9 +16,7 @@ limitations under the License.
package gcp
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-cloud-provider-gcp] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("cloud-provider-gcp")

View File

@ -16,9 +16,7 @@ limitations under the License.
package network
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-network] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("network")

View File

@ -16,9 +16,7 @@ limitations under the License.
package node
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-node] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("node")

View File

@ -16,9 +16,7 @@ limitations under the License.
package network
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-network] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("network")

View File

@ -16,9 +16,6 @@ limitations under the License.
package node
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-node] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("node")

View File

@ -16,9 +16,7 @@ limitations under the License.
package storage
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-storage] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("storage")

View File

@ -20,6 +20,7 @@ import (
"fmt"
"path"
"reflect"
"regexp"
"strings"
"github.com/onsi/ginkgo/v2"
@ -123,6 +124,26 @@ func AnnotatedLocationWithOffset(annotation string, offset int) types.CodeLocati
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.
func ConformanceIt(text string, args ...interface{}) bool {
args = append(args, ginkgo.Offset(1), WithConformance())

View File

@ -69,7 +69,7 @@ var (
func Describe() {
// Normally a single line would be better, but this is an extreme example and
// 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.
"", // buggy: not needed
" 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.
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: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: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: [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
no-such-node-env
node-feature-foo
sig-testing
`
)

View File

@ -16,9 +16,7 @@ limitations under the License.
package common
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-instrumentation] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("instrumentation")

View File

@ -16,9 +16,7 @@ limitations under the License.
package kubectl
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-cli] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("cli")

View File

@ -16,9 +16,7 @@ limitations under the License.
package lifecycle
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-cluster-lifecycle] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("cluster-lifecycle")

View File

@ -16,9 +16,7 @@ limitations under the License.
package common
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-network] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("network")

View File

@ -16,9 +16,7 @@ limitations under the License.
package node
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-node] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("node")

View File

@ -21,8 +21,6 @@ import (
"fmt"
"time"
"github.com/onsi/ginkgo/v2"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
@ -33,12 +31,10 @@ import (
var (
timeout = 10 * time.Minute
waitTime = 2 * time.Second
)
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-scheduling] "+text, body)
}
// SIGDescribe annotates the test with the SIG label.
SIGDescribe = framework.SIGDescribe("scheduling")
)
// WaitForStableCluster waits until all existing pods are scheduled and returns their amount.
func WaitForStableCluster(c clientset.Interface, workerNodes sets.Set[string]) int {

View File

@ -16,9 +16,7 @@ limitations under the License.
package utils
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-storage] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("storage")

View File

@ -35,7 +35,7 @@ import (
"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.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
func newCPUBurnPods(numPods int, image imageutils.Config, cpuLimit string, memoryLimit string) []*v1.Pod {

View File

@ -40,7 +40,7 @@ import (
"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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -72,7 +72,7 @@ var _ = SIGDescribe("[Feature:Windows] Density [Serial] [Slow]", func() {
}
})
})
}))
type densityTest struct {
// number of pods

View File

@ -39,7 +39,7 @@ const (
testSlowMultiplier = 60
)
var _ = SIGDescribe("[Feature:GPUDevicePlugin] Device Plugin", func() {
var _ = sigDescribe("[Feature:GPUDevicePlugin] Device Plugin", skipUnlessWindows(func() {
f := framework.NewDefaultFramework("device-plugin")
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)
framework.ExpectNoError(envVarDirectxGpuNameErr, "failed: didn't find expected environment variable.")
})
})
}))

View File

@ -31,7 +31,7 @@ import (
"github.com/onsi/gomega"
)
var _ = SIGDescribe("[Feature:Windows] DNS", func() {
var _ = sigDescribe("[Feature:Windows] DNS", skipUnlessWindows(func() {
ginkgo.BeforeEach(func() {
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
@ -136,4 +136,4 @@ var _ = SIGDescribe("[Feature:Windows] DNS", func() {
// TODO: Add more test cases for other DNSPolicies.
})
})
}))

View File

@ -17,19 +17,29 @@ limitations under the License.
package windows
import (
"k8s.io/kubernetes/test/e2e/framework"
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
"github.com/onsi/ginkgo/v2"
)
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-windows] "+text, func() {
// sigDescribe annotates the test with the SIG label.
// Use this together with skipUnlessWindows to define
// 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() {
// all tests in this package are Windows specific
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
})
body()
})
cb()
}
}

View File

@ -90,7 +90,7 @@ const (
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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -220,7 +220,7 @@ var _ = SIGDescribe("[Feature:Windows] GMSA Full [Serial] [Slow]", func() {
})
})
})
}))
func isValidOutput(output string) bool {
return strings.Contains(output, expectedQueryOutput) &&

View File

@ -39,7 +39,7 @@ import (
"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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -133,7 +133,7 @@ var _ = SIGDescribe("[Feature:Windows] GMSA Kubelet [Slow]", func() {
})
})
})
})
}))
func generateDummyCredSpecs(domain string) *string {
shortName := strings.ToUpper(strings.Split(domain, ".")[0])

View File

@ -85,7 +85,7 @@ var (
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() {
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'")
})
})
}))
func makeTestPodWithVolumeMounts(name string) *v1.Pod {
hostPathDirectoryOrCreate := v1.HostPathDirectoryOrCreate

View File

@ -44,7 +44,7 @@ var (
linuxBusyBoxImage = imageutils.GetE2EImage(imageutils.Nginx)
)
var _ = SIGDescribe("Hybrid cluster network", func() {
var _ = sigDescribe("Hybrid cluster network", skipUnlessWindows(func() {
f := framework.NewDefaultFramework("hybrid-network")
f.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -99,7 +99,7 @@ var _ = SIGDescribe("Hybrid cluster network", func() {
})
})
})
}))
var (
warmUpDuration = "30s"

View File

@ -35,7 +35,7 @@ var (
WindowsHyperVContainerRuntimeClass = "runhcs-wcow-hypervisor"
)
var _ = SIGDescribe("[Feature:WindowsHyperVContainers] HyperV containers", func() {
var _ = sigDescribe("[Feature:WindowsHyperVContainers] HyperV containers", skipUnlessWindows(func() {
ginkgo.BeforeEach(func() {
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")
})
})
}))

View File

@ -37,7 +37,7 @@ import (
"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.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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -204,7 +205,7 @@ var _ = SIGDescribe("[Feature:Windows] Kubelet-Stats", func() {
})
})
})
})
}))
// findWindowsNode finds a Windows node that is Ready and Schedulable
func findWindowsNode(ctx context.Context, f *framework.Framework) (v1.Node, error) {

View File

@ -39,7 +39,7 @@ import (
"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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
@ -60,8 +60,7 @@ var _ = SIGDescribe("[Feature:Windows] Memory Limits [Serial] [Slow]", func() {
overrideAllocatableMemoryTest(ctx, f, framework.TestContext.CloudConfig.NumNodes)
})
})
})
}))
type nodeMemory struct {
// capacity

View File

@ -34,7 +34,7 @@ import (
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() {
e2eskipper.SkipUnlessNodeOSDistroIs("windows")
})
@ -254,4 +254,4 @@ var _ = SIGDescribe("[Feature:Windows] [Excluded:WindowsDocker] [MinimumKubeletV
framework.ExpectNoError(err, "Error retrieving pod")
gomega.Expect(p.Status.Phase).To(gomega.Equal(v1.PodSucceeded))
})
})
}))

View File

@ -40,7 +40,7 @@ import (
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.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"
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 {
podName := "run-as-username-" + string(uuid.NewUUID())

View File

@ -36,7 +36,7 @@ import (
"github.com/onsi/gomega"
)
var _ = SIGDescribe("Services", func() {
var _ = sigDescribe("Services", skipUnlessWindows(func() {
f := framework.NewDefaultFramework("services")
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)))))
})
})
}))

View File

@ -44,7 +44,7 @@ var (
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.NamespacePodSecurityLevel = admissionapi.LevelPrivileged
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) {
var (

View File

@ -16,9 +16,7 @@ limitations under the License.
package e2enode
import "github.com/onsi/ginkgo/v2"
import "k8s.io/kubernetes/test/e2e/framework"
// SIGDescribe annotates the test with the SIG label.
func SIGDescribe(text string, body func()) bool {
return ginkgo.Describe("[sig-node] "+text, body)
}
var SIGDescribe = framework.SIGDescribe("node")