gitrepo: Fix reconcileInclude() includes
The artifacts built in reconcileInclude() should be persisted by writing it to includes. reconcileArtifact() later adds includes to the git repo object status and persists it. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
2acb721c35
commit
c4fa79c85e
|
@ -561,6 +561,9 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, obj *sou
|
||||||
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "IncludeChange",
|
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "IncludeChange",
|
||||||
"included artifacts differ from last observed includes")
|
"included artifacts differ from last observed includes")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Persist the artifactSet.
|
||||||
|
*includes = artifacts
|
||||||
return sreconcile.ResultSuccess, nil
|
return sreconcile.ResultSuccess, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1029,6 +1029,9 @@ func TestGitRepositoryReconciler_reconcileInclude(t *testing.T) {
|
||||||
got, err := r.reconcileInclude(ctx, obj, &artifact, &includes, tmpDir)
|
got, err := r.reconcileInclude(ctx, obj, &artifact, &includes, tmpDir)
|
||||||
g.Expect(obj.GetConditions()).To(conditions.MatchConditions(tt.assertConditions))
|
g.Expect(obj.GetConditions()).To(conditions.MatchConditions(tt.assertConditions))
|
||||||
g.Expect(err != nil).To(Equal(tt.wantErr))
|
g.Expect(err != nil).To(Equal(tt.wantErr))
|
||||||
|
if err == nil {
|
||||||
|
g.Expect(len(includes)).To(Equal(len(tt.includes)))
|
||||||
|
}
|
||||||
g.Expect(got).To(Equal(tt.want))
|
g.Expect(got).To(Equal(tt.want))
|
||||||
for _, i := range tt.includes {
|
for _, i := range tt.includes {
|
||||||
if i.toPath != "" {
|
if i.toPath != "" {
|
||||||
|
|
Loading…
Reference in New Issue