tests: Skips Windows-unrelated tests on Windows

Skips IPv6 tests on Windows.
Skips sysctl tests on Windows.
Skips network policy tests on Windows.
Skips RunAsUser / FSGroup / file permissions related tests, as those are
not supported on Windows.
Skips the test "should preserve source pod IP for traffic thru service cluster IP"
on Windows, as it creates a Pod with HostNetwork=true, which is unsupported.

What works and what doesn't work on Windows has been documented here:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/conformance-tests.md#windows--linux-considerations
This commit is contained in:
Claudiu Belu 2019-07-04 07:47:17 -07:00
parent d951d19ec4
commit 8812720148
13 changed files with 78 additions and 19 deletions

View File

@ -54,7 +54,9 @@ var _ = ginkgo.Describe("[sig-storage] ConfigMap", func() {
doConfigMapE2EWithoutMappings(f, 0, 0, &defaultMode)
})
ginkgo.It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options, and it does not support setting file permissions.
framework.SkipIfNodeOSDistroIs("windows")
defaultMode := int32(0440) /* setting fsGroup sets mode to at least 440 */
doConfigMapE2EWithoutMappings(f, 1000, 1001, &defaultMode)
})
@ -69,7 +71,9 @@ var _ = ginkgo.Describe("[sig-storage] ConfigMap", func() {
doConfigMapE2EWithoutMappings(f, 1000, 0, nil)
})
ginkgo.It("should be consumable from pods in volume as non-root with FSGroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume as non-root with FSGroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
doConfigMapE2EWithoutMappings(f, 1000, 1001, nil)
})
@ -103,7 +107,9 @@ var _ = ginkgo.Describe("[sig-storage] ConfigMap", func() {
doConfigMapE2EWithMappings(f, 1000, 0, nil)
})
ginkgo.It("should be consumable from pods in volume with mappings as non-root with FSGroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume with mappings as non-root with FSGroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
doConfigMapE2EWithMappings(f, 1000, 1001, nil)
})

View File

