Skip to content

Commit 2048e92

Browse files
authored
delete test notification (#644)
1 parent 64b92b3 commit 2048e92

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

THIRD_PARTY_LICENSES

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4084,4 +4084,48 @@ The above copyright notice and this permission notice shall be included in all c
40844084

40854085
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40864086
------
4087+
** go.uber.org/multierr; version v1.7.0 --
40874088

4089+
4090+
Copyright (c) 2017-2021 Uber Technologies, Inc.
4091+
4092+
Permission is hereby granted, free of charge, to any person obtaining a copy
4093+
of this software and associated documentation files (the "Software"), to deal
4094+
in the Software without restriction, including without limitation the rights
4095+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4096+
copies of the Software, and to permit persons to whom the Software is
4097+
furnished to do so, subject to the following conditions:
4098+
4099+
The above copyright notice and this permission notice shall be included in
4100+
all copies or substantial portions of the Software.
4101+
4102+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4103+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4104+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4105+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4106+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4107+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4108+
THE SOFTWARE.
4109+
------
4110+
** go.uber.org/atomic; version v1.7.0 --
4111+
4112+
4113+
Copyright (c) 2016 Uber Technologies, Inc.
4114+
4115+
Permission is hereby granted, free of charge, to any person obtaining a copy
4116+
of this software and associated documentation files (the "Software"), to deal
4117+
in the Software without restriction, including without limitation the rights
4118+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4119+
copies of the Software, and to permit persons to whom the Software is
4120+
furnished to do so, subject to the following conditions:
4121+
4122+
The above copyright notice and this permission notice shall be included in
4123+
all copies or substantial portions of the Software.
4124+
4125+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4126+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4127+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4128+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4129+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4130+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4131+
THE SOFTWARE.

pkg/monitor/sqsevent/sqs-monitor.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ import (
2727
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
2828
"github.com/aws/aws-sdk-go/service/sqs"
2929
"github.com/aws/aws-sdk-go/service/sqs/sqsiface"
30+
3031
"github.com/rs/zerolog/log"
32+
33+
"go.uber.org/multierr"
3134
)
3235

3336
const (
@@ -137,8 +140,11 @@ func (m SQSMonitor) processLifecycleEventFromASG(message *sqs.Message) (EventBri
137140
return eventBridgeEvent, err
138141

139142
case lifecycleEvent.Event == TEST_NOTIFICATION || lifecycleEvent.LifecycleTransition == TEST_NOTIFICATION:
140-
log.Warn().Msg("ignoring ASG test notification")
141-
return eventBridgeEvent, skip{fmt.Errorf("message is a test notification")}
143+
err := fmt.Errorf("message is a test notification")
144+
if errs := m.deleteMessages([]*sqs.Message{message}); errs != nil {
145+
err = multierr.Append(err, errs[0])
146+
}
147+
return eventBridgeEvent, skip{err}
142148

143149
case lifecycleEvent.LifecycleTransition != "autoscaling:EC2_INSTANCE_TERMINATING":
144150
log.Err(err).Msg("only lifecycle termination events from ASG to SQS are supported outside EventBridge")

0 commit comments

Comments
 (0)