Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Dmitrichenko <[email protected]>
  • Loading branch information
errordeveloper committed Feb 9, 2024
1 parent df1734a commit 72f92ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/controller/ocirepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
// Mark observations about the revision on the object
defer func() {
if !obj.GetArtifact().HasRevision(revision) {
message := fmt.Sprintf("new revision '%s' for '%s'", revision, ref)
message := fmt.Sprintf("new revision '%s' for '%s'", revision, obj.Spec.URL)
if obj.GetArtifact() != nil {
conditions.MarkTrue(obj, sourcev1.ArtifactOutdatedCondition, "NewRevision", message)
}
Expand Down
5 changes: 2 additions & 3 deletions internal/controller/ocirepository_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1575,12 +1575,11 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
Reference: tt.reference,
},
}
url := strings.TrimPrefix(obj.Spec.URL, "oci://") + ":" + tt.reference.Tag

assertConditions := tt.assertConditions
for k := range assertConditions {
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<revision>", tt.revision)
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<url>", url)
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<url>", obj.Spec.URL)
assertConditions[k].Message = strings.ReplaceAll(assertConditions[k].Message, "<provider>", "cosign")
}

Expand All @@ -1599,7 +1598,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignature_keyless(t *testi
got, err := r.reconcileSource(ctx, sp, obj, artifact, t.TempDir())
if tt.wantErr {
g.Expect(err).To(HaveOccurred())
tt.wantErrMsg = strings.ReplaceAll(tt.wantErrMsg, "<url>", url)
tt.wantErrMsg = strings.ReplaceAll(tt.wantErrMsg, "<url>", obj.Spec.URL)
g.Expect(err.Error()).To(ContainSubstring(tt.wantErrMsg))
} else {
g.Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 72f92ac

Please sign in to comment.