Skip to content

Commit

Permalink
[envtest]Use the common UpdateSecret helper
Browse files Browse the repository at this point in the history
  • Loading branch information
gibizer committed Sep 22, 2023
1 parent 4a535c8 commit 1a8ed26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
9 changes: 0 additions & 9 deletions test/functional/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,15 +643,6 @@ func GetDefaultNovaNoVNCProxySpec(cell CellNames) map[string]interface{} {
}
}

func UpdateSecret(secretName types.NamespacedName, key string, newValue []byte) {
Eventually(func(g Gomega) {
secret := th.GetSecret(secretName)
secret.Data[key] = newValue
g.Expect(k8sClient.Update(ctx, &secret)).Should(Succeed())
}, timeout, interval).Should(Succeed())
logger.Info("Secret updated", "secret", secretName, "key", key)
}

func CreateCellInternalSecret(cell CellNames) *corev1.Secret {
return th.CreateSecret(
cell.InternalCellSecretName,
Expand Down
6 changes: 3 additions & 3 deletions test/functional/nova_reconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ var _ = Describe("Nova reconfiguration", func() {
When("the service password in the osp secret is changed", func() {
It("reconfigures every nova service", func() {
secretName := types.NamespacedName{Namespace: novaNames.NovaName.Namespace, Name: SecretName}
UpdateSecret(secretName, "NovaPassword", []byte("new-service-password"))
th.UpdateSecret(secretName, "NovaPassword", []byte("new-service-password"))

// Expect that every service config is updated with the new service password
for _, cmName := range []types.NamespacedName{
Expand Down Expand Up @@ -486,7 +486,7 @@ var _ = Describe("Nova reconfiguration", func() {
}

secretName := types.NamespacedName{Namespace: novaNames.NovaName.Namespace, Name: SecretName}
UpdateSecret(secretName, "NovaPassword", []byte("new-service-password"))
th.UpdateSecret(secretName, "NovaPassword", []byte("new-service-password"))

// Assert that the config hash is updated in each stateful set
for i, ss := range ssNames {
Expand Down Expand Up @@ -576,7 +576,7 @@ var _ = Describe("Nova reconfiguration", func() {
Expect(originalComputeHash).NotTo(BeEmpty())

secretName := types.NamespacedName{Namespace: novaNames.NovaName.Namespace, Name: SecretName}
UpdateSecret(secretName, "MetadataSecret", []byte("new-metadata-secret"))
th.UpdateSecret(secretName, "MetadataSecret", []byte("new-metadata-secret"))

Eventually(func(g Gomega) {
configDataMap := th.GetSecret(novaNames.MetadataConfigDataName)
Expand Down

0 comments on commit 1a8ed26

Please sign in to comment.