@@ -26,7 +26,6 @@ import (
2626	"sigs.k8s.io/controller-runtime/pkg/client" 
2727
2828	"github.com/fluxcd/pkg/apis/meta" 
29- 
3029	sourcev1 "github.com/fluxcd/source-controller/api/v1" 
3130	"github.com/fluxcd/source-controller/internal/object" 
3231	"github.com/fluxcd/source-controller/internal/reconcile" 
@@ -65,6 +64,43 @@ func TestRecordReconcileReq(t *testing.T) {
6564				t .Expect (obj ).To (HaveStatusLastHandledReconcileAt ("now" ))
6665			},
6766		},
67+ 		{
68+ 			name : "empty reconcile annotation value" ,
69+ 			beforeFunc : func (obj  client.Object ) {
70+ 				annotations  :=  map [string ]string {
71+ 					meta .ReconcileRequestAnnotation : "" ,
72+ 				}
73+ 				obj .SetAnnotations (annotations )
74+ 			},
75+ 			afterFunc : func (t  * WithT , obj  client.Object ) {
76+ 				t .Expect (obj ).To (HaveStatusLastHandledReconcileAt ("" ))
77+ 			},
78+ 		},
79+ 		{
80+ 			name : "whitespace-only reconcile annotation value" ,
81+ 			beforeFunc : func (obj  client.Object ) {
82+ 				annotations  :=  map [string ]string {
83+ 					meta .ReconcileRequestAnnotation : "   " ,
84+ 				}
85+ 				obj .SetAnnotations (annotations )
86+ 			},
87+ 			afterFunc : func (t  * WithT , obj  client.Object ) {
88+ 				t .Expect (obj ).To (HaveStatusLastHandledReconcileAt ("   " ))
89+ 			},
90+ 		},
91+ 		{
92+ 			name : "reconcile annotation overwrites existing status value" ,
93+ 			beforeFunc : func (obj  client.Object ) {
94+ 				object .SetStatusLastHandledReconcileAt (obj , "old-value" )
95+ 				annotations  :=  map [string ]string {
96+ 					meta .ReconcileRequestAnnotation : "new-value" ,
97+ 				}
98+ 				obj .SetAnnotations (annotations )
99+ 			},
100+ 			afterFunc : func (t  * WithT , obj  client.Object ) {
101+ 				t .Expect (obj ).To (HaveStatusLastHandledReconcileAt ("new-value" ))
102+ 			},
103+ 		},
68104	}
69105
70106	for  _ , tt  :=  range  tests  {
0 commit comments