(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestLocalCmdArgValidation(t *testing.T) { |
| 11 | cases := []struct { |
| 12 | name string |
| 13 | args []string |
| 14 | expectError bool |
| 15 | }{ |
| 16 | { |
| 17 | name: "no arguments", |
| 18 | args: []string{}, |
| 19 | expectError: true, |
| 20 | }, |
| 21 | { |
| 22 | name: "one argument", |
| 23 | args: []string{"chart1"}, |
| 24 | expectError: true, |
| 25 | }, |
| 26 | { |
| 27 | name: "three arguments", |
| 28 | args: []string{"chart1", "chart2", "chart3"}, |
| 29 | expectError: true, |
| 30 | }, |
| 31 | } |
| 32 | |
| 33 | for _, tc := range cases { |
| 34 | t.Run(tc.name, func(t *testing.T) { |
| 35 | cmd := localCmd() |
| 36 | cmd.SetArgs(tc.args) |
| 37 | err := cmd.Execute() |
| 38 | |
| 39 | if tc.expectError && err == nil { |
| 40 | t.Errorf("Expected error but got none") |
| 41 | } |
| 42 | if !tc.expectError && err != nil { |
| 43 | t.Errorf("Expected no error but got: %v", err) |
| 44 | } |
| 45 | }) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestLocalCmdExecution(t *testing.T) { |
| 50 | manifestYAML := `--- |
nothing calls this directly
no test coverage detected