Skip to content

Commit ef43533

Browse files
(fix) - e2e tests SA spec name is not accurate to inform the SA
d
1 parent 012e741 commit ef43533

File tree

8 files changed

+20
-10
lines changed

8 files changed

+20
-10
lines changed

docs/book/src/cronjob-tutorial/testdata/project/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ var _ = Describe("Manager", Ordered, func() {
237237
}
238238
}
239239
}],
240-
"serviceAccount": "%s"
240+
"serviceAccountName": "%s"
241241
}
242242
}`, token, metricsServiceName, namespace, serviceAccountName))
243243
_, err = utils.Run(cmd)

docs/book/src/getting-started/testdata/project/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var _ = Describe("Manager", Ordered, func() {
232232
}
233233
}
234234
}],
235-
"serviceAccount": "%s"
235+
"serviceAccountName": "%s"
236236
}
237237
}`, token, metricsServiceName, namespace, serviceAccountName))
238238
_, err = utils.Run(cmd)

docs/book/src/multiversion-tutorial/testdata/project/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ var _ = Describe("Manager", Ordered, func() {
237237
}
238238
}
239239
}],
240-
"serviceAccount": "%s"
240+
"serviceAccountName": "%s"
241241
}
242242
}`, token, metricsServiceName, namespace, serviceAccountName))
243243
_, err = utils.Run(cmd)

pkg/plugins/golang/v4/scaffolds/internal/templates/test/e2e/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ var _ = Describe("Manager", Ordered, func() {
395395
}
396396
}
397397
}],
398-
"serviceAccount": "%s"
398+
"serviceAccountName": "%s"
399399
}
400400
}` + "`" + `, token, metricsServiceName, namespace, serviceAccountName))
401401
_, err = utils.Run(cmd)

test/e2e/v4/plugin_cluster_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,25 @@ func metricsShouldBeUnavailable(kbc *utils.TestContext) {
560560

561561
By("validating that the curl pod fail as expected")
562562
verifyCurlUp := func(g Gomega) {
563-
status, err := kbc.Kubectl.Get(
563+
status, errCurl := kbc.Kubectl.Get(
564564
true,
565565
"pods", "curl", "-o", "jsonpath={.status.phase}")
566-
g.Expect(err).NotTo(HaveOccurred())
566+
g.Expect(errCurl).NotTo(HaveOccurred())
567567
g.Expect(status).NotTo(Equal("Failed"),
568568
fmt.Sprintf("curl pod in %s status when should fail with an error", status))
569569
}
570570
Eventually(verifyCurlUp, 240*time.Second, time.Second).Should(Succeed())
571571

572+
By("validating that the correct ServiceAccount is being used")
573+
saName := kbc.Kubectl.ServiceAccount
574+
currentSAOutput, err := kbc.Kubectl.Get(
575+
true,
576+
"serviceaccount", saName,
577+
"-o", "jsonpath={.metadata.name}",
578+
)
579+
Expect(err).NotTo(HaveOccurred(), "Failed to fetch the service account")
580+
Expect(currentSAOutput).To(Equal(saName), "The ServiceAccount in use does not match the expected one")
581+
572582
By("validating that the metrics endpoint is not working as expected")
573583
getCurlLogs := func(g Gomega) {
574584
metricsOutput, err := kbc.Kubectl.Logs("curl")
@@ -606,7 +616,7 @@ func cmdOptsToCreateCurlPod(kbc *utils.TestContext, token string) []string {
606616
}
607617
}
608618
}],
609-
"serviceAccount": "%s"
619+
"serviceAccountName": "%s"
610620
}
611621
}`, token, kbc.TestSuffix, kbc.Kubectl.Namespace, kbc.Kubectl.ServiceAccount),
612622
}

testdata/project-v4-multigroup/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var _ = Describe("Manager", Ordered, func() {
232232
}
233233
}
234234
}],
235-
"serviceAccount": "%s"
235+
"serviceAccountName": "%s"
236236
}
237237
}`, token, metricsServiceName, namespace, serviceAccountName))
238238
_, err = utils.Run(cmd)

testdata/project-v4-with-plugins/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var _ = Describe("Manager", Ordered, func() {
232232
}
233233
}
234234
}],
235-
"serviceAccount": "%s"
235+
"serviceAccountName": "%s"
236236
}
237237
}`, token, metricsServiceName, namespace, serviceAccountName))
238238
_, err = utils.Run(cmd)

testdata/project-v4/test/e2e/e2e_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var _ = Describe("Manager", Ordered, func() {
232232
}
233233
}
234234
}],
235-
"serviceAccount": "%s"
235+
"serviceAccountName": "%s"
236236
}
237237
}`, token, metricsServiceName, namespace, serviceAccountName))
238238
_, err = utils.Run(cmd)

0 commit comments

Comments
 (0)