mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 17:52:12 +00:00
prevent testing lib from being compiled in (#4742)
* remove testing dep from fsondisk * code review
This commit is contained in:
@@ -58,7 +58,8 @@ func TestCleanedAbs_2(t *testing.T) {
|
|||||||
req := require.New(t)
|
req := require.New(t)
|
||||||
fSys, _ := makeTestDir(t)
|
fSys, _ := makeTestDir(t)
|
||||||
|
|
||||||
root := getOSRoot(t)
|
root, err := getOSRoot()
|
||||||
|
req.NoError(err)
|
||||||
d, f, err := fSys.CleanedAbs(root)
|
d, f, err := fSys.CleanedAbs(root)
|
||||||
req.NoError(err)
|
req.NoError(err)
|
||||||
req.Equal(root, d.String())
|
req.Equal(root, d.String())
|
||||||
@@ -122,7 +123,8 @@ func TestConfirmDirDisk(t *testing.T) {
|
|||||||
err = os.Symlink(filepath.Join(wd, relDir), linkDir)
|
err = os.Symlink(filepath.Join(wd, relDir), linkDir)
|
||||||
req.NoError(err)
|
req.NoError(err)
|
||||||
|
|
||||||
root := getOSRoot(t)
|
root, err := getOSRoot()
|
||||||
|
req.NoError(err)
|
||||||
tests := map[string]*struct {
|
tests := map[string]*struct {
|
||||||
path string
|
path string
|
||||||
expected string
|
expected string
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ package filesys
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func getOSRoot(t *testing.T) string {
|
func getOSRoot() (string, error) {
|
||||||
t.Helper()
|
return string(filepath.Separator), nil
|
||||||
return string(filepath.Separator)
|
|
||||||
}
|
}
|
||||||
@@ -5,16 +5,14 @@ package filesys
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getOSRoot(t *testing.T) string {
|
func getOSRoot() (string, error) {
|
||||||
t.Helper()
|
|
||||||
|
|
||||||
sysDir, err := windows.GetSystemDirectory()
|
sysDir, err := windows.GetSystemDirectory()
|
||||||
require.NoError(t, err)
|
if err != nil {
|
||||||
return filepath.VolumeName(sysDir) + `\`
|
return "", err
|
||||||
|
}
|
||||||
|
return filepath.VolumeName(sysDir) + `\`, nil
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user