@@ -210,7 +210,7 @@ func TestImageAutomationReconciler_commitMessage(t *testing.T) {
210210 updateStrategy := & imagev1.UpdateStrategy {
211211 Strategy : imagev1 .UpdateStrategySetters ,
212212 }
213- err := createImageUpdateAutomation (testEnv , "update-test" , s .namespace , s .gitRepoName , s .gitRepoNamespace , s .branch , "" , "" , testCommitTemplate , "" , updateStrategy )
213+ err := createImageUpdateAutomation (testEnv , "update-test" , s .namespace , s .gitRepoName , s .gitRepoNamespace , s .branch , s . branch , "" , testCommitTemplate , "" , updateStrategy )
214214 g .Expect (err ).ToNot (HaveOccurred ())
215215
216216 // Wait for a new commit to be made by the controller.
@@ -225,6 +225,17 @@ func TestImageAutomationReconciler_commitMessage(t *testing.T) {
225225 g .Expect (signature ).NotTo (BeNil ())
226226 g .Expect (signature .Name ).To (Equal (testAuthorName ))
227227 g .Expect (signature .Email ).To (Equal (testAuthorEmail ))
228+
229+ // Regression check to ensure the status message contains the branch name
230+ // if checkout branch is the same as push branch.
231+ imageUpdateKey := types.NamespacedName {
232+ Namespace : s .namespace ,
233+ Name : "update-test" ,
234+ }
235+ var imageUpdate imagev1.ImageUpdateAutomation
236+ _ = testEnv .Get (context .TODO (), imageUpdateKey , & imageUpdate )
237+ ready := apimeta .FindStatusCondition (imageUpdate .Status .Conditions , meta .ReadyCondition )
238+ g .Expect (ready .Message ).To (Equal (fmt .Sprintf ("committed and pushed commit '%s' to branch '%s'" , head .Hash ().String (), s .branch )))
228239 },
229240 )
230241 })
@@ -517,6 +528,17 @@ func TestImageAutomationReconciler_push_refspec(t *testing.T) {
517528 refspecHash := getRemoteRef (g , repoURL , "smth/else" )
518529 g .Expect (pushBranchHash .String ()).ToNot (Equal (preChangeCommitId ))
519530 g .Expect (pushBranchHash .String ()).To (Equal (refspecHash .String ()))
531+
532+ imageUpdateKey := types.NamespacedName {
533+ Namespace : s .namespace ,
534+ Name : "push-refspec" ,
535+ }
536+ var imageUpdate imagev1.ImageUpdateAutomation
537+ _ = testEnv .Get (context .TODO (), imageUpdateKey , & imageUpdate )
538+ ready := apimeta .FindStatusCondition (imageUpdate .Status .Conditions , meta .ReadyCondition )
539+ g .Expect (ready .Message ).To (Equal (
540+ fmt .Sprintf ("committed and pushed commit '%s' to branch '%s' and using refspec '%s'" ,
541+ pushBranchHash .String (), pushBranch , refspec )))
520542 },
521543 )
522544 })
0 commit comments