Don't return error on '*' for ID keys.
Fixes a test failure that a previous commit introduced.
Refs
@@ -8,15 +8,15 @@ import (
// Validate returns an error if the CheckName and Subscription fields are not
// provided.
func (s *Silenced) Validate() error {
- if s.Subscription == "" && s.Check == "" {
+ if (s.Subscription == "" && s.Check == "") || (s.Subscription == "*" && s.Check == "*") {
return errors.New("must provide check or subscription")
}
- if s.Subscription != "" {
+ if s.Subscription != "" && s.Subscription != "*" {
if err := ValidateName(s.Subscription); err != nil {
return fmt.Errorf("Subscription %s", err)
}
}
- if s.Check != "" {
+ if s.Check != "" && s.Check != "*" {
if err := ValidateName(s.Check); err != nil {
return fmt.Errorf("Check %s", err)
}
