@@ -522,18 +522,6 @@ var _ = Describe("Component initial build controller", func() {
522
522
expectPacBuildStatus (resourcePacPrepKey , "enabled" , 0 , "" , mergeUrl )
523
523
})
524
524
525
- It ("should not copy PaC secret into local namespace if GitHub application is used" , func () {
526
- deleteSecret (namespacePaCSecretKey )
527
-
528
- createComponentAndProcessBuildRequest (componentConfig {
529
- componentKey : resourcePacPrepKey ,
530
- annotations : defaultPipelineAnnotations ,
531
- }, BuildRequestConfigurePaCAnnotationValue )
532
- waitPaCRepositoryCreated (resourcePacPrepKey )
533
-
534
- ensureSecretNotCreated (namespacePaCSecretKey )
535
- })
536
-
537
525
It ("should successfully submit PR with PaC definitions using token" , func () {
538
526
isCreatePaCPullRequestInvoked := false
539
527
EnsurePaCMergeRequestFunc = func (repoUrl string , d * gp.MergeRequestData ) (string , error ) {
@@ -1167,6 +1155,40 @@ var _ = Describe("Component initial build controller", func() {
1167
1155
expectError := boerrors .NewBuildOpError (boerrors .EUnknownGitProvider , nil )
1168
1156
expectPacBuildStatus (resourceCleanupKey , "error" , expectError .GetErrorId (), expectError .ShortError (), "" )
1169
1157
})
1158
+
1159
+ It ("should not attempt to create service account on component deletion" , func () {
1160
+ pacSecretData := map [string ]string {
1161
+ "github-application-id" : "12345" ,
1162
+ "github-private-key" : githubAppPrivateKey ,
1163
+ }
1164
+ createSecret (pacSecretKey , pacSecretData )
1165
+ createComponentAndProcessBuildRequest (componentConfig {
1166
+ componentKey : resourceCleanupKey ,
1167
+ annotations : defaultPipelineAnnotations ,
1168
+ }, BuildRequestConfigurePaCAnnotationValue )
1169
+ waitPaCFinalizerOnComponent (resourceCleanupKey )
1170
+
1171
+ waitPipelineServiceAccount (resourceCleanupKey .Namespace )
1172
+
1173
+ // Make sure that proper cleanup was invoked
1174
+ isRemovePaCPullRequestInvoked := false
1175
+ UndoPaCMergeRequestFunc = func (repoUrl string , d * gp.MergeRequestData ) (webUrl string , err error ) {
1176
+ isRemovePaCPullRequestInvoked = true
1177
+ return "merge-url" , nil
1178
+ }
1179
+
1180
+ deletePipelineServiceAccount (resourceCleanupKey .Namespace )
1181
+
1182
+ Expect (isRemovePaCPullRequestInvoked ).To (BeFalse ())
1183
+ // Clean up for the component should not recreate pipeline service account
1184
+ deleteComponent (resourceCleanupKey )
1185
+ Expect (isRemovePaCPullRequestInvoked ).To (BeTrue ())
1186
+
1187
+ pipelineServiceAccountKey := types.NamespacedName {Name : buildPipelineServiceAccountName , Namespace : resourceCleanupKey .Namespace }
1188
+ pipelineServiceAccount := & corev1.ServiceAccount {}
1189
+ err := k8sClient .Get (ctx , pipelineServiceAccountKey , pipelineServiceAccount )
1190
+ Expect (k8sErrors .IsNotFound (err )).To (BeTrue ())
1191
+ })
1170
1192
})
1171
1193
1172
1194
Context ("Test Pipelines as Code multi component git repository" , func () {
0 commit comments