Skip to content

Commit

Permalink
fixup! Make all controllers to watch secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
tjamet committed Aug 21, 2024
1 parent b1dc9e3 commit 63f8947
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions internal/controller/genericprovider_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func TestConfigSecretChangesAreAppliedTotheDeployment(t *testing.T) {
g.Expect(err).ToNot(HaveOccurred())
g.Expect(ns.Name).NotTo(BeEmpty())

t.Log("Ensure namespace exists", ns.Name)

configSecret := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "config-secret-",
Expand All @@ -179,6 +181,8 @@ func TestConfigSecretChangesAreAppliedTotheDeployment(t *testing.T) {
g.Expect(env.CreateAndWait(ctx, configSecret)).To(Succeed())
objs = append(objs, configSecret)

t.Log("Created config secret")

objs, err = createDummyProviderWithConfigSecret(
objs,
&operatorv1.CoreProvider{
Expand All @@ -191,25 +195,20 @@ func TestConfigSecretChangesAreAppliedTotheDeployment(t *testing.T) {
)
g.Expect(err).To(Succeed())

t.Log("Created provider")

g.Eventually(
testDeploymentLabelValueGetter(ns.Name, testDeploymentName),
30*time.Second,
).Should(BeEquivalentTo("initial-value"))

t.Log("Provider deploymnet deployed")

configSecret.Data["CONFIGURED_VALUE"] = []byte("updated-value")

g.Expect(env.Update(ctx, configSecret)).NotTo(HaveOccurred())

g.Eventually(
func() string {
if err := env.Get(ctx, client.ObjectKeyFromObject(configSecret), configSecret); err != nil {
return ""
}

return string(configSecret.Data["CONFIGURED_VALUE"])
},
30*time.Second,
).Should(BeEquivalentTo("updated-value"))
t.Log("Config secret updated")

g.Eventually(
testDeploymentLabelValueGetter(ns.Name, testDeploymentName),
Expand Down

0 comments on commit 63f8947

Please sign in to comment.