Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Nadasdi <balazs@weave.works>
  • Loading branch information
yitsushi committed Jun 21, 2023
1 parent 5ffd2af commit 3de1cc9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions controllers/tc000044_plan_only_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controllers

import (
"context"
"strings"
"testing"
"time"

Expand All @@ -18,7 +19,7 @@ import (
// +kubebuilder:docs-gen:collapse=Imports

func Test_000044_plan_only_mode_test(t *testing.T) {
Spec("This spec describes the behaviour of a Terraform resource when PlanOnly is abled")
Spec("This spec describes the behaviour of a Terraform resource when PlanOnly is set")
It("should be reconciled and write human readable plan output.")

const (
Expand Down Expand Up @@ -132,11 +133,11 @@ func Test_000044_plan_only_mode_test(t *testing.T) {
return len(planOutput.Data), nil
}, timeout, interval).Should(Equal(1))

By("checking that the output secret contains the correct output data, provisioned by the TF resource.")
By("checking that the output ConfigMap contains the correct output data, provisioned by the TF resource.")
expectedOutputValue := map[string]string{
"Name": "tfplan-default-" + terraformName,
"Namespace": "flux-system",
"Value": "\nChanges to Outputs:\n + hello_world = \"Hello, World!\"\n\nYou can apply this plan to save these new output values to the Terraform\nstate, without changing any real infrastructure.\n",
"Value": "Changes to Outputs: + hello_world = \"Hello, World!\"You can apply this plan to save these new output values to the Terraformstate, without changing any real infrastructure.",
"OwnerRef[0]": string(createdHelloWorldTF.UID),
}
g.Eventually(func() (map[string]string, error) {
Expand All @@ -145,13 +146,13 @@ func Test_000044_plan_only_mode_test(t *testing.T) {
return map[string]string{
"Name": planOutput.Name,
"Namespace": planOutput.Namespace,
"Value": value,
"Value": strings.ReplaceAll(value, "\n", ""),
"OwnerRef[0]": string(planOutput.OwnerReferences[0].UID),
}, err
}, timeout, interval).Should(Equal(expectedOutputValue), "expected output %v", expectedOutputValue)

It("should be stopped.")
By("checking the ready condition is still Plan after 5 seconds.")
By("checking the ready condition is still Plan within 5 seconds.")
g.Eventually(func() map[string]interface{} {
err := k8sClient.Get(ctx, helloWorldTFKey, &createdHelloWorldTF)
if err != nil {
Expand Down

0 comments on commit 3de1cc9

Please sign in to comment.