Skip to content

Commit

Permalink
Extend bundle diff test for modified ignored keys
Browse files Browse the repository at this point in the history
  • Loading branch information
manno committed Jul 4, 2024
1 parent 489d4c5 commit ffd7be5
Showing 1 changed file with 33 additions and 6 deletions.
39 changes: 33 additions & 6 deletions e2e/single-cluster/bundle_diffs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var _ = Describe("BundleDiffs", func() {
targetNamespace string

k kubectl.Command
kw kubectl.Command
interval = 2 * time.Second
duration = 30 * time.Second
)
Expand Down Expand Up @@ -54,6 +55,8 @@ var _ = Describe("BundleDiffs", func() {
var err error
targetNamespace, err = utils.NewNamespaceName()
Expect(err).ToNot(HaveOccurred())
kw = k.Namespace(targetNamespace)

name = "bundle-diff-" + targetNamespace
})

Expand Down Expand Up @@ -105,32 +108,57 @@ var _ = Describe("BundleDiffs", func() {
if err != nil || status == nil {
return false
}
GinkgoWriter.Printf("bundledeployment status: %v", status)
return status.Ready && status.NonModified
}).Should(BeTrue())

Eventually(func() string {
out, _ := k.Namespace(targetNamespace).Get("services")
out, _ := kw.Get("services")

return out
}).Should(ContainSubstring("app-service"))
})
})

Context("modifying a ignored resource", func() {
Context("adding new values", func() {
JustBeforeEach(func() {
By("modifying the workload resources", func() {
kw := k.Namespace(targetNamespace)
out, err := kw.Patch(
"service", "app-service",
"--type=json",
"-p", `[{"op": "add", "path": "/spec/ports/0", "value": {"name":"test","port":1023,"protocol":"TCP"}}]`,
)
Expect(err).ToNot(HaveOccurred(), out)

// adds a value
out, err = kw.Patch(
"configmap", "app-config",
"--type=merge",
"-p", `{"data":{"value":"by-test-code"}}`,
"-p", `{"data":{"newvalue":"by-test-code"}}`,
)
Expect(err).ToNot(HaveOccurred(), out)
})
})

It("ignores changes", func() {
Consistently(func() bool {
status, err := bundleDeploymentStatus(name)
if err != nil || status == nil {
return false
}

return status.NonModified
}, duration, interval).Should(BeTrue(), "ignores modification")
})
})

Context("modifying existing values, that are ignored", func() {
JustBeforeEach(func() {
By("modifying the workload resources", func() {
out, err := kw.Patch(
"configmap", "app-config",
"--type=merge",
"-p", `{"data":{"test":"by-test-code"}}`,
)
Expect(err).ToNot(HaveOccurred(), out)
})
Expand All @@ -148,10 +176,9 @@ var _ = Describe("BundleDiffs", func() {
})
})

Context("modifying a monitored resource", func() {
Context("modifying existing values, that are not ignored", func() {
JustBeforeEach(func() {
By("modifying a monitored value", func() {
kw := k.Namespace(targetNamespace)
out, err := kw.Patch(
"service", "app-service",
"--type=json",
Expand Down

0 comments on commit ffd7be5

Please sign in to comment.