Skip to content

Commit dda3d7f

Browse files
authored
Fix canary test goconst lint (#193)
1 parent 1dab322 commit dda3d7f

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

pkg/deployer/canary_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import (
2929
"github.com/DevopsArtFactory/goployer/pkg/schemas"
3030
)
3131

32+
const testCanaryASGName = "demo-canary-v002"
33+
3234
func TestCheckCanaryVersion(t *testing.T) {
3335
region := constants.DefaultRegion
3436
regionShard := strings.ReplaceAll(region, "-", "")
@@ -127,12 +129,12 @@ func TestShouldRollbackCanary(t *testing.T) {
127129
func TestCanaryAutoScalingGroupNamePrefersActiveDeployment(t *testing.T) {
128130
c := Canary{
129131
Deployer: &Deployer{
130-
AsgNames: map[string]string{constants.DefaultRegion: "demo-canary-v002"},
132+
AsgNames: map[string]string{constants.DefaultRegion: testCanaryASGName},
131133
LatestAsg: map[string]string{constants.DefaultRegion: "demo-stable-v001"},
132134
},
133135
}
134136

135-
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != "demo-canary-v002" {
137+
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != testCanaryASGName {
136138
t.Fatalf("expected active canary ASG, got %s", got)
137139
}
138140
}
@@ -141,23 +143,23 @@ func TestCanaryAutoScalingGroupNameFallsBackToLatestWithEmptyActiveMap(t *testin
141143
c := Canary{
142144
Deployer: &Deployer{
143145
AsgNames: map[string]string{},
144-
LatestAsg: map[string]string{constants.DefaultRegion: "demo-canary-v002"},
146+
LatestAsg: map[string]string{constants.DefaultRegion: testCanaryASGName},
145147
},
146148
}
147149

148-
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != "demo-canary-v002" {
150+
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != testCanaryASGName {
149151
t.Fatalf("expected latest ASG fallback, got %s", got)
150152
}
151153
}
152154

153155
func TestCanaryAutoScalingGroupNameFallsBackToLatestWithNilActiveMap(t *testing.T) {
154156
c := Canary{
155157
Deployer: &Deployer{
156-
LatestAsg: map[string]string{constants.DefaultRegion: "demo-canary-v002"},
158+
LatestAsg: map[string]string{constants.DefaultRegion: testCanaryASGName},
157159
},
158160
}
159161

160-
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != "demo-canary-v002" {
162+
if got := c.CanaryAutoScalingGroupName(constants.DefaultRegion); got != testCanaryASGName {
161163
t.Fatalf("expected latest ASG fallback, got %s", got)
162164
}
163165
}

0 commit comments

Comments
 (0)