Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions test/e2e/nodepool_additionalTrustBundlePropagation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ func (k *AdditionalTrustBundlePropagationTest) BuildNodePoolManifest(defaultNode
}

func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv1.NodePool, nodes []corev1.Node) {
const (
Comment thread
YamunadeviShanmugam marked this conversation as resolved.
nodePoolConfigUpdateStartTimeout = 5 * time.Minute
nodePoolConfigUpdateFinishTimeout = 20 * time.Minute
Comment thread
YamunadeviShanmugam marked this conversation as resolved.
defaultPollInterval = 15 * time.Second
cpoDeploymentUpdateTimeout = 10 * time.Minute
guestUserCABundlePropagationTimeout = 5 * time.Minute
)

t.Run("AdditionalTrustBundlePropagationTest", func(t *testing.T) {
e2eutil.AtLeast(t, e2eutil.Version418)

Expand Down Expand Up @@ -90,7 +98,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateStartTimeout),
)

e2eutil.EventuallyObject(t, k.ctx, fmt.Sprintf("Waiting for NodePool %s/%s to stop updating", nodePool.Namespace, nodePool.Name),
Expand All @@ -108,7 +116,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(20*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateFinishTimeout),
)

// Sanity check: ensure the user-ca-bundle exists in the guest cluster before removal to avoid false positives
Expand All @@ -127,7 +135,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
[]e2eutil.Predicate[*corev1.ConfigMap]{
func(obj *corev1.ConfigMap) (bool, string, error) { return true, "exists", nil },
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(guestUserCABundlePropagationTimeout),
)
}

Expand Down Expand Up @@ -164,6 +172,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
return true, "Additional trust bundle configmap is not included in CPO", nil
},
},
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(cpoDeploymentUpdateTimeout),
)

e2eutil.EventuallyObject(t, k.ctx, fmt.Sprintf("Waiting for NodePool %s/%s to begin updating", nodePool.Namespace, nodePool.Name),
Expand All @@ -177,7 +186,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateStartTimeout),
)

e2eutil.EventuallyObject(t, k.ctx, fmt.Sprintf("Waiting for NodePool %s/%s to stop updating", nodePool.Namespace, nodePool.Name),
Expand All @@ -195,7 +204,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(20*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateFinishTimeout),
)

// Ensure the user-ca-bundle configmap is deleted from the guest cluster
Expand All @@ -208,7 +217,7 @@ func (k *AdditionalTrustBundlePropagationTest) Run(t *testing.T, nodePool hyperv
},
}
e2eutil.EventuallyNotFound(t, k.ctx, k.guestClient, userCAConfigMap,
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(guestUserCABundlePropagationTimeout),
)
}
})
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/util/eventually.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

func defaultOptions() *EventuallyOptions {
return &EventuallyOptions{
interval: 3 * time.Second, // Increased from 1s to 2s globally to reduce API load
interval: 3 * time.Second, // Polling interval set globally to reduce API load
timeout: 10 * time.Minute,
immediate: true,
dumpConditions: true,
Expand Down
19 changes: 14 additions & 5 deletions test/e2e/v2/tests/nodepool_lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,14 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {

ctx := testCtx.Context

const (
defaultPollInterval = 15 * time.Second
nodePoolConfigUpdateStartTimeout = 5 * time.Minute
nodePoolConfigUpdateFinishTimeout = 20 * time.Minute
cpoDeploymentUpdateTimeout = 10 * time.Minute
guestUserCABundlePropagationTimeout = 5 * time.Minute
)

defaultNP := getDefaultNodePool(ctx, testCtx.MgmtClient, hc)
Expect(defaultNP).NotTo(BeNil(), "default NodePool should exist")

Expand Down Expand Up @@ -874,7 +882,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateStartTimeout),
)

e2eutil.EventuallyObject(GinkgoTB(), ctx, fmt.Sprintf("NodePool %s/%s to stop updating", np.Namespace, np.Name),
Expand All @@ -893,7 +901,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(20*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateFinishTimeout),
)

// Verify user-ca-bundle exists in the hosted cluster
Expand All @@ -912,7 +920,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
[]e2eutil.Predicate[*corev1.ConfigMap]{
func(obj *corev1.ConfigMap) (bool, string, error) { return true, "exists", nil },
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(guestUserCABundlePropagationTimeout),
)

// Remove trust bundle from HostedCluster
Expand Down Expand Up @@ -948,6 +956,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
return true, "trust bundle volume removed from CPO", nil
},
},
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(cpoDeploymentUpdateTimeout),
)

// Wait for NodePool to cycle again
Expand All @@ -963,7 +972,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(5*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateStartTimeout),
)

e2eutil.EventuallyObject(GinkgoTB(), ctx, fmt.Sprintf("NodePool %s/%s to stop updating after trust bundle removal", np.Namespace, np.Name),
Expand All @@ -982,7 +991,7 @@ func NodePoolTrustBundleTest(getTestCtx internal.TestContextGetter) {
Status: metav1.ConditionTrue,
}),
},
e2eutil.WithInterval(10*time.Second), e2eutil.WithTimeout(20*time.Minute),
e2eutil.WithInterval(defaultPollInterval), e2eutil.WithTimeout(nodePoolConfigUpdateFinishTimeout),
)

// Verify user-ca-bundle is deleted from the hosted cluster (4.22+)
Expand Down