skip tests not relevant for windows

pull/21449/head
Predrag Rogic 2025-08-13 01:42:41 +01:00 committed by Medya Ghazizadeh
parent ee80ebace2
commit 81a9a111d2
2 changed files with 14 additions and 14 deletions

View File

@ -17,10 +17,12 @@ limitations under the License.
package common
import (
"os"
"path/filepath"
"testing"
)
const testISOPath = "testdata/test.iso"
var testISOPath = filepath.Join("testdata", "test.iso")
func TestExtractFile(t *testing.T) {
testDir := t.TempDir()
@ -35,29 +37,29 @@ func TestExtractFile(t *testing.T) {
{
name: "all is right",
isoPath: testISOPath,
srcPath: "/test1.txt",
destPath: testDir + "/test1.txt",
srcPath: string(os.PathSeparator) + "test1.txt",
destPath: filepath.Join(testDir, "test1.txt"),
expectedError: false,
},
{
name: "isoPath is error",
isoPath: "testdata/missing.iso",
srcPath: "/test1.txt",
destPath: testDir + "/test1.txt",
isoPath: filepath.Join("testdata", "missing.iso"),
srcPath: string(os.PathSeparator) + "test1.txt",
destPath: filepath.Join(testDir, "test1.txt"),
expectedError: true,
},
{
name: "srcPath is empty",
isoPath: testISOPath,
srcPath: "",
destPath: testDir + "/test1.txt",
destPath: filepath.Join(testDir, "test1.txt"),
expectedError: true,
},
{
name: "srcPath is error",
isoPath: testISOPath,
srcPath: "/t1.txt",
destPath: testDir + "/test1.txt",
destPath: filepath.Join(testDir, "test1.txt"),
expectedError: true,
},
{
@ -70,8 +72,8 @@ func TestExtractFile(t *testing.T) {
{
name: "find files in a folder",
isoPath: testISOPath,
srcPath: "/test2/test2.txt",
destPath: testDir + "/test2.txt",
srcPath: string(os.PathSeparator) + filepath.Join("test2", "test2.txt"),
destPath: filepath.Join(testDir, "test2.txt"),
expectedError: false,
},
}

View File

@ -1,3 +1,5 @@
//go:build !windows
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
@ -81,10 +83,6 @@ func TestParseKubernetesVersion(t *testing.T) {
}
func TestChownR(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("skipping on windows")
}
testDir := t.TempDir()
if _, err := os.Create(testDir + "/TestChownR"); err != nil {
return