mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +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)
|
||||
fSys, _ := makeTestDir(t)
|
||||
|
||||
root := getOSRoot(t)
|
||||
root, err := getOSRoot()
|
||||
req.NoError(err)
|
||||
d, f, err := fSys.CleanedAbs(root)
|
||||
req.NoError(err)
|
||||
req.Equal(root, d.String())
|
||||
@@ -122,7 +123,8 @@ func TestConfirmDirDisk(t *testing.T) {
|
||||
err = os.Symlink(filepath.Join(wd, relDir), linkDir)
|
||||
req.NoError(err)
|
||||
|
||||
root := getOSRoot(t)
|
||||
root, err := getOSRoot()
|
||||
req.NoError(err)
|
||||
tests := map[string]*struct {
|
||||
path string
|
||||
expected string
|
||||
|
||||
@@ -8,10 +8,8 @@ package filesys
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func getOSRoot(t *testing.T) string {
|
||||
t.Helper()
|
||||
return string(filepath.Separator)
|
||||
func getOSRoot() (string, error) {
|
||||
return string(filepath.Separator), nil
|
||||
}
|
||||
@@ -5,16 +5,14 @@ package filesys
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func getOSRoot(t *testing.T) string {
|
||||
t.Helper()
|
||||
|
||||
func getOSRoot() (string, error) {
|
||||
sysDir, err := windows.GetSystemDirectory()
|
||||
require.NoError(t, err)
|
||||
return filepath.VolumeName(sysDir) + `\`
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.VolumeName(sysDir) + `\`, nil
|
||||
}
|
||||
Reference in New Issue
Block a user