(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestValidateConditionNegatives(t *testing.T) { |
| 119 | tsts := []struct { |
| 120 | Name string |
| 121 | Condition Condition |
| 122 | WantErrString string |
| 123 | }{ |
| 124 | {"emptyKind", Condition{}, "invalid rule condition kind"}, |
| 125 | {"invalidKind", Condition{Kind: ConditionKind("something else")}, "invalid rule condition kind"}, |
| 126 | } |
| 127 | for _, tst := range tsts { |
| 128 | t.Run(tst.Name, func(t *testing.T) { |
| 129 | errs := validateCondition(&tst.Condition) |
| 130 | var foundErr error |
| 131 | for _, err := range errs { |
| 132 | t.Logf("Got error %#v", err) |
| 133 | if strings.Contains(err.Error(), tst.WantErrString) { |
| 134 | foundErr = err |
| 135 | } |
| 136 | } |
| 137 | if foundErr == nil { |
| 138 | t.Errorf("errs: got %#v, want containing %q", errs, tst.WantErrString) |
| 139 | } |
| 140 | }) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | func TestValidateConditionPositives(t *testing.T) { |
| 145 | tsts := []struct { |
nothing calls this directly
no test coverage detected