Skip to content

Commit 1aa06f1

Browse files
committed
test(e2e): Improve universal app run
Rely on constant ssh connection and make things easier to get report out Signed-off-by: Charly Molter <[email protected]>
1 parent 7ef81f9 commit 1aa06f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+616
-688
lines changed

pkg/core/tokens/issuer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ func (j *jwtTokenIssuer) Generate(ctx context.Context, claims Claims, validFor t
3737
return "", err
3838
}
3939

40-
now := core.Now()
40+
now := core.Now().Add(-5 * time.Minute) // todo(jakubdyszkiewicz) parametrize via config and go through all clock skews in the project
4141
claims.SetRegisteredClaims(jwt.RegisteredClaims{
4242
ID: core.NewUUID(),
4343
IssuedAt: jwt.NewNumericDate(now),
44-
NotBefore: jwt.NewNumericDate(now.Add(time.Minute * -5)), // todo(jakubdyszkiewicz) parametrize via config and go through all clock skews in the project
45-
ExpiresAt: jwt.NewNumericDate(now.Add(validFor)),
44+
NotBefore: jwt.NewNumericDate(now),
45+
ExpiresAt: jwt.NewNumericDate(now.Add(validFor).Add(time.Minute)),
4646
})
4747

4848
token := jwt.NewWithClaims(jwt.SigningMethodRS256, claims)

