mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
bind filenames var instead of looking up
This commit is contained in:
@@ -26,6 +26,7 @@ func TestValidateArgs(t *testing.T) {
|
||||
|
||||
tests := []struct {
|
||||
flags map[string]string
|
||||
filenames []string
|
||||
args []string
|
||||
expectErr bool
|
||||
testName string
|
||||
@@ -41,11 +42,9 @@ func TestValidateArgs(t *testing.T) {
|
||||
testName: "no file, no image",
|
||||
},
|
||||
{
|
||||
flags: map[string]string{
|
||||
"filename": "bar.yaml",
|
||||
},
|
||||
args: []string{"foo"},
|
||||
testName: "valid file example",
|
||||
filenames: []string{"bar.yaml"},
|
||||
args: []string{"foo"},
|
||||
testName: "valid file example",
|
||||
},
|
||||
{
|
||||
flags: map[string]string{
|
||||
@@ -63,9 +62,9 @@ func TestValidateArgs(t *testing.T) {
|
||||
},
|
||||
{
|
||||
flags: map[string]string{
|
||||
"image": "foo:v2",
|
||||
"filename": "bar.yaml",
|
||||
"image": "foo:v2",
|
||||
},
|
||||
filenames: []string{"bar.yaml"},
|
||||
args: []string{"foo", "foo-v2"},
|
||||
expectErr: true,
|
||||
testName: "both filename and image example",
|
||||
@@ -80,7 +79,7 @@ func TestValidateArgs(t *testing.T) {
|
||||
cmd.Flags().Set(key, val)
|
||||
}
|
||||
}
|
||||
_, _, _, _, err := validateArguments(cmd, test.args)
|
||||
_, _, _, _, err := validateArguments(cmd, test.filenames, test.args)
|
||||
if err != nil && !test.expectErr {
|
||||
t.Errorf("unexpected error: %v (%s)", err, test.testName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user