@@ -2,7 +2,6 @@ package routingctrl_test
2
2
3
3
import (
4
4
"context"
5
- "errors"
6
5
"fmt"
7
6
8
7
. "github.com/onsi/ginkgo/v2"
@@ -434,62 +433,6 @@ var _ = Describe("Platform routing setup for the component", test.EnvTest(), fun
434
433
})
435
434
})
436
435
437
- When ("reconciling an object that is modified concurrently" , func () {
438
- It ("should successfully add the finalizer despite the conflict" , func (ctx context.Context ) {
439
- // when
440
- component , createErr := createComponentRequiringPlatformRouting (ctx , "conflict-test-component" , "external" , appNs .Name )
441
- Expect (createErr ).ToNot (HaveOccurred ())
442
- toRemove = append (toRemove , component )
443
-
444
- // Ensure the component doesn't have finalizers initially
445
- Expect (component .GetFinalizers ()).To (BeEmpty ())
446
-
447
- modifyComponent := func (ctx context.Context ) {
448
- updatedComponent := & unstructured.Unstructured {}
449
- updatedComponent .SetGroupVersionKind (component .GroupVersionKind ())
450
- Expect (envTest .Client .Get (ctx , types.NamespacedName {Name : component .GetName (), Namespace : component .GetNamespace ()}, updatedComponent )).To (Succeed ())
451
-
452
- annotations := updatedComponent .GetAnnotations ()
453
- if annotations == nil {
454
- annotations = make (map [string ]string )
455
- }
456
- annotations ["test-annotation" ] = "modified"
457
- updatedComponent .SetAnnotations (annotations )
458
-
459
- Expect (envTest .Client .Update (ctx , updatedComponent )).To (Succeed ())
460
- }
461
-
462
- // Simulate concurrent modifications by adding an annotation to the resource
463
- go func (ctx context.Context ) {
464
- defer GinkgoRecover ()
465
-
466
- modifyComponent (ctx )
467
-
468
- }(ctx )
469
-
470
- // Wait for the reconciliation to add finalizer successfully
471
- Eventually (func (ctx context.Context ) error {
472
- updatedComponent := & unstructured.Unstructured {}
473
- updatedComponent .SetGroupVersionKind (component .GroupVersionKind ())
474
- err := envTest .Client .Get (ctx , types.NamespacedName {Name : component .GetName (), Namespace : component .GetNamespace ()}, updatedComponent )
475
- if err != nil {
476
- return fmt .Errorf ("error getting component: %w" , err )
477
- }
478
-
479
- if len (updatedComponent .GetFinalizers ()) == 0 {
480
- return errors .New ("finalizers are empty" )
481
- }
482
-
483
- testAnnotation , exists := updatedComponent .GetAnnotations ()["test-annotation" ]
484
- if ! exists || testAnnotation != "modified" {
485
- return errors .New ("test-annotation is not set to 'modified'" )
486
- }
487
-
488
- return nil
489
- }).WithContext (ctx ).WithTimeout (test .DefaultTimeout * 2 ).WithPolling (test .DefaultPolling ).Should (Succeed ())
490
- })
491
- })
492
-
493
436
})
494
437
495
438
type exportMode string
0 commit comments