(t *testing.T)
| 50 | } |
| 51 | |
| 52 | func TestDeleteFlagValidation(t *testing.T) { |
| 53 | f := cmdtesting.NewTestFactory() |
| 54 | defer f.Cleanup() |
| 55 | |
| 56 | tests := []struct { |
| 57 | flags DeleteFlags |
| 58 | args [][]string |
| 59 | expectedErr string |
| 60 | }{ |
| 61 | { |
| 62 | flags: DeleteFlags{ |
| 63 | Raw: ptr.To("test"), |
| 64 | Interactive: ptr.To(true), |
| 65 | }, |
| 66 | expectedErr: "--interactive can not be used with --raw", |
| 67 | }, |
| 68 | } |
| 69 | |
| 70 | for _, test := range tests { |
| 71 | cmd := fakecmd() |
| 72 | deleteOptions, err := test.flags.ToOptions(nil, genericiooptions.NewTestIOStreamsDiscard()) |
| 73 | if err != nil { |
| 74 | t.Fatalf("unexpected error creating delete options: %s", err) |
| 75 | } |
| 76 | deleteOptions.Filenames = []string{"../../../testdata/redis-master-controller.yaml"} |
| 77 | err = deleteOptions.Complete(f, nil, cmd) |
| 78 | if err != nil { |
| 79 | t.Fatalf("unexpected error creating delete options: %s", err) |
| 80 | } |
| 81 | err = deleteOptions.Validate() |
| 82 | if err == nil { |
| 83 | t.Fatalf("missing expected error") |
| 84 | } |
| 85 | if test.expectedErr != err.Error() { |
| 86 | t.Errorf("expected error %s, got %s", test.expectedErr, err) |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | func TestDeleteObjectByTuple(t *testing.T) { |
| 92 | cmdtesting.InitTestErrorHandler(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…