Merge pull request #114991 from TheOneTheOnlyJJ/skip-failing-unittests

Skip failing Windows unit tests
This commit is contained in:
Kubernetes Prow Robot 2023-01-25 22:02:25 -08:00 committed by GitHub
commit 083e0d2be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 110 additions and 37 deletions

View File

@ -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": {
ObjectMeta: metav1.ObjectMeta{
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 {
t.Run(k, func(t *testing.T) {
errs := ValidateCronJobCreate(&v, corevalidation.PodValidationOptions{})

View File

@ -20,6 +20,7 @@ import (
"fmt"
"path/filepath"
"reflect"
"runtime"
"testing"
"time"
@ -257,14 +258,20 @@ func TestFsStoreLoad(t *testing.T) {
uid types.UID
resourceVersion string
err string
skipOnWindows bool
}{
{"checkpoint exists", uid, resourceVersion, ""},
{"checkpoint does not exist", "bogus-uid", "bogus-resourceVersion", "no checkpoint for source"},
{"ambiguous UID", "", "bogus-resourceVersion", "empty UID is ambiguous"},
{"ambiguous ResourceVersion", "bogus-uid", "", "empty ResourceVersion is ambiguous"},
{"checkpoint exists", uid, resourceVersion, "", true},
{"checkpoint does not exist", "bogus-uid", "bogus-resourceVersion", "no checkpoint for source", false},
{"ambiguous UID", "", "bogus-resourceVersion", "empty UID is ambiguous", false},
{"ambiguous ResourceVersion", "bogus-uid", "", "empty ResourceVersion is ambiguous", false},
}
for _, c := range cases {
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{
ConfigMap: &apiv1.ConfigMapNodeConfigSource{
Name: "name",

View File

@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"path/filepath"
goruntime "runtime"
"testing"
apiequality "k8s.io/apimachinery/pkg/api/equality"
@ -38,11 +39,12 @@ const kubeletFile = "kubelet"
func TestLoad(t *testing.T) {
cases := []struct {
desc string
file *string
expect *kubeletconfig.KubeletConfiguration
err string
strictErr bool
desc string
file *string
expect *kubeletconfig.KubeletConfiguration
err string
strictErr bool
skipOnWindows bool
}{
// missing file
{
@ -93,12 +95,14 @@ func TestLoad(t *testing.T) {
desc: "default from yaml",
file: newString(`kind: KubeletConfiguration
apiVersion: kubelet.config.k8s.io/v1beta1`),
expect: newConfig(t),
expect: newConfig(t),
skipOnWindows: true,
},
{
desc: "default from json",
file: newString(`{"kind":"KubeletConfiguration","apiVersion":"kubelet.config.k8s.io/v1beta1"}`),
expect: newConfig(t),
desc: "default from json",
file: newString(`{"kind":"KubeletConfiguration","apiVersion":"kubelet.config.k8s.io/v1beta1"}`),
expect: newConfig(t),
skipOnWindows: true,
},
// relative path
@ -112,6 +116,7 @@ staticPodPath: %s`, relativePath)),
kc.StaticPodPath = filepath.Join(configDir, relativePath)
return kc
}(),
skipOnWindows: true,
},
{
desc: "json, relative path is resolved",
@ -121,6 +126,7 @@ staticPodPath: %s`, relativePath)),
kc.StaticPodPath = filepath.Join(configDir, relativePath)
return kc
}(),
skipOnWindows: true,
},
{
// This should fail from v1beta2+
@ -136,6 +142,7 @@ staticPodPath: %s/foo`, relativePath, relativePath)),
kc.StaticPodPath = filepath.Join(configDir, relativePath, "foo")
return kc
}(),
skipOnWindows: true,
},
{
// This should fail from v1beta2+
@ -145,12 +152,18 @@ apiVersion: kubelet.config.k8s.io/v1beta1
foo: bar`),
// err: "found unknown field: foo",
// strictErr: true,
expect: newConfig(t),
expect: newConfig(t),
skipOnWindows: true,
},
}
for _, c := range cases {
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.MkdirAll(configDir, 0777)
path := filepath.Join(configDir, kubeletFile)
@ -181,13 +194,14 @@ foo: bar`),
func TestResolveRelativePaths(t *testing.T) {
absolutePath := filepath.Join(configDir, "absolute")
cases := []struct {
desc string
path string
expect string
desc string
path string
expect string
skipOnWindows bool
}{
{"empty path", "", ""},
{"absolute path", absolutePath, absolutePath},
{"relative path", relativePath, filepath.Join(configDir, relativePath)},
{"empty path", "", "", false},
{"absolute path", absolutePath, absolutePath, true},
{"relative path", relativePath, filepath.Join(configDir, relativePath), false},
}
paths := kubeletconfig.KubeletConfigurationPathRefs(newConfig(t))
@ -196,6 +210,11 @@ func TestResolveRelativePaths(t *testing.T) {
}
for _, c := range cases {
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
*(paths[0]) = c.path
resolveRelativePaths(paths, configDir)

View File

@ -20,6 +20,7 @@ import (
"fmt"
"net"
"os"
goruntime "runtime"
"strconv"
"strings"
"testing"
@ -456,19 +457,26 @@ func TestGetPodDNS(t *testing.T) {
testCases := []struct {
desc string
expandedDNSConfig bool
skipOnWindows bool
}{
{
desc: "Not ExpandedDNSConfig",
expandedDNSConfig: false,
skipOnWindows: true,
},
{
desc: "ExpandedDNSConfig",
expandedDNSConfig: true,
skipOnWindows: true,
},
}
for _, tc := range testCases {
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)()
testGetPodDNS(t)
})

View File

@ -17,6 +17,7 @@ limitations under the License.
package cache
import (
"runtime"
"testing"
"time"
@ -117,6 +118,11 @@ func Test_ASW_RemovePlugin_Positive(t *testing.T) {
// Verifies PluginExistsWithCorrectTimestamp returns false for an existing
// plugin with the wrong timestamp
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
asw := NewActualStateOfWorld()
pluginInfo := PluginInfo{

View File

@ -17,6 +17,7 @@ limitations under the License.
package cache
import (
"runtime"
"testing"
"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 newly added plugin returns true for PluginExists()
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()
socketPath := "/var/lib/kubelet/device-plugins/test-plugin.sock"
// Adding the plugin for the first time

View File

@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"testing"
"time"
@ -167,6 +168,11 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
// Calls Run()
// Verifies the actual state of world contains that plugin
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)
dsw := cache.NewDesiredStateOfWorld()
@ -212,6 +218,11 @@ func Test_Run_Positive_Register(t *testing.T) {
// Deletes plugin from desired state of world.
// Verifies that plugin no longer exists in actual state of world.
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)
dsw := cache.NewDesiredStateOfWorld()
@ -268,6 +279,11 @@ func Test_Run_Positive_RegisterThenUnregister(t *testing.T) {
// Verifies that the plugin is reregistered.
// Verifies the plugin with updated timestamp now in actual state of world.
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)
dsw := cache.NewDesiredStateOfWorld()

View File

@ -18,6 +18,7 @@ package stats
import (
"context"
"runtime"
"testing"
"github.com/golang/mock/gomock"
@ -39,6 +40,11 @@ import (
)
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 (
seedPastPod0Infra = 1000
seedPastPod0Container0 = 2000