diff --git a/web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts b/web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts new file mode 100644 index 00000000..b56a464f --- /dev/null +++ b/web/cypress/e2e/coo/02.acm_alerting_ui.cy.ts @@ -0,0 +1,56 @@ +// 02.acm_alerting_ui.cy.ts +// E2E test for validating ACM Alerting UI integration with Cluster Observability Operator (COO) +import { commonPages } from '../../views/common'; +import { nav } from '../../views/nav'; + +const MCP = { + namespace: 'openshift-cluster-observability-operator', + packageName: 'cluster-observability-operator', + operatorName: 'Cluster Observability Operator', + config: { + kind: 'UIPlugin', + name: 'monitoring', + }, +}; + +const MP = { + namespace: 'openshift-monitoring', + operatorName: 'Cluster Monitoring Operator', +}; + +describe('ACM Alerting UI', () => { + before(() => { + cy.beforeBlockCOO(MCP, MP); + cy.log('=== [Setup] Installing ACM operator and MultiCluster Observability ==='); + // install acm through shell script + cy.exec('bash ./cypress/fixtures/coo/acm-install.sh', { + env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), }, + failOnNonZeroExit: false, + timeout: 600000, // long time script + }); + // update UIPlugin with the acm related content, (OCP enabled since installed from operatorHub) + cy.exec(`oc apply -f ./cypress/fixtures/coo/acm-uiplugin.yaml --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`); + // add thanos-ruler-custom-rules + cy.exec(`oc apply -f ./cypress/fixtures/coo/acm-alerrule-test.yaml --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`); + }); + + it('Admin perspective - Observe Menu', () => { + //cy.visit('/'); + nav.sidenav.clickNavLink(['Observe', 'Alerting']); + commonPages.titleShouldHaveText('Alerting'); + + // TO DO: + // Fleet Management => local-cluster => Observe => Alerting + + cy.log('✅ ACM Alerting UI test completed successfully'); + }); + +after(() => { + cy.log('=== [Teardown] Uninstalling ACM operator and cleaning up ==='); + cy.exec('bash ./cypress/fixtures/coo/acm-uninstall.sh', { + env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') }, + failOnNonZeroExit: false, + timeout: 600000, + }); +}); +}); diff --git a/web/cypress/fixtures/coo/acm-alerrule-test.yaml b/web/cypress/fixtures/coo/acm-alerrule-test.yaml new file mode 100644 index 00000000..5f2b564a --- /dev/null +++ b/web/cypress/fixtures/coo/acm-alerrule-test.yaml @@ -0,0 +1,42 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: thanos-ruler-custom-rules + namespace: open-cluster-management-observability +data: + custom_rules.yaml: | + groups: + - name: alertrule-testing + rules: + - alert: Watchdog + annotations: + summary: An alert that should always be firing to certify that Alertmanager is working properly. + description: This is an alert meant to ensure that the entire alerting pipeline is functional. + expr: vector(1) + labels: + instance: "local" + cluster: "local" + clusterID: "111111111" + severity: info + - alert: Watchdog-spoke + annotations: + summary: An alert that should always be firing to certify that Alertmanager is working properly. + description: This is an alert meant to ensure that the entire alerting pipeline is functional. + expr: vector(1) + labels: + instance: "spoke" + cluster: "spoke" + clusterID: "22222222" + severity: warn + - name: cluster-health + rules: + - alert: ClusterCPUHealth-jb + annotations: + summary: Notify when CPU utilization on a cluster is greater than the defined utilization limit + description: "The cluster has a high CPU usage: core for" + expr: | + max(cluster:cpu_usage_cores:sum) by (clusterID, cluster, prometheus) > 0 + labels: + cluster: "{{ $labels.cluster }}" + prometheus: "{{ $labels.prometheus }}" + severity: critical diff --git a/web/cypress/fixtures/coo/acm-install.sh b/web/cypress/fixtures/coo/acm-install.sh new file mode 100755 index 00000000..3711f920 --- /dev/null +++ b/web/cypress/fixtures/coo/acm-install.sh @@ -0,0 +1,168 @@ +#!/bin/bash +set -eux +oc patch Scheduler cluster --type='json' -p '[{ "op": "replace", "path": "/spec/mastersSchedulable", "value": true }]' + +oc apply -f - <