diff --git a/pkg/event/config.go b/pkg/event/config.go index b10a45d2b..5f5e6fea9 100644 --- a/pkg/event/config.go +++ b/pkg/event/config.go @@ -219,14 +219,13 @@ func (conf *Config) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { return err } - if len(parsedConfig.QueueList) == 0 { - return errors.New("missing queue configuration(s)") - } - - for i, q1 := range parsedConfig.QueueList[:len(parsedConfig.QueueList)-1] { - for _, q2 := range parsedConfig.QueueList[i+1:] { - if reflect.DeepEqual(q1, q2) { - return &ErrDuplicateQueueConfiguration{q1} + // Empty queue list means user wants to delete the notification configuration. + if len(parsedConfig.QueueList) > 0 { + for i, q1 := range parsedConfig.QueueList[:len(parsedConfig.QueueList)-1] { + for _, q2 := range parsedConfig.QueueList[i+1:] { + if reflect.DeepEqual(q1, q2) { + return &ErrDuplicateQueueConfiguration{q1} + } } } } @@ -278,10 +277,6 @@ func ParseConfig(reader io.Reader, region string, targetList *TargetList) (*Conf return nil, err } - if len(config.QueueList) == 0 { - return nil, errors.New("missing queue configuration(s)") - } - if err := config.Validate(region, targetList); err != nil { return nil, err } diff --git a/pkg/event/config_test.go b/pkg/event/config_test.go index 72b9e2436..52d84a08e 100644 --- a/pkg/event/config_test.go +++ b/pkg/event/config_test.go @@ -494,6 +494,9 @@ func TestConfigUnmarshalXML(t *testing.T) { `) + + dataCase5 := []byte(``) + testCases := []struct { data []byte expectErr bool @@ -502,6 +505,8 @@ func TestConfigUnmarshalXML(t *testing.T) { {dataCase2, false}, {dataCase3, false}, {dataCase4, true}, + // make sure we don't fail when queue is empty. + {dataCase5, false}, } for i, testCase := range testCases {