@ -87,7 +87,9 @@ var _ = ginkgo.Describe("[sig-storage] Downward API volume", func() {
})
})
ginkgo.It("should provide podname as non-root with fsgroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should provide podname as non-root with fsgroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)
@ -101,7 +103,9 @@ var _ = ginkgo.Describe("[sig-storage] Downward API volume", func() {
})
})
ginkgo.It("should provide podname as non-root with fsgroup and defaultMode [NodeFeature:FSGroup]", func() {
ginkgo.It("should provide podname as non-root with fsgroup and defaultMode [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options, and it does not support setting file permissions.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)

View File

@ -41,7 +41,13 @@ var (
var _ = ginkgo.Describe("[sig-storage] EmptyDir volumes", func() {
f := framework.NewDefaultFramework("emptydir")
ginkgo.Context("when FSGroup is specified [NodeFeature:FSGroup]", func() {
ginkgo.Context("when FSGroup is specified [LinuxOnly] [NodeFeature:FSGroup]", func() {
ginkgo.BeforeEach(func() {
// Windows does not support the FSGroup SecurityContext option.
framework.SkipIfNodeOSDistroIs("windows")
})
ginkgo.It("new files should be created with FSGroup ownership when container is root", func() {
doTestSetgidFSGroup(f, testImageRootUid, v1.StorageMediumMemory)
})

View File

@ -55,7 +55,9 @@ var _ = ginkgo.Describe("[sig-storage] Projected configMap", func() {
doProjectedConfigMapE2EWithoutMappings(f, 0, 0, &defaultMode)
})
ginkgo.It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume as non-root with defaultMode and fsGroup set [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options, and it does not support setting file permissions.
framework.SkipIfNodeOSDistroIs("windows")
defaultMode := int32(0440) /* setting fsGroup sets mode to at least 440 */
doProjectedConfigMapE2EWithoutMappings(f, 1000, 1001, &defaultMode)
})
@ -70,7 +72,9 @@ var _ = ginkgo.Describe("[sig-storage] Projected configMap", func() {
doProjectedConfigMapE2EWithoutMappings(f, 1000, 0, nil)
})
ginkgo.It("should be consumable from pods in volume as non-root with FSGroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume as non-root with FSGroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
doProjectedConfigMapE2EWithoutMappings(f, 1000, 1001, nil)
})
@ -104,7 +108,9 @@ var _ = ginkgo.Describe("[sig-storage] Projected configMap", func() {
doProjectedConfigMapE2EWithMappings(f, 1000, 0, nil)
})
ginkgo.It("should be consumable from pods in volume with mappings as non-root with FSGroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should be consumable from pods in volume with mappings as non-root with FSGroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
doProjectedConfigMapE2EWithMappings(f, 1000, 1001, nil)
})

View File

@ -87,7 +87,9 @@ var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
})
})
ginkgo.It("should provide podname as non-root with fsgroup [NodeFeature:FSGroup]", func() {
ginkgo.It("should provide podname as non-root with fsgroup [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)
@ -101,7 +103,9 @@ var _ = ginkgo.Describe("[sig-storage] Projected downwardAPI", func() {
})
})
ginkgo.It("should provide podname as non-root with fsgroup and defaultMode [NodeFeature:FSGroup]", func() {
ginkgo.It("should provide podname as non-root with fsgroup and defaultMode [LinuxOnly] [NodeFeature:FSGroup]", func() {
// Windows does not support RunAsUser / FSGroup SecurityContext options, and it does not support setting file permissions.
framework.SkipIfNodeOSDistroIs("windows")
podName := "metadata-volume-" + string(uuid.NewUUID())
uid := int64(1001)
gid := int64(1234)

View File

@ -120,7 +120,9 @@ var _ = framework.KubeDescribe("Security Context", func() {
}
}
ginkgo.It("should run with an explicit non-root user ID", func() {
ginkgo.It("should run with an explicit non-root user ID [LinuxOnly]", func() {
// creates a pod with RunAsUser, which is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
name := "explicit-nonroot-uid"
pod := makeNonRootPod(name, rootImage, pointer.Int64Ptr(1234))
pod = podClient.Create(pod)
@ -128,7 +130,9 @@ var _ = framework.KubeDescribe("Security Context", func() {
podClient.WaitForSuccess(name, framework.PodStartTimeout)
framework.ExpectNoError(podClient.MatchContainerOutput(name, name, "1234"))
})
ginkgo.It("should not run with an explicit root user ID", func() {
ginkgo.It("should not run with an explicit root user ID [LinuxOnly]", func() {
// creates a pod with RunAsUser, which is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
name := "explicit-root-uid"
pod := makeNonRootPod(name, nonRootImage, pointer.Int64Ptr(0))
pod = podClient.Create(pod)

View File

@ -29,7 +29,13 @@ import (
"github.com/onsi/gomega"
)
var _ = framework.KubeDescribe("Sysctls [NodeFeature:Sysctls]", func() {
var _ = framework.KubeDescribe("Sysctls [LinuxOnly] [NodeFeature:Sysctls]", func() {
ginkgo.BeforeEach(func() {
// sysctl is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
})
f := framework.NewDefaultFramework("sysctl")
var podClient *framework.PodClient

View File

@ -350,6 +350,13 @@ func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string) {
}
}
// SkipIfNodeOSDistroIs skips if the node OS distro is included in the unsupportedNodeOsDistros.
func SkipIfNodeOSDistroIs(unsupportedNodeOsDistros ...string) {
if NodeOSDistroIs(unsupportedNodeOsDistros...) {
skipInternalf(1, "Not supported for node OS distro %v (is %s)", unsupportedNodeOsDistros, TestContext.NodeOSDistro)
}
}
// SkipUnlessTaintBasedEvictionsEnabled skips if the TaintBasedEvictions is not enabled.
func SkipUnlessTaintBasedEvictionsEnabled() {
if !utilfeature.DefaultFeatureGate.Enabled(features.TaintBasedEvictions) {

View File

@ -511,7 +511,12 @@ var _ = SIGDescribe("DNS configMap nameserver [IPv4]", func() {
})
})
var _ = SIGDescribe("DNS configMap nameserver [Feature:Networking-IPv6]", func() {
var _ = SIGDescribe("DNS configMap nameserver [Feature:Networking-IPv6] [LinuxOnly]", func() {
ginkgo.BeforeEach(func() {
// IPv6 is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
})
ginkgo.Context("Change stubDomain", func() {
nsTest := &dnsNameserverTest{dnsTestCommon: newDNSTestCommon()}

View File

@ -42,12 +42,17 @@ connections from one of the clients. The test then asserts that the clients
failed or successfully connected as expected.
*/
var _ = SIGDescribe("NetworkPolicy", func() {
var _ = SIGDescribe("NetworkPolicy [LinuxOnly]", func() {
var service *v1.Service
var podServer *v1.Pod
var podServerLabelSelector string
f := framework.NewDefaultFramework("network-policy")
ginkgo.BeforeEach(func() {
// Windows does not support network policies.
framework.SkipIfNodeOSDistroIs("windows")
})
ginkgo.Context("NetworkPolicy between server and client", func() {
ginkgo.BeforeEach(func() {
ginkgo.By("Creating a simple server that serves on port 80 and 81.")

View File

@ -52,7 +52,9 @@ var _ = SIGDescribe("Networking", func() {
framework.CheckConnectivityToHost(f, "", "connectivity-test", "8.8.8.8", 53, 30))
})
ginkgo.It("should provide Internet connection for containers [Feature:Networking-IPv6][Experimental]", func() {
ginkgo.It("should provide Internet connection for containers [Feature:Networking-IPv6][Experimental][LinuxOnly]", func() {
// IPv6 is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
ginkgo.By("Running container which tries to connect to 2001:4860:4860::8888")
framework.ExpectNoError(
framework.CheckConnectivityToHost(f, "", "connectivity-test", "2001:4860:4860::8888", 53, 30))

View File

@ -167,6 +167,8 @@ var _ = SIGDescribe("Networking IPerf IPv4 [Experimental] [Feature:Networking-IP
// Declared as Flakey since it has not been proven to run in parallel on small nodes or slow networks in CI
// TODO jayunit100 : Retag this test according to semantics from #22401
var _ = SIGDescribe("Networking IPerf IPv6 [Experimental] [Feature:Networking-IPv6] [Slow] [Feature:Networking-Performance]", func() {
var _ = SIGDescribe("Networking IPerf IPv6 [Experimental] [Feature:Networking-IPv6] [Slow] [Feature:Networking-Performance] [LinuxOnly]", func() {
// IPv6 is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
networkingIPerfTest(true)
})

View File

@ -265,7 +265,9 @@ var _ = SIGDescribe("Services", func() {
framework.ExpectNoError(err, "failed to validate endpoints for service %s in namespace: %s", serviceName, ns)
})
ginkgo.It("should preserve source pod IP for traffic thru service cluster IP", func() {
ginkgo.It("should preserve source pod IP for traffic thru service cluster IP [LinuxOnly]", func() {
// this test is creating a pod with HostNetwork=true, which is not supported on Windows.
framework.SkipIfNodeOSDistroIs("windows")
// This behavior is not supported if Kube-proxy is in "userspace" mode.
// So we check the kube-proxy mode and skip this test if that's the case.