@@ -470,29 +470,23 @@ func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) {
470
470
},
471
471
}
472
472
473
- t .Run (sourcev1 .GoGitImplementation , func (t * testing.T ) {
474
- g := NewWithT (t )
475
-
476
- tmpDir := t .TempDir ()
477
-
478
- obj := obj .DeepCopy ()
473
+ tmpDir := t .TempDir ()
479
474
480
- head , _ := localRepo .Head ()
481
- assertConditions := tt .assertConditions
482
- for k := range assertConditions {
483
- assertConditions [k ].Message = strings .ReplaceAll (assertConditions [k ].Message , "<commit>" , head .Hash ().String ())
484
- assertConditions [k ].Message = strings .ReplaceAll (assertConditions [k ].Message , "<url>" , obj .Spec .URL )
485
- }
475
+ head , _ := localRepo .Head ()
476
+ assertConditions := tt .assertConditions
477
+ for k := range assertConditions {
478
+ assertConditions [k ].Message = strings .ReplaceAll (assertConditions [k ].Message , "<commit>" , head .Hash ().String ())
479
+ assertConditions [k ].Message = strings .ReplaceAll (assertConditions [k ].Message , "<url>" , obj .Spec .URL )
480
+ }
486
481
487
- var commit git.Commit
488
- var includes artifactSet
482
+ var commit git.Commit
483
+ var includes artifactSet
489
484
490
- got , err := r .reconcileSource (context .TODO (), obj , & commit , & includes , tmpDir )
491
- g .Expect (obj .Status .Conditions ).To (conditions .MatchConditions (tt .assertConditions ))
492
- g .Expect (err != nil ).To (Equal (tt .wantErr ))
493
- g .Expect (got ).To (Equal (tt .want ))
494
- g .Expect (commit ).ToNot (BeNil ())
495
- })
485
+ got , err := r .reconcileSource (context .TODO (), obj , & commit , & includes , tmpDir )
486
+ g .Expect (obj .Status .Conditions ).To (conditions .MatchConditions (tt .assertConditions ))
487
+ g .Expect (err != nil ).To (Equal (tt .wantErr ))
488
+ g .Expect (got ).To (Equal (tt .want ))
489
+ g .Expect (commit ).ToNot (BeNil ())
496
490
})
497
491
}
498
492
}
@@ -664,30 +658,25 @@ func TestGitRepositoryReconciler_reconcileSource_checkoutStrategy(t *testing.T)
664
658
obj .Spec .Reference .Commit = headRef .Hash ().String ()
665
659
}
666
660
667
- t .Run (sourcev1 .GoGitImplementation , func (t * testing.T ) {
668
- g := NewWithT (t )
669
-
670
- tmpDir := t .TempDir ()
671
- obj := obj .DeepCopy ()
661
+ tmpDir := t .TempDir ()
672
662
673
- if tt .beforeFunc != nil {
674
- tt .beforeFunc (obj , headRef .Hash ().String ())
675
- }
663
+ if tt .beforeFunc != nil {
664
+ tt .beforeFunc (obj , headRef .Hash ().String ())
665
+ }
676
666
677
- var commit git.Commit
678
- var includes artifactSet
679
- got , err := r .reconcileSource (ctx , obj , & commit , & includes , tmpDir )
680
- if err != nil {
681
- println (err .Error ())
682
- }
683
- g .Expect (err != nil ).To (Equal (tt .wantErr ))
684
- g .Expect (got ).To (Equal (tt .want ))
685
- if tt .wantRevision != "" && ! tt .wantErr {
686
- revision := strings .ReplaceAll (tt .wantRevision , "<commit>" , headRef .Hash ().String ())
687
- g .Expect (commit .String ()).To (Equal (revision ))
688
- g .Expect (conditions .IsTrue (obj , sourcev1 .ArtifactOutdatedCondition )).To (Equal (tt .wantArtifactOutdated ))
689
- }
690
- })
667
+ var commit git.Commit
668
+ var includes artifactSet
669
+ got , err := r .reconcileSource (ctx , obj , & commit , & includes , tmpDir )
670
+ if err != nil {
671
+ println (err .Error ())
672
+ }
673
+ g .Expect (err != nil ).To (Equal (tt .wantErr ))
674
+ g .Expect (got ).To (Equal (tt .want ))
675
+ if tt .wantRevision != "" && ! tt .wantErr {
676
+ revision := strings .ReplaceAll (tt .wantRevision , "<commit>" , headRef .Hash ().String ())
677
+ g .Expect (commit .String ()).To (Equal (revision ))
678
+ g .Expect (conditions .IsTrue (obj , sourcev1 .ArtifactOutdatedCondition )).To (Equal (tt .wantArtifactOutdated ))
679
+ }
691
680
})
692
681
}
693
682
}
0 commit comments