Empty actions are now allowed

This commit is contained in:
Till Faelligen 2023-10-24 10:43:23 +02:00
parent 5ced1a11e7
commit 6abc40a896
No known key found for this signature in database
GPG key ID: ACCDC9606D472758
2 changed files with 0 additions and 4 deletions

View file

@ -18,9 +18,6 @@ func ValidateRule(kind Kind, rule *Rule) []error {
errs = append(errs, fmt.Errorf("invalid rule ID: %s", rule.RuleID))
}
if len(rule.Actions) == 0 {
errs = append(errs, fmt.Errorf("missing actions"))
}
for _, action := range rule.Actions {
errs = append(errs, validateAction(action)...)
}

View file

@ -15,7 +15,6 @@ func TestValidateRuleNegatives(t *testing.T) {
{Name: "emptyRuleID", Kind: OverrideKind, Rule: Rule{}, WantErrString: "invalid rule ID"},
{Name: "invalidKind", Kind: Kind("something else"), Rule: Rule{}, WantErrString: "invalid rule kind"},
{Name: "ruleIDBackslash", Kind: OverrideKind, Rule: Rule{RuleID: "#foo\\:example.com"}, WantErrString: "invalid rule ID"},
{Name: "noActions", Kind: OverrideKind, Rule: Rule{}, WantErrString: "missing actions"},
{Name: "invalidAction", Kind: OverrideKind, Rule: Rule{Actions: []*Action{{}}}, WantErrString: "invalid rule action kind"},
{Name: "invalidCondition", Kind: OverrideKind, Rule: Rule{Conditions: []*Condition{{}}}, WantErrString: "invalid rule condition kind"},
{Name: "overrideNoCondition", Kind: OverrideKind, Rule: Rule{}, WantErrString: "missing rule conditions"},