@@ -287,12 +287,14 @@ func getBuildPipelineNo(client runtimeclient.Client, g *WithT, no int) *tektonpi
287
287
return & build
288
288
}
289
289
290
+ /*
290
291
func getDeployPipeline(client runtimeclient.Client, g *WithT) *tektonpipeline.PipelineRun {
291
292
ctx := context.TODO()
292
293
build := tektonpipeline.PipelineRun{}
293
294
g.Expect(client.Get(ctx, types.NamespacedName{Namespace: metav1.NamespaceDefault, Name: "test-deploy"}, &build)).Should(BeNil())
294
295
return &build
295
296
}
297
+ */
296
298
297
299
func getBuildInfoPipeline (client runtimeclient.Client , g * WithT ) * tektonpipeline.PipelineRun {
298
300
return getBuildInfoPipelineNo (client , g , 0 )
@@ -380,65 +382,67 @@ func TestStateBuilding(t *testing.T) {
380
382
setup (g )
381
383
runSuccessfulBuild (g , client , ctx , reconciler , taskRunName )
382
384
383
- pr := getDeployPipeline (client , g )
384
- pr .Status .CompletionTime = & metav1.Time {Time : time .Now ()}
385
- pr .Status .SetCondition (& apis.Condition {
386
- Type : apis .ConditionSucceeded ,
387
- Status : "True" ,
388
- LastTransitionTime : apis.VolatileTime {Inner : metav1.Time {Time : time .Now ()}},
389
- })
390
- pr .Status .Results = []tektonpipeline.PipelineRunResult {{Name : PipelineResultDeployedResources , Value : tektonpipeline.ResultValue {Type : tektonpipeline .ParamTypeString , StringVal : TestArtifact }}}
391
- g .Expect (client .Status ().Update (ctx , pr )).Should (BeNil ())
385
+ //pr := getDeployPipeline(client, g)
386
+ //pr.Status.CompletionTime = &metav1.Time{Time: time.Now()}
387
+ //pr.Status.SetCondition(&apis.Condition{
388
+ // Type: apis.ConditionSucceeded,
389
+ // Status: "True",
390
+ // LastTransitionTime: apis.VolatileTime{Inner: metav1.Time{Time: time.Now()}},
391
+ //})
392
+ //pr.Status.Results = []tektonpipeline.PipelineRunResult{{Name: PipelineResultDeployedResources, Value: tektonpipeline.ResultValue{Type: tektonpipeline.ParamTypeString, StringVal: TestArtifact}}}
393
+ //g.Expect(client.Status().Update(ctx, pr)).Should(BeNil())
394
+ //db := getBuild(client, g)
395
+ //g.Expect(reconciler.Reconcile(ctx, reconcile.Request{NamespacedName: types.NamespacedName{Name: pr.Name, Namespace: pr.Namespace}}))
396
+ //g.Expect(reconciler.Reconcile(ctx, reconcile.Request{NamespacedName: types.NamespacedName{Name: db.Name, Namespace: db.Namespace}}))
392
397
db := getBuild (client , g )
393
- g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : pr .Name , Namespace : pr .Namespace }}))
394
- g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : db .Name , Namespace : db .Namespace }}))
395
- db = getBuild (client , g )
396
398
g .Expect (db .Status .State ).Should (Equal (v1alpha1 .DependencyBuildStateComplete ))
397
399
398
400
g .Expect (db .Status .DeployedArtifacts ).Should (ContainElement (TestArtifact ))
399
401
ra := v1alpha1.RebuiltArtifact {}
400
402
g .Expect (client .Get (ctx , types.NamespacedName {Name : artifactbuild .CreateABRName (TestArtifact ), Namespace : metav1 .NamespaceDefault }, & ra )).Should (Succeed ())
401
403
g .Expect (ra .Spec .GAV ).Should (Equal (TestArtifact ))
402
404
g .Expect (ra .Spec .Image ).ShouldNot (BeNil ())
403
- pr = getBuildPipeline (client , g )
405
+ pr : = getBuildPipeline (client , g )
404
406
g .Expect (len (pr .Finalizers )).Should (Equal (1 ))
405
407
406
408
g .Expect (client .Delete (ctx , pr )).Should (BeNil ())
407
409
g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Namespace : db .Namespace , Name : pr .Name }}))
408
410
g .Expect (client .Get (ctx , types.NamespacedName {Name : pr .Name , Namespace : pr .Namespace }, pr )).ShouldNot (Succeed ())
409
411
})
412
+ // TODO: ### Either remove or replace with verification step *but* the contaminants/verification is all tied to the build pipeline in dependencybuild.go
413
+ /*
414
+ t.Run("Test reconcile building DependencyBuild with failed deploy pipeline", func(t *testing.T) {
415
+ g := NewGomegaWithT(t)
416
+ setup(g)
417
+ runSuccessfulBuild(g, client, ctx, reconciler, taskRunName)
418
+
419
+ pr := getDeployPipeline(client, g)
420
+ pr.Status.CompletionTime = &metav1.Time{Time: time.Now()}
421
+ pr.Status.SetCondition(&apis.Condition{
422
+ Type: apis.ConditionSucceeded,
423
+ Status: "False",
424
+ LastTransitionTime: apis.VolatileTime{Inner: metav1.Time{Time: time.Now()}},
425
+ })
426
+ g.Expect(client.Status().Update(ctx, pr)).Should(BeNil())
427
+ g.Expect(reconciler.Reconcile(ctx, reconcile.Request{NamespacedName: types.NamespacedName{Name: pr.Name, Namespace: pr.Namespace}}))
428
+ db := getBuild(client, g)
429
+ g.Expect(db.Status.State).Should(Equal(v1alpha1.DependencyBuildStateFailed))
410
430
411
- t .Run ("Test reconcile building DependencyBuild with failed deploy pipeline" , func (t * testing.T ) {
412
- g := NewGomegaWithT (t )
413
- setup (g )
414
- runSuccessfulBuild (g , client , ctx , reconciler , taskRunName )
415
-
416
- pr := getDeployPipeline (client , g )
417
- pr .Status .CompletionTime = & metav1.Time {Time : time .Now ()}
418
- pr .Status .SetCondition (& apis.Condition {
419
- Type : apis .ConditionSucceeded ,
420
- Status : "False" ,
421
- LastTransitionTime : apis.VolatileTime {Inner : metav1.Time {Time : time .Now ()}},
422
431
})
423
- g .Expect (client .Status ().Update (ctx , pr )).Should (BeNil ())
424
- g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : pr .Name , Namespace : pr .Namespace }}))
425
- db := getBuild (client , g )
426
- g .Expect (db .Status .State ).Should (Equal (v1alpha1 .DependencyBuildStateFailed ))
427
432
428
- })
433
+ t.Run("Test reconcile building DependencyBuild with deleted deploy pipeline", func(t *testing.T) {
434
+ g := NewGomegaWithT(t)
435
+ setup(g)
436
+ runSuccessfulBuild(g, client, ctx, reconciler, taskRunName)
429
437
430
- t .Run ("Test reconcile building DependencyBuild with deleted deploy pipeline" , func (t * testing.T ) {
431
- g := NewGomegaWithT (t )
432
- setup (g )
433
- runSuccessfulBuild (g , client , ctx , reconciler , taskRunName )
438
+ pr := getDeployPipeline(client, g)
439
+ g.Expect(client.Delete(ctx, pr)).Should(Succeed())
440
+ g.Expect(reconciler.Reconcile(ctx, reconcile.Request{NamespacedName: types.NamespacedName{Name: pr.Name, Namespace: pr.Namespace}}))
441
+ db := getBuild(client, g)
442
+ g.Expect(db.Status.State).Should(Equal(v1alpha1.DependencyBuildStateFailed))
434
443
435
- pr := getDeployPipeline (client , g )
436
- g .Expect (client .Delete (ctx , pr )).Should (Succeed ())
437
- g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : pr .Name , Namespace : pr .Namespace }}))
438
- db := getBuild (client , g )
439
- g .Expect (db .Status .State ).Should (Equal (v1alpha1 .DependencyBuildStateFailed ))
440
-
441
- })
444
+ })
445
+ */
442
446
t .Run ("Test reconcile building DependencyBuild with failed pipeline" , func (t * testing.T ) {
443
447
g := NewGomegaWithT (t )
444
448
setup (g )
@@ -583,7 +587,7 @@ func runSuccessfulBuild(g *WithT, client runtimeclient.Client, ctx context.Conte
583
587
g .Expect (client .Status ().Update (ctx , pr )).Should (BeNil ())
584
588
g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : taskRunName }))
585
589
db := getBuild (client , g )
586
- g .Expect (db .Status .State ).Should (Equal (v1alpha1 .DependencyBuildStateDeploying ))
590
+ g .Expect (db .Status .State ).Should (Equal (v1alpha1 .DependencyBuildStateComplete ))
587
591
g .Expect (reconciler .Reconcile (ctx , reconcile.Request {NamespacedName : types.NamespacedName {Name : db .Name , Namespace : db .Namespace }}))
588
592
}
589
593
0 commit comments