Skip to content

Commit

Permalink
Merge pull request #5229 from openshift/rapid-deployment-detection
Browse files Browse the repository at this point in the history
NO-JIRA: test/e2e: detect rapidly updating deployments
  • Loading branch information
openshift-merge-bot[bot] authored Dec 13, 2024
2 parents dc7bd65 + d97908d commit 618a614
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/e2e/util/hypershift_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func (h *hypershiftTest) after(hostedCluster *hyperv1.HostedCluster, platform hy
EnsureAllContainersHavePullPolicyIfNotPresent(t, context.Background(), h.client, hostedCluster)
EnsureHCPContainersHaveResourceRequests(t, context.Background(), h.client, hostedCluster)
EnsureNoPodsWithTooHighPriority(t, context.Background(), h.client, hostedCluster)
EnsureNoRapidDeploymentRollouts(t, context.Background(), h.client, hostedCluster)
NoticePreemptionOrFailedScheduling(t, context.Background(), h.client, hostedCluster)
EnsureAllRoutesUseHCPRouter(t, context.Background(), h.client, hostedCluster)
EnsureNetworkPolicies(t, context.Background(), h.client, hostedCluster)
Expand Down
17 changes: 17 additions & 0 deletions test/e2e/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,23 @@ func NoticePreemptionOrFailedScheduling(t *testing.T, ctx context.Context, clien
})
}

func EnsureNoRapidDeploymentRollouts(t *testing.T, ctx context.Context, client crclient.Client, hostedCluster *hyperv1.HostedCluster) {
const maxAllowedGeneration = 10
t.Run("EnsureNoRapidDeploymentRollouts", func(t *testing.T) {
namespace := manifests.HostedControlPlaneNamespace(hostedCluster.Namespace, hostedCluster.Name)

var deploymentList appsv1.DeploymentList
if err := client.List(ctx, &deploymentList, crclient.InNamespace(namespace)); err != nil {
t.Fatalf("failed to list deployments in namespace %s: %v", namespace, err)
}
for _, deployment := range deploymentList.Items {
if deployment.Generation > maxAllowedGeneration {
t.Errorf("Rapidly updating deployment detected! Deployment %s exceeds the max allowed generation of %d", deployment.Name, maxAllowedGeneration)
}
}
})
}

func EnsureNoPodsWithTooHighPriority(t *testing.T, ctx context.Context, client crclient.Client, hostedCluster *hyperv1.HostedCluster) {
// Priority of the etcd priority class, nothing should ever exceed this.
const maxAllowedPriority = 100002000
Expand Down

0 comments on commit 618a614

Please sign in to comment.