test/dockerfiles/universal.dockerignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
!build/artifacts-linux-arm64/kumactl/kumactl
1212
!build/artifacts-linux-arm64/coredns/coredns
1313
!build/artifacts-linux-arm64/test-server/test-server
14-
!build/artifacts-darwin-arm64/kuma-cp/kuma-cp
15-
!build/artifacts-darwin-arm64/kuma-dp/kuma-dp
16-
!build/artifacts-darwin-arm64/envoy/*
17-
!build/artifacts-darwin-arm64/kumactl/kumactl
18-
!build/artifacts-darwin-arm64/coredns/coredns
19-
!build/artifacts-darwin-arm64/test-server/test-server
2014
!pkg/config/app/kuma-cp/kuma-cp.defaults.yaml
2115
!tools/releases/templates/LICENSE
2216
!tools/releases/templates/NOTICE

test/e2e_env/multizone/externalservices/externalservices_multizone_universal.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,42 +155,42 @@ routing:
155155
Expect(err).ToNot(HaveOccurred())
156156

157157
Eventually(func(g Gomega) {
158-
stdout, _, err := client.CollectResponse(
158+
stdout, stderr, err := client.CollectResponse(
159159
zone1, "demo-client", "external-service-1.mesh",
160160
client.WithVerbose(),
161161
)
162162
g.Expect(err).ToNot(HaveOccurred())
163-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
163+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
164164
g.Expect(stdout).ToNot(ContainSubstring("HTTPS"))
165165
}, "1m", "3s").Should(Succeed())
166166

167167
Eventually(func(g Gomega) {
168-
stdout, _, err := client.CollectResponse(
168+
stdout, stderr, err := client.CollectResponse(
169169
zone1, "demo-client", "kuma-es-4_es-http:80",
170170
client.WithVerbose(),
171171
)
172172
g.Expect(err).ToNot(HaveOccurred())
173-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
173+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
174174
g.Expect(stdout).ToNot(ContainSubstring("HTTPS"))
175175
}, "1m", "3s").Should(Succeed())
176176

177177
Eventually(func(g Gomega) {
178-
stdout, _, err := client.CollectResponse(
178+
stdout, stderr, err := client.CollectResponse(
179179
zone2, "demo-client", "external-service-1.mesh",
180180
client.WithVerbose(),
181181
)
182182
g.Expect(err).ToNot(HaveOccurred())
183-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
183+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
184184
g.Expect(stdout).ToNot(ContainSubstring("HTTPS"))
185185
}, "1m", "3s").Should(Succeed())
186186

187187
Eventually(func(g Gomega) {
188-
stdout, _, err := client.CollectResponse(
188+
stdout, stderr, err := client.CollectResponse(
189189
zone2, "demo-client", "kuma-es-4_es-http:80",
190190
client.WithVerbose(),
191191
)
192192
g.Expect(err).ToNot(HaveOccurred())
193-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
193+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
194194
g.Expect(stdout).ToNot(ContainSubstring("HTTPS"))
195195
}, "1m", "3s").Should(Succeed())
196196
})
@@ -219,22 +219,22 @@ routing:
219219

220220
// then accessing the secured external service succeeds
221221
Eventually(func(g Gomega) {
222-
stdout, _, err := client.CollectResponse(
222+
stdout, stderr, err := client.CollectResponse(
223223
zone1, "demo-client", "http://kuma-es-4_es-https:443",
224224
client.WithVerbose(),
225225
)
226226
g.Expect(err).ToNot(HaveOccurred())
227-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
227+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
228228
g.Expect(stdout).To(ContainSubstring("es-https"))
229229
}, "1m", "1s").Should(Succeed())
230230

231231
Eventually(func(g Gomega) {
232-
stdout, _, err := client.CollectResponse(
232+
stdout, stderr, err := client.CollectResponse(
233233
zone2, "demo-client", "http://kuma-es-4_es-https:443",
234234
client.WithVerbose(),
235235
)
236236
g.Expect(err).ToNot(HaveOccurred())
237-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
237+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
238238
g.Expect(stdout).To(ContainSubstring("es-https"))
239239
}, "1m", "3s").Should(Succeed())
240240
})

test/e2e_env/multizone/ownership/ownership.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,11 @@ func MultizoneUniversal() {
6262
}
6363

6464
killKumaDP := func(appname string) {
65-
_, _, err := zoneUniversal.Exec("", "", appname, "pkill", "-9", "envoy")
66-
Expect(err).ToNot(HaveOccurred())
65+
Expect(zoneUniversal.(*UniversalCluster).Kill(appname, "envoy")).To(Succeed())
6766
}
6867

6968
killZone := func() {
70-
_, _, err := zoneUniversal.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
71-
Expect(err).ToNot(HaveOccurred())
69+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
7270
Eventually(func() (string, error) {
7371
return global.GetKumactlOptions().RunKumactlAndGetOutput("inspect", "zones")
7472
}, "30s", "1s").Should(ContainSubstring("Offline"))

test/e2e_env/multizone/resilience/resilience_multizone_universal.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ func ResilienceMultizoneUniversal() {
6565
return nil
6666
}, "30s", "1s").ShouldNot(HaveOccurred())
6767

68-
_, _, err := zone1.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
69-
Expect(err).ToNot(HaveOccurred())
68+
Expect(zone1.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
7069

7170
Eventually(func() error {
7271
output, err := global.GetKumactlOptions().RunKumactlAndGetOutput("inspect", "zones")

test/e2e_env/multizone/resilience/resilience_multizone_universal_postgres.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,10 @@ func ResilienceMultizoneUniversalPostgres() {
9191
Expect(kumaCP).ToNot(BeNil())
9292

9393
// when global is killed
94-
_, _, err := global.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
95-
Expect(err).ToNot(HaveOccurred())
94+
Expect(global.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
9695

9796
// and zone is killed while global is down
98-
_, _, err = zoneUniversal.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
99-
Expect(err).ToNot(HaveOccurred())
97+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
10098

10199
// and global is restarted
102100
Expect(kumaCP.ReStart()).Should(Succeed())
@@ -122,8 +120,7 @@ func ResilienceMultizoneUniversalPostgres() {
122120
Expect(kumaCP).ToNot(BeNil())
123121

124122
// when global is killed
125-
_, _, err := global.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
126-
Expect(err).ToNot(HaveOccurred())
123+
Expect(global.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
127124

128125
// and global is restarted
129126
Expect(kumaCP.ReStart()).Should(Succeed())
@@ -133,8 +130,7 @@ func ResilienceMultizoneUniversalPostgres() {
133130
time.Sleep(10 * time.Second) // ZoneInsightFlushInterval
134131

135132
// and zone is killed
136-
_, _, err = zoneUniversal.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
137-
Expect(err).ToNot(HaveOccurred())
133+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
138134

139135
// then zone is offline
140136
Eventually(func() (string, error) {
@@ -156,12 +152,10 @@ func ResilienceMultizoneUniversalPostgres() {
156152
Expect(kumaCP).ToNot(BeNil())
157153

158154
// when Zone CP is killed
159-
_, _, err := zoneUniversal.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
160-
Expect(err).ToNot(HaveOccurred())
155+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
161156

162157
// and zone-ingress is killed while Zone CP is down
163-
_, _, err = zoneUniversal.Exec("", "", AppIngress, "pkill", "-9", "envoy")
164-
Expect(err).ToNot(HaveOccurred())
158+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppIngress, "envoy")).To(Succeed())
165159

166160
// and Zone CP is restarted
167161
Expect(kumaCP.ReStart()).Should(Succeed())
@@ -181,8 +175,7 @@ func ResilienceMultizoneUniversalPostgres() {
181175
}, "30s", "1s").Should(ContainSubstring("Online"))
182176

183177
// when Zone CP is killed
184-
_, _, err := zoneUniversal.Exec("", "", AppModeCP, "pkill", "-9", "kuma-cp")
185-
Expect(err).ToNot(HaveOccurred())
178+
Expect(zoneUniversal.(*UniversalCluster).Kill(AppModeCP, "kuma-cp run")).To(Succeed())
186179

187180
// then zone is offline immediately
188181
Eventually(func() (string, error) {

test/e2e_env/universal/auth/offline_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ dpServer:
120120
token,
121121
[]string{},
122122
)
123+
Expect(err).ToNot(HaveOccurred())
123124

124125
// then the new admin can access secrets
125-
Expect(err).ToNot(HaveOccurred())
126126
Expect(kumactl.RunKumactl("get", "secrets")).To(Succeed())
127127
})
128128

test/e2e_env/universal/externalservices/externalservices.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ networking:
116116

117117
checkSuccessfulRequest := func(url, clientName string, matcher types.GomegaMatcher) {
118118
Eventually(func(g Gomega) {
119-
stdout, _, err := client.CollectResponse(
119+
stdout, stderr, err := client.CollectResponse(
120120
universal.Cluster, clientName, url,
121121
client.WithVerbose(),
122122
)
123123
g.Expect(err).ToNot(HaveOccurred())
124-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
124+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
125125
g.Expect(stdout).To(matcher)
126126
}, "30s", "500ms").WithOffset(1).Should(Succeed())
127127
}

test/e2e_env/universal/externalservices/zoneegress_externalservices.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ networking:
8888

8989
// then should reach external service
9090
Eventually(func(g Gomega) {
91-
stdout, _, err := client.CollectResponse(
91+
_, stderr, err := client.CollectResponse(
9292
cluster, "demo-client", "external-service-1.mesh",
9393
client.WithVerbose(),
9494
)
9595
g.Expect(err).ToNot(HaveOccurred())
96-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
96+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
9797
}, "30s", "1s").Should(Succeed())
9898

9999
// and increase stats at egress

test/e2e_env/universal/meshexternalservice/meshexternalservice.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ networking:
130130

131131
checkSuccessfulRequest := func(url, clientName string, matcher types.GomegaMatcher) {
132132
Eventually(func(g Gomega) {
133-
stdout, _, err := client.CollectResponse(
133+
stdout, stderr, err := client.CollectResponse(
134134
universal.Cluster, clientName, url,
135135
client.WithVerbose(),
136136
)
137137
g.Expect(err).ToNot(HaveOccurred())
138-
g.Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK"))
138+
g.Expect(stderr).To(ContainSubstring("HTTP/1.1 200 OK"))
139139
g.Expect(stdout).To(matcher)
140140
}, "30s", "500ms").WithOffset(1).Should(Succeed())
141141
}

0 commit comments

Comments
 (0)