GitRepo: git impl. deprecation test cleanup
Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
e877040466
commit
8126c99a76
|
@ -470,29 +470,23 @@ func TestGitRepositoryReconciler_reconcileSource_authStrategy(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(sourcev1.GoGitImplementation, func(t *testing.T) {
|
tmpDir := t.TempDir()
|
||||||
g := NewWithT(t)
|
|
||||||
|
|
||||||
tmpDir := t.TempDir()
|
head, _ := localRepo.Head()
|
||||||
|
assertConditions := tt.assertConditions
|
||||||
|
for k := range assertConditions {
|
||||||
|
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<commit>", head.Hash().String())
|
||||||
|
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<url>", obj.Spec.URL)
|
||||||
|
}
|
||||||
|
|
||||||
obj := obj.DeepCopy()
|
var commit git.Commit
|
||||||
|
var includes artifactSet
|
||||||
|
|
||||||
head, _ := localRepo.Head()
|
got, err := r.reconcileSource(context.TODO(), obj, &commit, &includes, tmpDir)
|
||||||
assertConditions := tt.assertConditions
|
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions(tt.assertConditions))
|
||||||
for k := range assertConditions {
|
g.Expect(err != nil).To(Equal(tt.wantErr))
|
||||||
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<commit>", head.Hash().String())
|
g.Expect(got).To(Equal(tt.want))
|
||||||
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<url>", obj.Spec.URL)
|
g.Expect(commit).ToNot(BeNil())
|
||||||
}
|
|
||||||
|
|
||||||
var commit git.Commit
|
|
||||||
var includes artifactSet
|
|
||||||
|
|
||||||
got, err := r.reconcileSource(context.TODO(), obj, &commit, &includes, tmpDir)
|
|
||||||
g.Expect(obj.Status.Conditions).To(conditions.MatchConditions(tt.assertConditions))
|
|
||||||
g.Expect(err != nil).To(Equal(tt.wantErr))
|
|
||||||
g.Expect(got).To(Equal(tt.want))
|
|
||||||
g.Expect(commit).ToNot(BeNil())
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -664,30 +658,25 @@ func TestGitRepositoryReconciler_reconcileSource_checkoutStrategy(t *testing.T)
|
||||||
obj.Spec.Reference.Commit = headRef.Hash().String()
|
obj.Spec.Reference.Commit = headRef.Hash().String()
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run(sourcev1.GoGitImplementation, func(t *testing.T) {
|
tmpDir := t.TempDir()
|
||||||
g := NewWithT(t)
|
|
||||||
|
|
||||||
tmpDir := t.TempDir()
|
if tt.beforeFunc != nil {
|
||||||
obj := obj.DeepCopy()
|
tt.beforeFunc(obj, headRef.Hash().String())
|
||||||
|
}
|
||||||
|
|
||||||
if tt.beforeFunc != nil {
|
var commit git.Commit
|
||||||
tt.beforeFunc(obj, headRef.Hash().String())
|
var includes artifactSet
|
||||||
}
|
got, err := r.reconcileSource(ctx, obj, &commit, &includes, tmpDir)
|
||||||
|
if err != nil {
|
||||||
var commit git.Commit
|
println(err.Error())
|
||||||
var includes artifactSet
|
}
|
||||||
got, err := r.reconcileSource(ctx, obj, &commit, &includes, tmpDir)
|
g.Expect(err != nil).To(Equal(tt.wantErr))
|
||||||
if err != nil {
|
g.Expect(got).To(Equal(tt.want))
|
||||||
println(err.Error())
|
if tt.wantRevision != "" && !tt.wantErr {
|
||||||
}
|
revision := strings.ReplaceAll(tt.wantRevision, "<commit>", headRef.Hash().String())
|
||||||
g.Expect(err != nil).To(Equal(tt.wantErr))
|
g.Expect(commit.String()).To(Equal(revision))
|
||||||
g.Expect(got).To(Equal(tt.want))
|
g.Expect(conditions.IsTrue(obj, sourcev1.ArtifactOutdatedCondition)).To(Equal(tt.wantArtifactOutdated))
|
||||||
if tt.wantRevision != "" && !tt.wantErr {
|
}
|
||||||
revision := strings.ReplaceAll(tt.wantRevision, "<commit>", headRef.Hash().String())
|
|
||||||
g.Expect(commit.String()).To(Equal(revision))
|
|
||||||
g.Expect(conditions.IsTrue(obj, sourcev1.ArtifactOutdatedCondition)).To(Equal(tt.wantArtifactOutdated))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue