Remove dead code used only in tests

This commit is contained in:
Maciej Szulik 2019-09-05 09:17:56 +02:00
parent 84fe3db5cf
commit eff4f79eda
No known key found for this signature in database
GPG Key ID: F15E55D276FA84C4
2 changed files with 2 additions and 31 deletions

View File

@ -122,8 +122,8 @@ type fileSpec struct {
} }
var ( var (
errFileSpecDoesntMatchFormat = errors.New("Filespec must match the canonical format: [[namespace/]pod:]file/path") errFileSpecDoesntMatchFormat = errors.New("filespec must match the canonical format: [[namespace/]pod:]file/path")
errFileCannotBeEmpty = errors.New("Filepath can not be empty") errFileCannotBeEmpty = errors.New("filepath can not be empty")
) )
func extractFileSpec(arg string) (fileSpec, error) { func extractFileSpec(arg string) (fileSpec, error) {

View File

@ -549,35 +549,6 @@ func TestBadTar(t *testing.T) {
} }
} }
// clean prevents path traversals by stripping them out.
// This is adapted from https://golang.org/src/net/http/fs.go#L74
func clean(fileName string) string {
return path.Clean(string(os.PathSeparator) + fileName)
}
func TestClean(t *testing.T) {
tests := []struct {
input string
cleaned string
}{
{
"../../../tmp/foo",
"/tmp/foo",
},
{
"/../../../tmp/foo",
"/tmp/foo",
},
}
for _, test := range tests {
out := clean(test.input)
if out != test.cleaned {
t.Errorf("Expected: %s, saw %s", test.cleaned, out)
}
}
}
func TestCopyToPod(t *testing.T) { func TestCopyToPod(t *testing.T) {
tf := cmdtesting.NewTestFactory().WithNamespace("test") tf := cmdtesting.NewTestFactory().WithNamespace("test")
ns := scheme.Codecs ns := scheme.Codecs