Skip to content

Port 1-092_validate_workload_status_monitoring_alert-test to Ginkgo#1065

Open
trdoyle81 wants to merge 4 commits intoredhat-developer:masterfrom
trdoyle81:GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert
Open

Port 1-092_validate_workload_status_monitoring_alert-test to Ginkgo#1065
trdoyle81 wants to merge 4 commits intoredhat-developer:masterfrom
trdoyle81:GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert

Conversation

@trdoyle81
Copy link
Copy Markdown
Member

What type of PR is this?

Uncomment only one /kind line, and delete the rest.
For example, > /kind bug would simply become: /kind bug

/kind enhancement

What does this PR do / why we need it:
Port the Kuttl test 1-092_validate_workload_status_monitoring_alert to Ginkgo. The test validates that the operator correctly manages Prometheus monitoring rules and alerts when enabled and verifies that alerts fire when an invalid image configuration causes a workload to degrade.

Moved tthe test to sequential from (kuttl) parallel test suite because it modifies shared cluster-wide resources. Running this test in parallel has caused race conditions and test flakes.

Have you updated the necessary documentation?

  • Documentation update is required by this PR.
  • Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #GITOPS-7204

Test acceptance criteria:

  • Unit Test
  • E2E Test

How to test changes / Special notes to the reviewer:
export GINKGO_TEST_SUITE="sequential"
export GINKGO_FOCUS="1-092_validate_workload_status_monitoring_alert"
./bin/ginkgo -v -focus $GINKGO_FOCUS -r ./test/openshift/e2e/ginkgo/$GINKGO_TEST_SUITE

@openshift-ci openshift-ci bot requested review from anandrkskd and jannfis February 4, 2026 09:32
@trdoyle81
Copy link
Copy Markdown
Member Author

/retest

@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from 4259324 to d1c9864 Compare February 4, 2026 15:12
@trdoyle81
Copy link
Copy Markdown
Member Author

/retest

@trdoyle81
Copy link
Copy Markdown
Member Author

/retest-required

@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch 2 times, most recently from 331f5e4 to ae55337 Compare February 9, 2026 13:54
@trdoyle81
Copy link
Copy Markdown
Member Author

/test v4.19-kuttl-sequential

@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from ae55337 to a724573 Compare February 16, 2026 09:39
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Feb 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign varshab1210 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from a724573 to 45a510d Compare February 16, 2026 16:11
@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch 2 times, most recently from bd779a0 to 2722a2e Compare March 3, 2026 13:45
@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from 2722a2e to 48bad9c Compare March 5, 2026 12:33
@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from 48bad9c to db1b776 Compare March 12, 2026 16:13
@trdoyle81
Copy link
Copy Markdown
Member Author

/retest

@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from 72233c8 to 1abd2ab Compare March 16, 2026 11:01
Triona Doyle added 4 commits March 25, 2026 15:16
Signed-off-by: Triona Doyle <bot@example.com>
Signed-off-by: Triona Doyle <bot@example.com>
Signed-off-by: Triona Doyle <bot@example.com>
Signed-off-by: Triona Doyle <bot@example.com>
@trdoyle81 trdoyle81 force-pushed the GITOPS-7204-Port-1-092_validate_workload_status_monitoring_alert branch from 1abd2ab to 68de5ed Compare March 25, 2026 15:23
err = k8sClient.Get(ctx, client.ObjectKeyFromObject(uwmConfigMap), existingCM)

DeferCleanup(func() {
_ = k8sClient.Delete(ctx, uwmConfigMap)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trdoyle81 uwmConfigMap is something that already exists on the cluster right? Should we just revert the changes that was made instead of deleting it?

Maybe we can move the function below where the creation takes place? That way we can either revert the changes or delete the configmap it was created using the test step


argocdFixture.Update(argoCDCluster, func(ac *argov1beta1api.ArgoCD) {
ac.Spec.ApplicationSet = &argov1beta1api.ArgoCDApplicationSet{Image: invalidImage}
ac.Spec.Monitoring = argov1beta1api.ArgoCDMonitoringSpec{Enabled: true, DisableMetrics: ptr.To(false)}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set DisableMetrics?

ac.Spec.Monitoring.DisableMetrics = ptr.To(true)
})

Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(argoCDNamespaced), argoCDNamespaced)).To(Succeed())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed IMO as we are going to delete this anyway

ac.Spec.Monitoring.DisableMetrics = ptr.To(true)
})

By("deleting cluster monitoring config")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

ruleNamespaced := &monitoringv1.PrometheusRule{
ObjectMeta: metav1.ObjectMeta{Name: prometheusRuleName, Namespace: nsNamespaced.Name},
}
appSetDeplCluster := &appsv1.Deployment{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be required as we are checking the appset directly

Eventually(ruleNamespaced, "3m", "5s").Should(k8sFixture.ExistByName(), "PrometheusRule should be created in test namespace")

By("verifying the ApplicationSet deployments are present")
Eventually(appSetDeplCluster).Should(k8sFixture.ExistByName())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to add one for the namespace scoped appset pod as well


By("verifying the workload degradation alerts are actively firing in Prometheus")
Eventually(func() bool {
cmd := exec.Command("oc", "exec", "-n", "openshift-monitoring", "prometheus-k8s-0", "-c", "prometheus", "--", "curl", "-s", "http://localhost:9090/api/v1/alerts")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to parse is via jq or some other tool as discussed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants