Skip to content

Commit 4ff40d9

Browse files
author
Heeyoung Jung
committed
fix unit-test: reset heartbeatCallCount each test
1 parent 4bcb916 commit 4ff40d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/monitor/sqsevent/sqs-monitor_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,8 @@ func TestMonitor_InstanceNotManaged(t *testing.T) {
908908
}
909909

910910
func TestSendHeartbeats_EarlyClosure(t *testing.T) {
911+
h.HeartbeatCallCount = 0
912+
911913
asgMock := h.MockedASG{
912914
RecordLifecycleActionHeartbeatResp: autoscaling.RecordLifecycleActionHeartbeatOutput{},
913915
RecordLifecycleActionHeartbeatErr: nil,
@@ -937,6 +939,8 @@ func TestSendHeartbeats_EarlyClosure(t *testing.T) {
937939
}
938940

939941
func TestSendHeartbeats_NormalClosure(t *testing.T) {
942+
h.HeartbeatCallCount = 0
943+
940944
asgMock := h.MockedASG{
941945
RecordLifecycleActionHeartbeatResp: autoscaling.RecordLifecycleActionHeartbeatOutput{},
942946
RecordLifecycleActionHeartbeatErr: nil,
@@ -966,6 +970,8 @@ func TestSendHeartbeats_NormalClosure(t *testing.T) {
966970
}
967971

968972
func TestSendHeartbeats_ErrThrottlingASG(t *testing.T) {
973+
h.HeartbeatCallCount = 0
974+
969975
asgMock := h.MockedASG{
970976
RecordLifecycleActionHeartbeatResp: autoscaling.RecordLifecycleActionHeartbeatOutput{},
971977
RecordLifecycleActionHeartbeatErr: awserr.New("ThrottlingException", "Rate exceeded", nil),
@@ -995,6 +1001,8 @@ func TestSendHeartbeats_ErrThrottlingASG(t *testing.T) {
9951001
}
9961002

9971003
func TestSendHeartbeats_ErrInvalidTarget(t *testing.T) {
1004+
h.HeartbeatCallCount = 0
1005+
9981006
asgMock := h.MockedASG{
9991007
RecordLifecycleActionHeartbeatResp: autoscaling.RecordLifecycleActionHeartbeatOutput{},
10001008
RecordLifecycleActionHeartbeatErr: awserr.New("ValidationError", "No active Lifecycle Action found", nil),

0 commit comments

Comments
 (0)