Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
aruiz14 committed Jun 17, 2024
1 parent 2fbbac3 commit 3fa491a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions e2e/drift/drift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package examples_test

import (
"encoding/json"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand All @@ -18,6 +19,9 @@ var _ = Describe("Drift", func() {
k kubectl.Command
namespace string
bundleName string

interval = 2 * time.Second
duration = 30 * time.Second
)

BeforeEach(func() {
Expand Down Expand Up @@ -128,6 +132,32 @@ var _ = Describe("Drift", func() {
})
})

Context("Modifying status in deployment", func() {
var releaseSecretsPrevious string
JustBeforeEach(func() {
kw := k.Namespace(namespace)
out, err := kw.Patch(
"deployment", "nginx-deployment",
"--subresource=status",
"--type=json",
"-p", `[{"op": "add", "path": "/status/conditions/-", "value": {"lastTransitionTime":"2024-06-17T10:00:00Z","message":"Testing","reason":"Testing","status":"True","type":"Testing"}}]`,
)
Expect(err).ToNot(HaveOccurred(), out)

out, err = kw.Get("secrets", "--field-selector=type=helm.sh/release.v1", "-o=name")
Expect(err).ToNot(HaveOccurred(), out)
releaseSecretsPrevious = out
})

It("Does not trigger drift correction", func() {
Consistently(func() string {
kw := k.Namespace(namespace)
out, _ := kw.Get("secrets", "--field-selector=type=helm.sh/release.v1", "-o=name")
return out
}, duration, interval).Should(Equal(releaseSecretsPrevious))
})
})

Context("Modifying data in configmap", func() {
JustBeforeEach(func() {
kw := k.Namespace(namespace)
Expand Down

0 comments on commit 3fa491a

Please sign in to comment.