@@ -479,8 +479,10 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
479479 // test cases and cleanup at the end.
480480
481481 t .Run ("PushSpec" , func (t * testing.T ) {
482+ g := NewWithT (t )
483+
482484 // Clone the repo locally.
483- cloneCtx , cancel := context .WithTimeout (ctx , time . Second * 10 )
485+ cloneCtx , cancel := context .WithTimeout (ctx , timeout )
484486 defer cancel ()
485487 localRepo , err := clone (cloneCtx , cloneLocalRepoURL , branch )
486488 g .Expect (err ).ToNot (HaveOccurred (), "failed to clone git repo" )
@@ -499,6 +501,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
499501 pushBranch := "pr-" + randStringRunes (5 )
500502
501503 t .Run ("update with PushSpec" , func (t * testing.T ) {
504+ g := NewWithT (t )
505+
502506 preChangeCommitId := commitIdFromBranch (localRepo , branch )
503507 commitInRepo (g , cloneLocalRepoURL , branch , "Install setter marker" , func (tmp string ) {
504508 g .Expect (replaceMarker (tmp , policyKey )).To (Succeed ())
@@ -536,6 +540,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
536540 })
537541
538542 t .Run ("push branch gets updated" , func (t * testing.T ) {
543+ g := NewWithT (t )
544+
539545 initialHead , err := headFromBranch (localRepo , branch )
540546 g .Expect (err ).ToNot (HaveOccurred ())
541547 defer initialHead .Free ()
@@ -566,6 +572,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
566572 })
567573
568574 t .Run ("still pushes to the push branch after it's merged" , func (t * testing.T ) {
575+ g := NewWithT (t )
576+
569577 initialHead , err := headFromBranch (localRepo , branch )
570578 g .Expect (err ).ToNot (HaveOccurred ())
571579 defer initialHead .Free ()
@@ -610,13 +618,15 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
610618 })
611619
612620 t .Run ("with update strategy setters" , func (t * testing.T ) {
621+ g := NewWithT (t )
622+
613623 // Clone the repo locally.
614624 // NOTE: A new localRepo is created here instead of reusing the one
615625 // in the previous case due to a bug in some of the git operations
616626 // test helper. When switching branches, the localRepo seems to get
617627 // stuck in one particular branch. As a workaround, create a
618628 // separate localRepo.
619- cloneCtx , cancel := context .WithTimeout (ctx , time . Second * 10 )
629+ cloneCtx , cancel := context .WithTimeout (ctx , timeout )
620630 defer cancel ()
621631 localRepo , err := clone (cloneCtx , cloneLocalRepoURL , branch )
622632 g .Expect (err ).ToNot (HaveOccurred (), "failed to clone git repo" )
@@ -677,6 +687,8 @@ func TestImageAutomationReconciler_e2e(t *testing.T) {
677687 })
678688
679689 t .Run ("no reconciliation when object is suspended" , func (t * testing.T ) {
690+ g := NewWithT (t )
691+
680692 err = createImagePolicyWithLatestImage (testEnv , imagePolicyName , namespace , "not-expected-to-exist" , "1.x" , latestImage )
681693 g .Expect (err ).ToNot (HaveOccurred (), "failed to create ImagePolicy resource" )
682694
@@ -863,7 +875,7 @@ func compareRepoWithExpected(g *WithT, repoURL, branch, fixture string, changeFi
863875
864876 copy .Copy (fixture , expected )
865877 changeFixture (expected )
866- cloneCtx , cancel := context .WithTimeout (ctx , time . Second * 10 )
878+ cloneCtx , cancel := context .WithTimeout (ctx , timeout )
867879 defer cancel ()
868880 repo , err := clone (cloneCtx , repoURL , branch )
869881 g .Expect (err ).ToNot (HaveOccurred ())
@@ -909,7 +921,7 @@ func configureTransportOptsForRepo(repo *libgit2.Repository) (func(), error) {
909921}
910922
911923func commitInRepo (g * WithT , repoURL , branch , msg string , changeFiles func (path string )) * libgit2.Oid {
912- cloneCtx , cancel := context .WithTimeout (ctx , time . Second * 10 )
924+ cloneCtx , cancel := context .WithTimeout (ctx , timeout )
913925 defer cancel ()
914926 repo , err := clone (cloneCtx , repoURL , branch )
915927 g .Expect (err ).ToNot (HaveOccurred ())
@@ -1443,7 +1455,7 @@ func testWithCustomRepoAndImagePolicy(
14431455
14441456 // Clone the repo.
14451457 repoURL := gitServer .HTTPAddressWithCredentials () + repositoryPath
1446- cloneCtx , cancel := context .WithTimeout (ctx , time . Second * 10 )
1458+ cloneCtx , cancel := context .WithTimeout (ctx , timeout )
14471459 defer cancel ()
14481460 localRepo , err := clone (cloneCtx , repoURL , args .branch )
14491461 g .Expect (err ).ToNot (HaveOccurred (), "failed to clone git repo" )
0 commit comments