Skip to content

Commit 9a0f9af

Browse files
authored
Merge pull request #1427 from fluxcd/fix-notation-tests
Generate unique names for notation secrets
2 parents c159f05 + 76b38f4 commit 9a0f9af

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/controller/ocirepository_controller_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,12 +1316,12 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignatureNotation(t *testi
13161316
useDigest: true,
13171317
provideNoCert: true,
13181318
// no namespace but the namespace name should appear before the /notation-config
1319-
wantErrMsg: "failed to verify the signature using provider 'notation': no certificates found in secret '/notation-config'",
1319+
wantErrMsg: "failed to verify the signature using provider 'notation': no certificates found in secret '/notation-config",
13201320
want: sreconcile.ResultEmpty,
13211321
assertConditions: []metav1.Condition{
13221322
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new revision '<revision>' for '<url>'"),
13231323
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new revision '<revision>' for '<url>'"),
1324-
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, sourcev1.VerificationError, "failed to verify the signature using provider '<provider>': no certificates found in secret '/notation-config'"),
1324+
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, sourcev1.VerificationError, "failed to verify the signature using provider '<provider>': no certificates found in secret '/notation-config"),
13251325
},
13261326
},
13271327
}
@@ -1417,7 +1417,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignatureNotation(t *testi
14171417

14181418
secret := &corev1.Secret{
14191419
ObjectMeta: metav1.ObjectMeta{
1420-
Name: "notation-config",
1420+
GenerateName: "notation-config-",
14211421
},
14221422
Data: data,
14231423
}
@@ -1432,7 +1432,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceSignatureNotation(t *testi
14321432
}
14331433
}
14341434

1435-
obj.Spec.Verify.SecretRef = &meta.LocalObjectReference{Name: "notation-config"}
1435+
obj.Spec.Verify.SecretRef = &meta.LocalObjectReference{Name: secret.GetName()}
14361436

14371437
if tt.reference != nil {
14381438
obj.Spec.Reference = tt.reference
@@ -1666,12 +1666,12 @@ func TestOCIRepository_reconcileSource_verifyOCISourceTrustPolicyNotation(t *tes
16661666
},
16671667
provideNoPolicy: true,
16681668
wantErr: true,
1669-
wantErrMsg: fmt.Sprintf("failed to verify the signature using provider 'notation': '%s' not found in secret '/notation'", snotation.DefaultTrustPolicyKey),
1669+
wantErrMsg: fmt.Sprintf("failed to verify the signature using provider 'notation': '%s' not found in secret '/notation", snotation.DefaultTrustPolicyKey),
16701670
want: sreconcile.ResultEmpty,
16711671
assertConditions: []metav1.Condition{
16721672
*conditions.TrueCondition(meta.ReconcilingCondition, meta.ProgressingReason, "building artifact: new revision '<revision>' for '<url>'"),
16731673
*conditions.UnknownCondition(meta.ReadyCondition, meta.ProgressingReason, "building artifact: new revision '<revision>' for '<url>'"),
1674-
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, sourcev1.VerificationError, fmt.Sprintf("failed to verify the signature using provider 'notation': '%s' not found in secret '/notation'", snotation.DefaultTrustPolicyKey)),
1674+
*conditions.FalseCondition(sourcev1.SourceVerifiedCondition, sourcev1.VerificationError, fmt.Sprintf("failed to verify the signature using provider 'notation': '%s' not found in secret '/notation", snotation.DefaultTrustPolicyKey)),
16751675
},
16761676
},
16771677
}
@@ -1753,7 +1753,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceTrustPolicyNotation(t *tes
17531753

17541754
secret := &corev1.Secret{
17551755
ObjectMeta: metav1.ObjectMeta{
1756-
Name: "notation",
1756+
GenerateName: "notation-",
17571757
},
17581758
Data: data,
17591759
}
@@ -1762,7 +1762,7 @@ func TestOCIRepository_reconcileSource_verifyOCISourceTrustPolicyNotation(t *tes
17621762

17631763
obj.Spec.Insecure = true
17641764

1765-
obj.Spec.Verify.SecretRef = &meta.LocalObjectReference{Name: "notation"}
1765+
obj.Spec.Verify.SecretRef = &meta.LocalObjectReference{Name: secret.GetName()}
17661766

17671767
if tt.reference != nil {
17681768
obj.Spec.Reference = tt.reference

0 commit comments

Comments
 (0)