Skip to content

Commit e239ce3

Browse files
authored
test: fix failing tests (#2606)
<!-- Provide summary of changes --> Found another typo in the customized env test. Also found a spot in multiple envs that was not updated. Fixed all the template integ tests. <!-- Issue number, if available. E.g. "Fixes #31", "Addresses #42, 77" --> By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent e070b5f commit e239ce3

File tree

4 files changed

+31
-12
lines changed

4 files changed

+31
-12
lines changed

e2e/customized-env/customized_env_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ environments:
233233
for _, sd := range svc.ServiceDiscoveries {
234234
envs = append(envs, sd.Environment[0])
235235
namespaces = append(namespaces, sd.Namespace)
236-
wantedNamespaces = append(wantedNamespaces, fmt.Sprintf("%s.%s.%s.local:80", svc.SvcName, sd.Environment, appName))
236+
wantedNamespaces = append(wantedNamespaces, fmt.Sprintf("%s.%s.%s.local:80", svc.SvcName, sd.Environment[0], appName))
237237
}
238238
Expect(envs).To(ConsistOf("test", "prod", "shared"))
239239
Expect(namespaces).To(ConsistOf(wantedNamespaces))

e2e/multi-env-app/multi_env_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,15 @@ var _ = Describe("Multiple Env App", func() {
171171
envRoutes[route.Environment] = route
172172
}
173173

174-
Expect(len(svc.ServiceDiscoveries)).To(Equal(1))
175-
Expect(svc.ServiceDiscoveries[0].Environment).To(ConsistOf("test", "prod"))
176-
Expect(svc.ServiceDiscoveries[0].Namespace).To(Equal(fmt.Sprintf("%s.%s.local:80", svc.SvcName, appName)))
174+
Expect(len(svc.ServiceDiscoveries)).To(Equal(2))
175+
var envs, namespaces, wantedNamespaces []string
176+
for _, sd := range svc.ServiceDiscoveries {
177+
envs = append(envs, sd.Environment[0])
178+
namespaces = append(namespaces, sd.Namespace)
179+
wantedNamespaces = append(wantedNamespaces, fmt.Sprintf("%s.%s.%s.local:80", svc.SvcName, sd.Environment[0], appName))
180+
}
181+
Expect(envs).To(ConsistOf("test", "prod"))
182+
Expect(namespaces).To(ConsistOf(wantedNamespaces))
177183

178184
// Call each environment's endpoint and ensure it returns a 200
179185
for _, env := range []string{"test", "prod"} {

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,7 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f
13251325
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
13261326
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
13271327
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
1328+
golang.org/x/tools v0.1.2 h1:kRBLX7v7Af8W7Gdbbc908OJcdgtK8bOz9Uaj8/F1ACA=
13281329
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
13291330
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
13301331
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/pkg/template/template_integration_test.go

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
2020
opts template.WorkloadOpts
2121
}{
2222
"renders a valid template by default": {
23-
opts: template.WorkloadOpts{},
23+
opts: template.WorkloadOpts{
24+
ServiceDiscoveryEndpoint: "test.app.local"},
2425
},
2526
"renders with timeout and no retries": {
2627
opts: template.WorkloadOpts{
2728
StateMachine: &template.StateMachineOpts{
2829
Timeout: aws.Int(3600),
2930
},
31+
ServiceDiscoveryEndpoint: "test.app.local",
3032
},
3133
},
3234
"renders with options": {
@@ -35,6 +37,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
3537
Retries: aws.Int(5),
3638
Timeout: aws.Int(3600),
3739
},
40+
ServiceDiscoveryEndpoint: "test.app.local",
3841
},
3942
},
4043
"renders with options and addons": {
@@ -48,6 +51,7 @@ func TestTemplate_ParseScheduledJob(t *testing.T) {
4851
SecretOutputs: []string{"TablePassword"},
4952
PolicyOutputs: []string{"TablePolicy"},
5053
},
54+
ServiceDiscoveryEndpoint: "test.app.local",
5155
},
5256
},
5357
}
@@ -81,7 +85,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
8185
}{
8286
"renders a valid template by default": {
8387
opts: template.WorkloadOpts{
84-
HTTPHealthCheck: defaultHttpHealthCheck,
88+
HTTPHealthCheck: defaultHttpHealthCheck,
89+
ServiceDiscoveryEndpoint: "test.app.local",
8590
},
8691
},
8792
"renders a valid template with addons with no outputs": {
@@ -90,6 +95,7 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
9095
NestedStack: &template.WorkloadNestedStackOpts{
9196
StackName: "AddonsStack",
9297
},
98+
ServiceDiscoveryEndpoint: "test.app.local",
9399
},
94100
},
95101
"renders a valid template with addons with outputs": {
@@ -101,6 +107,7 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
101107
SecretOutputs: []string{"TablePassword"},
102108
PolicyOutputs: []string{"TablePolicy"},
103109
},
110+
ServiceDiscoveryEndpoint: "test.app.local",
104111
},
105112
},
106113
"renders a valid template with private subnet placement": {
@@ -110,11 +117,13 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
110117
AssignPublicIP: "DISABLED",
111118
SubnetsType: "PrivateSubnets",
112119
},
120+
ServiceDiscoveryEndpoint: "test.app.local",
113121
},
114122
},
115123
"renders a valid template with all storage options": {
116124
opts: template.WorkloadOpts{
117-
HTTPHealthCheck: defaultHttpHealthCheck,
125+
HTTPHealthCheck: defaultHttpHealthCheck,
126+
ServiceDiscoveryEndpoint: "test.app.local",
118127
Storage: &template.StorageOpts{
119128
Ephemeral: aws.Int(500),
120129
EFSPerms: []*template.EFSPermission{
@@ -147,7 +156,8 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
147156
},
148157
"renders a valid template with minimal storage options": {
149158
opts: template.WorkloadOpts{
150-
HTTPHealthCheck: defaultHttpHealthCheck,
159+
HTTPHealthCheck: defaultHttpHealthCheck,
160+
ServiceDiscoveryEndpoint: "test.app.local",
151161
Storage: &template.StorageOpts{
152162
EFSPerms: []*template.EFSPermission{
153163
{
@@ -175,17 +185,19 @@ func TestTemplate_ParseLoadBalancedWebService(t *testing.T) {
175185
},
176186
"renders a valid template with ephemeral storage": {
177187
opts: template.WorkloadOpts{
178-
HTTPHealthCheck: defaultHttpHealthCheck,
188+
HTTPHealthCheck: defaultHttpHealthCheck,
189+
ServiceDiscoveryEndpoint: "test.app.local",
179190
Storage: &template.StorageOpts{
180191
Ephemeral: aws.Int(500),
181192
},
182193
},
183194
},
184195
"renders a valid template with entrypoint and command overrides": {
185196
opts: template.WorkloadOpts{
186-
HTTPHealthCheck: defaultHttpHealthCheck,
187-
EntryPoint: []string{"/bin/echo", "hello"},
188-
Command: []string{"world"},
197+
HTTPHealthCheck: defaultHttpHealthCheck,
198+
EntryPoint: []string{"/bin/echo", "hello"},
199+
Command: []string{"world"},
200+
ServiceDiscoveryEndpoint: "test.app.local",
189201
},
190202
},
191203
}

0 commit comments

Comments
 (0)