@@ -27,8 +27,11 @@ import (
2727)
2828
2929const (
30- artifactName = "operator-controller-e2e"
31- pollDuration = time .Minute
30+ artifactName = "operator-controller-e2e"
31+ // pollDuration is set to 3 minutes to account for leader election time in multi-replica deployments.
32+ // In the worst case (previous leader crashed), leader election can take up to 163 seconds
33+ // (LeaseDuration: 137s + RetryPeriod: 26s). Adding buffer for reconciliation time.
34+ pollDuration = 3 * time .Minute
3235 pollInterval = time .Second
3336 testCatalogRefEnvVar = "CATALOG_IMG"
3437 testCatalogName = "test-catalog"
@@ -655,6 +658,8 @@ func TestClusterExtensionRecoversFromNoNamespaceWhenFailureFixed(t *testing.T) {
655658 // backoff of this eventually check we MUST ensure we do not touch the ClusterExtension
656659 // after creating int the Namespace and ServiceAccount.
657660 t .Log ("By eventually installing the package successfully" )
661+ // Use 5 minutes for recovery tests to account for exponential backoff after repeated failures
662+ // plus leader election time (up to 163s in worst case)
658663 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
659664 require .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
660665 cond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1 .TypeInstalled )
@@ -663,7 +668,7 @@ func TestClusterExtensionRecoversFromNoNamespaceWhenFailureFixed(t *testing.T) {
663668 require .Equal (ct , ocv1 .ReasonSucceeded , cond .Reason )
664669 require .Contains (ct , cond .Message , "Installed bundle" )
665670 require .NotEmpty (ct , clusterExtension .Status .Install )
666- }, pollDuration , pollInterval )
671+ }, 5 * time . Minute , pollInterval )
667672
668673 t .Log ("By eventually reporting Progressing == True with Reason Success" )
669674 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
@@ -777,6 +782,8 @@ func TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed(t *testi
777782 // backoff of this eventually check we MUST ensure we do not touch the ClusterExtension
778783 // after deleting the Deployment.
779784 t .Log ("By eventually installing the package successfully" )
785+ // Use 5 minutes for recovery tests to account for exponential backoff after repeated failures
786+ // plus leader election time (up to 163s in worst case)
780787 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
781788 require .NoError (ct , c .Get (context .Background (), types.NamespacedName {Name : clusterExtension .Name }, clusterExtension ))
782789 cond := apimeta .FindStatusCondition (clusterExtension .Status .Conditions , ocv1 .TypeInstalled )
@@ -785,7 +792,7 @@ func TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed(t *testi
785792 require .Equal (ct , ocv1 .ReasonSucceeded , cond .Reason )
786793 require .Contains (ct , cond .Message , "Installed bundle" )
787794 require .NotEmpty (ct , clusterExtension .Status .Install )
788- }, pollDuration , pollInterval )
795+ }, 5 * time . Minute , pollInterval )
789796
790797 t .Log ("By eventually reporting Progressing == True with Reason Success" )
791798 require .EventuallyWithT (t , func (ct * assert.CollectT ) {
0 commit comments