mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Merge pull request #114991 from TheOneTheOnlyJJ/skip-failing-unittests
Skip failing Windows unit tests
This commit is contained in:
commit
083e0d2be1
@ -1618,23 +1618,6 @@ func TestValidateCronJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"spec.timeZone: Invalid value: \"Continent/Zone \": unknown time zone Continent/Zone ": {
|
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
|
||||||
Name: "mycronjob",
|
|
||||||
Namespace: metav1.NamespaceDefault,
|
|
||||||
UID: types.UID("1a2b3c"),
|
|
||||||
},
|
|
||||||
Spec: batch.CronJobSpec{
|
|
||||||
Schedule: "0 * * * *",
|
|
||||||
TimeZone: &timeZoneBadSuffix,
|
|
||||||
ConcurrencyPolicy: batch.AllowConcurrent,
|
|
||||||
JobTemplate: batch.JobTemplateSpec{
|
|
||||||
Spec: batch.JobSpec{
|
|
||||||
Template: validPodTemplateSpec,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"spec.timeZone: Invalid value: \"Continent/InvalidZone\": unknown time zone Continent/InvalidZone": {
|
"spec.timeZone: Invalid value: \"Continent/InvalidZone\": unknown time zone Continent/InvalidZone": {
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "mycronjob",
|
Name: "mycronjob",
|
||||||
@ -1900,6 +1883,28 @@ func TestValidateCronJob(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: The following test doesn't fail on Windows.
|
||||||
|
// When opening a file on Windows, syscall.Open is called, which will trim the whitespace suffix.
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
|
errorCases["spec.timeZone: Invalid value: \"Continent/Zone \": unknown time zone Continent/Zone "] = batch.CronJob{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "mycronjob",
|
||||||
|
Namespace: metav1.NamespaceDefault,
|
||||||
|
UID: types.UID("1a2b3c"),
|
||||||
|
},
|
||||||
|
Spec: batch.CronJobSpec{
|
||||||
|
Schedule: "0 * * * *",
|
||||||
|
TimeZone: &timeZoneBadSuffix,
|
||||||
|
ConcurrencyPolicy: batch.AllowConcurrent,
|
||||||
|
JobTemplate: batch.JobTemplateSpec{
|
||||||
|
Spec: batch.JobSpec{
|
||||||
|
Template: validPodTemplateSpec,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for k, v := range errorCases {
|
for k, v := range errorCases {
|
||||||
t.Run(k, func(t *testing.T) {
|
t.Run(k, func(t *testing.T) {
|
||||||
errs := ValidateCronJobCreate(&v, corevalidation.PodValidationOptions{})
|
errs := ValidateCronJobCreate(&v, corevalidation.PodValidationOptions{})
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -257,14 +258,20 @@ func TestFsStoreLoad(t *testing.T) {
|
|||||||
uid types.UID
|
uid types.UID
|
||||||
resourceVersion string
|
resourceVersion string
|
||||||
err string
|
err string
|
||||||
|
skipOnWindows bool
|
||||||
}{
|
}{
|
||||||
{"checkpoint exists", uid, resourceVersion, ""},
|
{"checkpoint exists", uid, resourceVersion, "", true},
|
||||||
{"checkpoint does not exist", "bogus-uid", "bogus-resourceVersion", "no checkpoint for source"},
|
{"checkpoint does not exist", "bogus-uid", "bogus-resourceVersion", "no checkpoint for source", false},
|
||||||
{"ambiguous UID", "", "bogus-resourceVersion", "empty UID is ambiguous"},
|
{"ambiguous UID", "", "bogus-resourceVersion", "empty UID is ambiguous", false},
|
||||||
{"ambiguous ResourceVersion", "bogus-uid", "", "empty ResourceVersion is ambiguous"},
|
{"ambiguous ResourceVersion", "bogus-uid", "", "empty ResourceVersion is ambiguous", false},
|
||||||
}
|
}
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(c.desc, func(t *testing.T) {
|
t.Run(c.desc, func(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if c.skipOnWindows && runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
source, _, err := checkpoint.NewRemoteConfigSource(&apiv1.NodeConfigSource{
|
source, _, err := checkpoint.NewRemoteConfigSource(&apiv1.NodeConfigSource{
|
||||||
ConfigMap: &apiv1.ConfigMapNodeConfigSource{
|
ConfigMap: &apiv1.ConfigMapNodeConfigSource{
|
||||||
Name: "name",
|
Name: "name",
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
goruntime "runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||||
@ -43,6 +44,7 @@ func TestLoad(t *testing.T) {
|
|||||||
expect *kubeletconfig.KubeletConfiguration
|
expect *kubeletconfig.KubeletConfiguration
|
||||||
err string
|
err string
|
||||||
strictErr bool
|
strictErr bool
|
||||||
|
skipOnWindows bool
|
||||||
}{
|
}{
|
||||||
// missing file
|
// missing file
|
||||||
{
|
{
|
||||||
@ -94,11 +96,13 @@ func TestLoad(t *testing.T) {
|
|||||||
file: newString(`kind: KubeletConfiguration
|
file: newString(`kind: KubeletConfiguration
|
||||||
apiVersion: kubelet.config.k8s.io/v1beta1`),
|
apiVersion: kubelet.config.k8s.io/v1beta1`),
|
||||||
expect: newConfig(t),
|
expect: newConfig(t),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "default from json",
|
desc: "default from json",
|
||||||
file: newString(`{"kind":"KubeletConfiguration","apiVersion":"kubelet.config.k8s.io/v1beta1"}`),
|
file: newString(`{"kind":"KubeletConfiguration","apiVersion":"kubelet.config.k8s.io/v1beta1"}`),
|
||||||
expect: newConfig(t),
|
expect: newConfig(t),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// relative path
|
// relative path
|
||||||
@ -112,6 +116,7 @@ staticPodPath: %s`, relativePath)),
|
|||||||
kc.StaticPodPath = filepath.Join(configDir, relativePath)
|
kc.StaticPodPath = filepath.Join(configDir, relativePath)
|
||||||
return kc
|
return kc
|
||||||
}(),
|
}(),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "json, relative path is resolved",
|
desc: "json, relative path is resolved",
|
||||||
@ -121,6 +126,7 @@ staticPodPath: %s`, relativePath)),
|
|||||||
kc.StaticPodPath = filepath.Join(configDir, relativePath)
|
kc.StaticPodPath = filepath.Join(configDir, relativePath)
|
||||||
return kc
|
return kc
|
||||||
}(),
|
}(),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// This should fail from v1beta2+
|
// This should fail from v1beta2+
|
||||||
@ -136,6 +142,7 @@ staticPodPath: %s/foo`, relativePath, relativePath)),
|
|||||||
kc.StaticPodPath = filepath.Join(configDir, relativePath, "foo")
|
kc.StaticPodPath = filepath.Join(configDir, relativePath, "foo")
|
||||||
return kc
|
return kc
|
||||||
}(),
|
}(),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// This should fail from v1beta2+
|
// This should fail from v1beta2+
|
||||||
@ -146,11 +153,17 @@ foo: bar`),
|
|||||||
// err: "found unknown field: foo",
|
// err: "found unknown field: foo",
|
||||||
// strictErr: true,
|
// strictErr: true,
|
||||||
expect: newConfig(t),
|
expect: newConfig(t),
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(c.desc, func(t *testing.T) {
|
t.Run(c.desc, func(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if c.skipOnWindows && goruntime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
fs := utilfs.NewTempFs()
|
fs := utilfs.NewTempFs()
|
||||||
fs.MkdirAll(configDir, 0777)
|
fs.MkdirAll(configDir, 0777)
|
||||||
path := filepath.Join(configDir, kubeletFile)
|
path := filepath.Join(configDir, kubeletFile)
|
||||||
@ -184,10 +197,11 @@ func TestResolveRelativePaths(t *testing.T) {
|
|||||||
desc string
|
desc string
|
||||||
path string
|
path string
|
||||||
expect string
|
expect string
|
||||||
|
skipOnWindows bool
|
||||||
}{
|
}{
|
||||||
{"empty path", "", ""},
|
{"empty path", "", "", false},
|
||||||
{"absolute path", absolutePath, absolutePath},
|
{"absolute path", absolutePath, absolutePath, true},
|
||||||
{"relative path", relativePath, filepath.Join(configDir, relativePath)},
|
{"relative path", relativePath, filepath.Join(configDir, relativePath), false},
|
||||||
}
|
}
|
||||||
|
|
||||||
paths := kubeletconfig.KubeletConfigurationPathRefs(newConfig(t))
|
paths := kubeletconfig.KubeletConfigurationPathRefs(newConfig(t))
|
||||||
@ -196,6 +210,11 @@ func TestResolveRelativePaths(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(c.desc, func(t *testing.T) {
|
t.Run(c.desc, func(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if c.skipOnWindows && goruntime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
// set the path, resolve it, and check if it resolved as we would expect
|
// set the path, resolve it, and check if it resolved as we would expect
|
||||||
*(paths[0]) = c.path
|
*(paths[0]) = c.path
|
||||||
resolveRelativePaths(paths, configDir)
|
resolveRelativePaths(paths, configDir)
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
goruntime "runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
@ -456,19 +457,26 @@ func TestGetPodDNS(t *testing.T) {
|
|||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
desc string
|
desc string
|
||||||
expandedDNSConfig bool
|
expandedDNSConfig bool
|
||||||
|
skipOnWindows bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "Not ExpandedDNSConfig",
|
desc: "Not ExpandedDNSConfig",
|
||||||
expandedDNSConfig: false,
|
expandedDNSConfig: false,
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "ExpandedDNSConfig",
|
desc: "ExpandedDNSConfig",
|
||||||
expandedDNSConfig: true,
|
expandedDNSConfig: true,
|
||||||
|
skipOnWindows: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
t.Run(tc.desc, func(t *testing.T) {
|
t.Run(tc.desc, func(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if tc.skipOnWindows && goruntime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ExpandedDNSConfig, tc.expandedDNSConfig)()
|
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ExpandedDNSConfig, tc.expandedDNSConfig)()
|
||||||
testGetPodDNS(t)
|
testGetPodDNS(t)
|
||||||
})
|
})
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -117,6 +118,11 @@ func Test_ASW_RemovePlugin_Positive(t *testing.T) {
|
|||||||
// Verifies PluginExistsWithCorrectTimestamp returns false for an existing
|
// Verifies PluginExistsWithCorrectTimestamp returns false for an existing
|
||||||
// plugin with the wrong timestamp
|
// plugin with the wrong timestamp
|
||||||
func Test_ASW_PluginExistsWithCorrectTimestamp_Negative_WrongTimestamp(t *testing.T) {
|
func Test_ASW_PluginExistsWithCorrectTimestamp_Negative_WrongTimestamp(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
// First, add a plugin
|
// First, add a plugin
|
||||||
asw := NewActualStateOfWorld()
|
asw := NewActualStateOfWorld()
|
||||||
pluginInfo := PluginInfo{
|
pluginInfo := PluginInfo{
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -53,6 +54,11 @@ func Test_DSW_AddOrUpdatePlugin_Positive_NewPlugin(t *testing.T) {
|
|||||||
// Verifies the timestamp the existing plugin is updated
|
// Verifies the timestamp the existing plugin is updated
|
||||||
// Verifies newly added plugin returns true for PluginExists()
|
// Verifies newly added plugin returns true for PluginExists()
|
||||||
func Test_DSW_AddOrUpdatePlugin_Positive_ExistingPlugin(t *testing.T) {
|
func Test_DSW_AddOrUpdatePlugin_Positive_ExistingPlugin(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
dsw := NewDesiredStateOfWorld()
|
dsw := NewDesiredStateOfWorld()
|
||||||
socketPath := "/var/lib/kubelet/device-plugins/test-plugin.sock"
|
socketPath := "/var/lib/kubelet/device-plugins/test-plugin.sock"
|
||||||
// Adding the plugin for the first time
|
// Adding the plugin for the first time
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -167,6 +168,11 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
|
|||||||
// Calls Run()
|
// Calls Run()
|
||||||
// Verifies the actual state of world contains that plugin
|
// Verifies the actual state of world contains that plugin
|
||||||
func Test_Run_Positive_Register(t *testing.T) {
|
func Test_Run_Positive_Register(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
defer cleanup(t)
|
defer cleanup(t)
|
||||||
|
|
||||||
dsw := cache.NewDesiredStateOfWorld()
|
dsw := cache.NewDesiredStateOfWorld()
|
||||||
@ -212,6 +218,11 @@ func Test_Run_Positive_Register(t *testing.T) {
|
|||||||
// Deletes plugin from desired state of world.
|
// Deletes plugin from desired state of world.
|
||||||
// Verifies that plugin no longer exists in actual state of world.
|
// Verifies that plugin no longer exists in actual state of world.
|
||||||
func Test_Run_Positive_RegisterThenUnregister(t *testing.T) {
|
func Test_Run_Positive_RegisterThenUnregister(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
defer cleanup(t)
|
defer cleanup(t)
|
||||||
|
|
||||||
dsw := cache.NewDesiredStateOfWorld()
|
dsw := cache.NewDesiredStateOfWorld()
|
||||||
@ -268,6 +279,11 @@ func Test_Run_Positive_RegisterThenUnregister(t *testing.T) {
|
|||||||
// Verifies that the plugin is reregistered.
|
// Verifies that the plugin is reregistered.
|
||||||
// Verifies the plugin with updated timestamp now in actual state of world.
|
// Verifies the plugin with updated timestamp now in actual state of world.
|
||||||
func Test_Run_Positive_ReRegister(t *testing.T) {
|
func Test_Run_Positive_ReRegister(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
defer cleanup(t)
|
defer cleanup(t)
|
||||||
|
|
||||||
dsw := cache.NewDesiredStateOfWorld()
|
dsw := cache.NewDesiredStateOfWorld()
|
||||||
|
@ -18,6 +18,7 @@ package stats
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
@ -39,6 +40,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestFilterTerminatedContainerInfoAndAssembleByPodCgroupKey(t *testing.T) {
|
func TestFilterTerminatedContainerInfoAndAssembleByPodCgroupKey(t *testing.T) {
|
||||||
|
// Skip tests that fail on Windows, as discussed during the SIG Testing meeting from January 10, 2023
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
t.Skip("Skipping test that fails on Windows")
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
seedPastPod0Infra = 1000
|
seedPastPod0Infra = 1000
|
||||||
seedPastPod0Container0 = 2000
|
seedPastPod0Container0 = 2000
|
||||||
|
Loading…
Reference in New Issue
Block a user