(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestValidateActionNegatives(t *testing.T) { |
| 72 | tsts := []struct { |
| 73 | Name string |
| 74 | Action Action |
| 75 | WantErrString string |
| 76 | }{ |
| 77 | {"emptyKind", Action{}, "invalid rule action kind"}, |
| 78 | {"invalidKind", Action{Kind: ActionKind("something else")}, "invalid rule action kind"}, |
| 79 | } |
| 80 | for _, tst := range tsts { |
| 81 | t.Run(tst.Name, func(t *testing.T) { |
| 82 | errs := validateAction(&tst.Action) |
| 83 | var foundErr error |
| 84 | for _, err := range errs { |
| 85 | t.Logf("Got error %#v", err) |
| 86 | if strings.Contains(err.Error(), tst.WantErrString) { |
| 87 | foundErr = err |
| 88 | } |
| 89 | } |
| 90 | if foundErr == nil { |
| 91 | t.Errorf("errs: got %#v, want containing %q", errs, tst.WantErrString) |
| 92 | } |
| 93 | }) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func TestValidateActionPositives(t *testing.T) { |
| 98 | tsts := []struct { |
nothing calls this directly
no test coverage detected