Skip to content

Commit 8a92986

Browse files
committed
adding scenarions for processor_test.go
Signed-off-by: zhaque44 <[email protected]> chg imports to be like main Signed-off-by: zhaque44 <[email protected]>
1 parent 71e6ca6 commit 8a92986

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

internal/reconcile/summarize/processor_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,43 @@ func TestRecordReconcileReq(t *testing.T) {
6565
t.Expect(obj).To(HaveStatusLastHandledReconcileAt("now"))
6666
},
6767
},
68+
{
69+
name: "empty reconcile annotation value",
70+
beforeFunc: func(obj client.Object) {
71+
annotations := map[string]string{
72+
meta.ReconcileRequestAnnotation: "",
73+
}
74+
obj.SetAnnotations(annotations)
75+
},
76+
afterFunc: func(t *WithT, obj client.Object) {
77+
t.Expect(obj).To(HaveStatusLastHandledReconcileAt(""))
78+
},
79+
},
80+
{
81+
name: "whitespace-only reconcile annotation value",
82+
beforeFunc: func(obj client.Object) {
83+
annotations := map[string]string{
84+
meta.ReconcileRequestAnnotation: " ",
85+
}
86+
obj.SetAnnotations(annotations)
87+
},
88+
afterFunc: func(t *WithT, obj client.Object) {
89+
t.Expect(obj).To(HaveStatusLastHandledReconcileAt(" "))
90+
},
91+
},
92+
{
93+
name: "reconcile annotation overwrites existing status value",
94+
beforeFunc: func(obj client.Object) {
95+
object.SetStatusLastHandledReconcileAt(obj, "old-value")
96+
annotations := map[string]string{
97+
meta.ReconcileRequestAnnotation: "new-value",
98+
}
99+
obj.SetAnnotations(annotations)
100+
},
101+
afterFunc: func(t *WithT, obj client.Object) {
102+
t.Expect(obj).To(HaveStatusLastHandledReconcileAt("new-value"))
103+
},
104+
},
68105
}
69106

70107
for _, tt := range tests {

0 commit comments

Comments
 (0)