Skip to content

Commit 0756eee

Browse files
committed
Test that the ready condition shows commit/push
After a change has been made, the ready condition should have a message indicating that it pushed a commit. Signed-off-by: Michael Bridgen <[email protected]>
1 parent a45a216 commit 0756eee

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

controllers/update_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import (
3636
. "github.com/onsi/gomega"
3737
"github.com/otiai10/copy"
3838
corev1 "k8s.io/api/core/v1"
39-
// apimeta "k8s.io/apimachinery/pkg/api/meta"
39+
apimeta "k8s.io/apimachinery/pkg/api/meta"
4040
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4141
"k8s.io/apimachinery/pkg/types"
4242
ctrl "sigs.k8s.io/controller-runtime"
@@ -319,6 +319,7 @@ var _ = Describe("ImageUpdateAutomation", func() {
319319
}, timeout, time.Second).Should(BeTrue())
320320
// check that the annotation was recorded as seen
321321
Expect(newUpdate.Status.LastHandledReconcileAt).To(Equal(ts))
322+
expectCommittedAndPushed(newUpdate.Status.Conditions)
322323

323324
// check that a new commit was made
324325
compareRepoWithExpected(repoURL, branch, "testdata/appconfig-setters-expected", func(tmp string) {
@@ -329,6 +330,12 @@ var _ = Describe("ImageUpdateAutomation", func() {
329330
})
330331
})
331332

333+
func expectCommittedAndPushed(conditions []metav1.Condition) {
334+
rc := apimeta.FindStatusCondition(conditions, meta.ReadyCondition)
335+
Expect(rc).ToNot(BeNil())
336+
Expect(rc.Message).To(ContainSubstring("committed and pushed"))
337+
}
338+
332339
func replaceMarker(path string, policyKey types.NamespacedName) {
333340
// NB this requires knowledge of what's in the git
334341
// repo, so a little brittle

0 commit comments

Comments
 (0)