From 4836140f66ed7e2315e09e94a729d0ba328746d4 Mon Sep 17 00:00:00 2001 From: Volodymyr Zotov Date: Fri, 22 Aug 2025 09:56:38 -0500 Subject: [PATCH] Add `CheckSecretPasswordWasUpdated` function to the `kube` package --- pkg/testhelper/kube/kube.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/testhelper/kube/kube.go b/pkg/testhelper/kube/kube.go index 73339af..7a3c5ad 100644 --- a/pkg/testhelper/kube/kube.go +++ b/pkg/testhelper/kube/kube.go @@ -70,6 +70,19 @@ func CheckSecretExists(name string) { }, defaults.E2ETimeout, defaults.E2EInterval).Should(Succeed()) } +func ReadingSecretData(name, key string) (string, error) { + return system.Run("kubectl", "get", "secret", name, "-o", "jsonpath={.data."+key+"}") +} + +func CheckSecretPasswordWasUpdated(name, oldPassword string) { + By("Checking '" + name + "' secret password was updated") + Eventually(func(g Gomega) { + newPassword, err := ReadingSecretData(name, "password") + g.Expect(err).NotTo(HaveOccurred()) + g.Expect(newPassword).NotTo(Equal(oldPassword)) + }, defaults.E2ETimeout, defaults.E2EInterval).Should(Succeed()) +} + // Apply applies a kubernetes manifest file func Apply(yamlPath string) { _, err := system.Run("kubectl", "apply", "-f", yamlPath)