|
|
|
@ -27,12 +27,12 @@ func TestResourceDeleteInvalidArgs(t *testing.T) {
|
|
|
|
|
"nil args": {
|
|
|
|
|
args: nil,
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("Your argument format is incorrect: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
},
|
|
|
|
|
"empty args": {
|
|
|
|
|
args: []string{},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("Your argument format is incorrect: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
},
|
|
|
|
|
"missing file path": {
|
|
|
|
|
args: []string{"-f"},
|
|
|
|
@ -47,27 +47,27 @@ func TestResourceDeleteInvalidArgs(t *testing.T) {
|
|
|
|
|
"provide type and name": {
|
|
|
|
|
args: []string{"a.b.c"},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("Your argument format is incorrect: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: Must specify two arguments: resource type and resource name"),
|
|
|
|
|
},
|
|
|
|
|
"provide type and name with -f": {
|
|
|
|
|
args: []string{"a.b.c", "name", "-f", "test.hcl"},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("We ignored the -f flag if you provide gvk and resource name"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: File argument is not needed when resource information is provided with the command"),
|
|
|
|
|
},
|
|
|
|
|
"provide type and name with -f and other flags": {
|
|
|
|
|
args: []string{"a.b.c", "name", "-f", "test.hcl", "-namespace", "default"},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("We ignored the -f flag if you provide gvk and resource name"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: File argument is not needed when resource information is provided with the command"),
|
|
|
|
|
},
|
|
|
|
|
"does not provide resource name after type": {
|
|
|
|
|
args: []string{"a.b.c", "-namespace", "default"},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("Your argument format is incorrect: Must provide resource name right after type"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: Must provide resource name right after type"),
|
|
|
|
|
},
|
|
|
|
|
"invalid resource type format": {
|
|
|
|
|
args: []string{"a.", "name", "-namespace", "default"},
|
|
|
|
|
expectedCode: 1,
|
|
|
|
|
expectedErr: errors.New("Your argument format is incorrect: Must include resource type argument in group.verion.kind format"),
|
|
|
|
|
expectedErr: errors.New("Incorrect argument format: Must include resource type argument in group.verion.kind format"),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|