From dd3c44947c20c2ebb0362dd9f75ff6b1b4e51a80 Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 12 Aug 2026 09:08:38 -0400 Subject: [PATCH 1/5] refactor: rename to interceptWatchdogAlert --- web/cypress/e2e/alerts/alerts_bvt.cy.ts | 4 ++-- web/cypress/e2e/alerts/alerts_ivt.cy.ts | 4 ++-- web/cypress/e2e/alerts/alerts_regression.cy.ts | 8 ++++---- .../e2e/alerts/alerts_virtualization_bvt.cy.ts | 4 ++-- .../e2e/metrics/metrics_virtualization_ivt.cy.ts | 16 ++++++++-------- .../e2e/shared/admin_perspective_bvt.cy.ts | 4 ++-- web/cypress/fixtures/monitoring/alert.ts | 2 +- .../monitoring/03.reg_legacy_dashboards.cy.ts | 4 ++-- .../06.reg_legacy_dashboards_namespace.cy.ts | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/web/cypress/e2e/alerts/alerts_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_bvt.cy.ts index 4a27cb66d..451153f45 100644 --- a/web/cypress/e2e/alerts/alerts_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_bvt.cy.ts @@ -14,10 +14,10 @@ describe('BVT: Monitoring - Namespaced', { tags: ['@alerting', '@metrics'] }, () }); beforeEach(() => { - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); cy.changeNamespace(MP.namespace); }); diff --git a/web/cypress/e2e/alerts/alerts_ivt.cy.ts b/web/cypress/e2e/alerts/alerts_ivt.cy.ts index ed134261f..42bbcc0c9 100644 --- a/web/cypress/e2e/alerts/alerts_ivt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_ivt.cy.ts @@ -53,10 +53,10 @@ describe( nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); // Run tests in Virtualization perspective runAllRegressionAlertsTests({ diff --git a/web/cypress/e2e/alerts/alerts_regression.cy.ts b/web/cypress/e2e/alerts/alerts_regression.cy.ts index 049a7e602..d5b59afe3 100644 --- a/web/cypress/e2e/alerts/alerts_regression.cy.ts +++ b/web/cypress/e2e/alerts/alerts_regression.cy.ts @@ -20,13 +20,13 @@ describe( }); beforeEach(() => { - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); // Run tests in Core platform perspective @@ -45,10 +45,10 @@ describe( }); beforeEach(() => { - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); cy.changeNamespace(MP.namespace); }); diff --git a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts index f62c0d7da..730785346 100644 --- a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts @@ -53,10 +53,10 @@ describe('IVT: Monitoring + Virtualization', { tags: ['@metrics', '@alerting', ' nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); // Run tests in Administrator perspective diff --git a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts index d912c1ead..0cb8a4f30 100644 --- a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts @@ -52,11 +52,11 @@ describe( cy.validateLogin(); cy.switchPerspective('Virtualization'); guidedTour.closeKubevirtTour(); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); runAllRegressionMetricsTests1({ @@ -74,11 +74,11 @@ describe( cy.validateLogin(); cy.switchPerspective('Virtualization'); guidedTour.closeKubevirtTour(); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace(MP.namespace); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); runAllRegressionMetricsTestsNamespace1({ @@ -104,11 +104,11 @@ describe( cy.validateLogin(); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); runAllRegressionMetricsTests2({ @@ -126,11 +126,11 @@ describe( cy.validateLogin(); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace(MP.namespace); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); runAllRegressionMetricsTestsNamespace2({ diff --git a/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts b/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts index 7c2445512..05518e729 100644 --- a/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts +++ b/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts @@ -21,10 +21,10 @@ describe( nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); cy.changeNamespace('All Projects'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); }); it(`1. Admin perspective - Observe Menu`, () => { diff --git a/web/cypress/fixtures/monitoring/alert.ts b/web/cypress/fixtures/monitoring/alert.ts index 1a32dede3..442b815f3 100644 --- a/web/cypress/fixtures/monitoring/alert.ts +++ b/web/cypress/fixtures/monitoring/alert.ts @@ -1,7 +1,7 @@ import { WatchdogAlert } from './constants'; export const alerts = { - getWatchdogAlert: () => { + interceptWatchdogAlert: () => { cy.intercept('GET', '/api/prometheus/api/v1/rules?', { data: { groups: [ diff --git a/web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts b/web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts index 3f4155ba1..7306f86ca 100644 --- a/web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts +++ b/web/cypress/support/monitoring/03.reg_legacy_dashboards.cy.ts @@ -99,10 +99,10 @@ export function testLegacyDashboardsRegression(perspective: PerspectiveConfig) { cy.byTestID(DataTestIDs.MetricGraph).should('be.visible'); cy.log('4.3 Observe > Alerting rule details - Verify graph is visible'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`); listPage.ARRows.countShouldBe(1); listPage.ARRows.clickAlertingRule(); diff --git a/web/cypress/support/monitoring/06.reg_legacy_dashboards_namespace.cy.ts b/web/cypress/support/monitoring/06.reg_legacy_dashboards_namespace.cy.ts index 2e4185cdf..380bab2f8 100644 --- a/web/cypress/support/monitoring/06.reg_legacy_dashboards_namespace.cy.ts +++ b/web/cypress/support/monitoring/06.reg_legacy_dashboards_namespace.cy.ts @@ -101,7 +101,7 @@ export function testLegacyDashboardsRegressionNamespace(perspective: Perspective cy.log('4.3 Observe > Alerting rule details - Verify graph is visible'); nav.sidenav.clickNavLink(['Observe', 'Alerting']); - alerts.getWatchdogAlert(); + alerts.interceptWatchdogAlert(); listPage.filter.byName(`${WatchdogAlert.ALERTNAME}`); listPage.ARRows.countShouldBe(1); listPage.ARRows.clickAlertingRule(); From faef0989895be96107486fe3576ce1183f55da87 Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 12 Aug 2026 09:27:27 -0400 Subject: [PATCH 2/5] refactor: standardize MP and change name to CLUSTER_MONITORING_OPERATOR --- .cursor/commands/generate-regression-test.md | 21 +-- .../rules/incidents-testing-guidelines.mdc | 12 +- .../performance/03.endurance_test_source.md | 8 +- web/cypress/README.md | 10 +- web/cypress/e2e/alerts/alerts_acm.cy.ts | 8 +- web/cypress/e2e/alerts/alerts_bvt.cy.ts | 10 +- web/cypress/e2e/alerts/alerts_ivt.cy.ts | 8 +- .../e2e/alerts/alerts_regression.cy.ts | 12 +- .../alerts/alerts_virtualization_bvt.cy.ts | 8 +- web/cypress/e2e/incidents/incidents_bvt.cy.ts | 11 +- web/cypress/e2e/incidents/incidents_e2e.cy.ts | 11 +- .../incidents/incidents_mocking_example.cy.ts | 11 +- .../performance/performance_benchmark.cy.ts | 11 +- .../performance/performance_walkthrough.cy.ts | 11 +- .../regression/end_and_resolution.cy.ts | 11 +- .../e2e/incidents/regression/filtering.cy.ts | 11 +- .../e2e/incidents/regression/interval.cy.ts | 11 +- .../regression/permission_and_silences.cy.ts | 16 ++- .../incidents/regression/stress_test_ui.cy.ts | 11 +- .../incidents/regression/ui_interaction.cy.ts | 11 +- .../incidents/regression/ui_regressions.cy.ts | 11 +- .../legacy_dashboards_regression.cy.ts | 12 +- ...dashboards_virtualization_regression.cy.ts | 9 +- .../e2e/metrics/metrics_regression.cy.ts | 18 +-- .../metrics/metrics_virtualization_ivt.cy.ts | 13 +- .../perses_dashboards_bvt.cy.ts | 11 +- .../perses_dashboards_create.cy.ts | 6 - .../perses_dashboards_datasources.cy.ts | 16 ++- .../perses_dashboards_edit.cy.ts | 6 - .../perses_dashboards_import.cy.ts | 6 - .../perses_dashboards_list.cy.ts | 13 +- ...perses_dashboards_virtualization_ivt.cy.ts | 8 +- .../rbac/perses_dashboards_user1.cy.ts | 11 +- .../rbac/perses_dashboards_user2.cy.ts | 6 - .../rbac/perses_dashboards_user3.cy.ts | 6 - .../rbac/perses_dashboards_user4.cy.ts | 6 - .../rbac/perses_dashboards_user5.cy.ts | 6 - .../rbac/perses_dashboards_user6.cy.ts | 7 +- .../e2e/shared/admin_perspective_bvt.cy.ts | 8 +- web/cypress/e2e/shared/coo_submenus.cy.ts | 8 +- web/cypress/support/commands/auth-commands.ts | 15 ++- .../support/commands/image-patch-commands.ts | 118 ++++++++++++++-- .../support/commands/operator-commands.ts | 127 ++++++++++-------- web/cypress/support/operators.ts | 4 + 44 files changed, 337 insertions(+), 337 deletions(-) create mode 100644 web/cypress/support/operators.ts diff --git a/.cursor/commands/generate-regression-test.md b/.cursor/commands/generate-regression-test.md index 8af627c75..d16be993f 100644 --- a/.cursor/commands/generate-regression-test.md +++ b/.cursor/commands/generate-regression-test.md @@ -6,7 +6,6 @@ description: Generate automated regression test from test documentation Generate automated regression tests from test documentation in [`docs/incident_detection/tests/`](../../docs/incident_detection/tests/), following the style of existing tests in `@incidents/` and using `@incidents-page.ts` Page Object Model. - ## Process ### 1. Parse Test Documentation @@ -92,6 +91,7 @@ Verifies: OU-XXX */ import { incidentsPage } from "../../../views/incidents-page"; +import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; const MCP = { namespace: "openshift-cluster-observability-operator", @@ -103,14 +103,9 @@ const MCP = { }, }; -const MP = { - namespace: "openshift-monitoring", - operatorName: "Cluster Monitoring Operator", -}; - describe("Regression: [Section Name]", () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -491,8 +486,8 @@ Continue? (y/n/specify) **Automated checks (AI should verify):** - [ ] File naming matches `XX.reg_.cy.ts` -- [ ] Standard MCP/MP configuration blocks present -- [ ] Uses `cy.beforeBlockCOO(MCP, MP)` in `before()` hook +- [ ] Standard MCP/CLUSTER_MONITORING_OPERATOR configuration blocks present +- [ ] Uses `cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR)` in `before()` hook - [ ] Uses `incidentsPage.goTo()` in `beforeEach()` - [ ] Uses `cy.mockIncidentFixture()` with valid fixture path - [ ] No emojis in cy.log() statements @@ -540,6 +535,7 @@ Verifies: OU-XXX */ import { incidentsPage } from "../../../views/incidents-page"; +import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; const MCP = { namespace: "openshift-cluster-observability-operator", @@ -551,14 +547,9 @@ const MCP = { }, }; -const MP = { - namespace: "openshift-monitoring", - operatorName: "Cluster Monitoring Operator", -}; - describe("Regression: Tooltip Positioning", () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { diff --git a/.cursor/rules/incidents-testing-guidelines.mdc b/.cursor/rules/incidents-testing-guidelines.mdc index 8b8f01eb1..a390bbaf5 100644 --- a/.cursor/rules/incidents-testing-guidelines.mdc +++ b/.cursor/rules/incidents-testing-guidelines.mdc @@ -100,6 +100,7 @@ Verifies: OU-XXX */ import { incidentsPage } from '../../../views/incidents-page'; +import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; const MCP = { namespace: 'openshift-cluster-observability-operator', @@ -111,14 +112,9 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('Regression:
', () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -140,8 +136,8 @@ describe('Regression:
', () => { ### Required Elements - File header comment with purpose and issue reference (e.g., "Verifies: OU-XXX") - Import `incidentsPage` from relative path -- Standard MCP/MP configuration blocks -- Use `cy.beforeBlockCOO(MCP, MP)` in `before()` hook +- Standard MCP/CLUSTER_MONITORING_OPERATOR configuration blocks +- Use `cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR)` in `before()` hook - Use `incidentsPage.goTo()` in `beforeEach()` - Use `cy.mockIncidentFixture()` for test data diff --git a/docs/incident_detection/tests/performance/03.endurance_test_source.md b/docs/incident_detection/tests/performance/03.endurance_test_source.md index 749a604e9..cdeb3cc43 100644 --- a/docs/incident_detection/tests/performance/03.endurance_test_source.md +++ b/docs/incident_detection/tests/performance/03.endurance_test_source.md @@ -6,6 +6,7 @@ Shelved due to Cypress DOM snapshot accumulation causing ~10x degradation over 1 ```typescript import { incidentsPage } from "../../../views/incidents-page"; +import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; const MCP = { namespace: Cypress.env("COO_NAMESPACE"), @@ -17,11 +18,6 @@ const MCP = { }, }; -const MP = { - namespace: "openshift-monitoring", - operatorName: "Cluster Monitoring Operator", -}; - const INCIDENT_COUNT = 20; const CYCLES_PER_INCIDENT = 5; const TOTAL_CYCLES = INCIDENT_COUNT * CYCLES_PER_INCIDENT; @@ -40,7 +36,7 @@ describe( { tags: ["@cluster-health-analyzer"] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/README.md b/web/cypress/README.md index 2bec51cbe..eb3ba55ca 100644 --- a/web/cypress/README.md +++ b/web/cypress/README.md @@ -105,11 +105,11 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA ### Plugin Image Configuration -| Variable | Description | Use Case | -| --------------------------- | -------------------------------------- | ------------------------- | -| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom MP builds | -| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom MCP builds | -| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds | +| Variable | Description | Use Case | +| --------------------------- | -------------------------------------- | ------------------------------------------------- | +| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom CLUSTER_MONITORING_OPERATOR builds | +| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom MCP builds | +| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds | ### Operator Installation Control diff --git a/web/cypress/e2e/alerts/alerts_acm.cy.ts b/web/cypress/e2e/alerts/alerts_acm.cy.ts index f4b3e26a6..e2c85e043 100644 --- a/web/cypress/e2e/alerts/alerts_acm.cy.ts +++ b/web/cypress/e2e/alerts/alerts_acm.cy.ts @@ -8,6 +8,7 @@ import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; import { incidentsPage } from 'cypress/views/incidents-page'; import { runAllRegressionFleetManagementAlertsTests } from 'cypress/support/monitoring/01.reg_alerts.cy'; import { listPage } from 'cypress/views/list-page'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; const MCP = { namespace: Cypress.env('COO_NAMESPACE'), @@ -18,15 +19,12 @@ const MCP = { name: 'monitoring', }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; + const expectedAlerts = ['Watchdog', 'Watchdog-spoke', 'ClusterCPUHealth-jb']; describe('ACM Alerting UI', { tags: ['@alerting', '@acm-alerting'] }, () => { before(() => { - cy.beforeBlockACM(MCP, MP); + cy.beforeBlockACM(MCP, CLUSTER_MONITORING_OPERATOR); }); it('Navigate to Fleet Management > Observe > Alerting', () => { diff --git a/web/cypress/e2e/alerts/alerts_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_bvt.cy.ts index 451153f45..ab8588c8c 100644 --- a/web/cypress/e2e/alerts/alerts_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_bvt.cy.ts @@ -2,15 +2,11 @@ import { nav } from '../../views/nav'; import { alerts } from '../../fixtures/monitoring/alert'; import { runBVTMonitoringTestsNamespace } from '../../support/monitoring/00.bvt_monitoring_namespace.cy'; import { commonPages } from '../../views/common'; -// Set constants for the operators that need to be installed for tests. -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; describe('BVT: Monitoring - Namespaced', { tags: ['@alerting', '@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -18,7 +14,7 @@ describe('BVT: Monitoring - Namespaced', { tags: ['@alerting', '@metrics'] }, () nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); alerts.interceptWatchdogAlert(); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); // Run tests in Administrator perspective diff --git a/web/cypress/e2e/alerts/alerts_ivt.cy.ts b/web/cypress/e2e/alerts/alerts_ivt.cy.ts index 42bbcc0c9..5e7a59c4f 100644 --- a/web/cypress/e2e/alerts/alerts_ivt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_ivt.cy.ts @@ -1,3 +1,4 @@ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { alerts } from '../../fixtures/monitoring/alert'; import { runAllRegressionAlertsTests } from '../../support/monitoring/01.reg_alerts.cy'; import { commonPages } from '../../views/common'; @@ -15,11 +16,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const KBV = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', @@ -38,7 +34,7 @@ describe( { tags: ['@alerting', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/alerts/alerts_regression.cy.ts b/web/cypress/e2e/alerts/alerts_regression.cy.ts index d5b59afe3..b2bda7417 100644 --- a/web/cypress/e2e/alerts/alerts_regression.cy.ts +++ b/web/cypress/e2e/alerts/alerts_regression.cy.ts @@ -3,11 +3,7 @@ import { alerts } from '../../fixtures/monitoring/alert'; import { runAllRegressionAlertsTestsNamespace } from '../../support/monitoring/04.reg_alerts_namespace.cy'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; - -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Test suite for Core platform perspective describe( @@ -15,7 +11,7 @@ describe( { tags: ['@alerting', '@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); cy.switchPerspective('Core platform'); }); @@ -41,7 +37,7 @@ describe( { tags: ['@alerting'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -49,7 +45,7 @@ describe( nav.sidenav.clickNavLink(['Observe', 'Alerting']); commonPages.titleShouldHaveText('Alerting'); alerts.interceptWatchdogAlert(); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); // Run tests in Administrator perspective diff --git a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts index 730785346..bf9967dd7 100644 --- a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts @@ -4,6 +4,7 @@ import { alerts } from '../../fixtures/monitoring/alert'; import { nav } from '../../views/nav'; import { commonPages } from '../../views/common'; import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -16,11 +17,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const KBV = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', @@ -36,7 +32,7 @@ const KBV = { describe('IVT: Monitoring + Virtualization', { tags: ['@metrics', '@alerting', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/incidents/incidents_bvt.cy.ts b/web/cypress/e2e/incidents/incidents_bvt.cy.ts index c8f28d008..fa69fde8d 100644 --- a/web/cypress/e2e/incidents/incidents_bvt.cy.ts +++ b/web/cypress/e2e/incidents/incidents_bvt.cy.ts @@ -7,6 +7,7 @@ is irrelevant for toolbar/filter verification). Tests 4-5 switch mocks mid-test for empty state and traversal scenarios. */ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; const MCP = { @@ -19,14 +20,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('BVT: Incidents - UI', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); cy.mockIncidentFixture( 'incident-scenarios/1-single-incident-firing-critical-and-warning-alerts.yaml', diff --git a/web/cypress/e2e/incidents/incidents_e2e.cy.ts b/web/cypress/e2e/incidents/incidents_e2e.cy.ts index 90ae69acb..312e06a8e 100644 --- a/web/cypress/e2e/incidents/incidents_e2e.cy.ts +++ b/web/cypress/e2e/incidents/incidents_e2e.cy.ts @@ -2,6 +2,7 @@ The test verifies the whole lifecycle of the Incident feature, without any external dependencies. The run time can be 15 - 20 minutes. (Waiting untill the incident detection captures the new alert) */ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; // Set constants for the operators that need to be installed for tests. @@ -15,16 +16,14 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('BVT: Incidents - e2e', { tags: ['@slow', '@cluster-health-analyzer'] }, () => { let currentAlertName: string; before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); cy.cleanupIncidentPrometheusRules(); diff --git a/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts b/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts index 97e583567..3655b05d6 100644 --- a/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts +++ b/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts @@ -7,6 +7,7 @@ This test showcases different mocking approaches: 3. Demonstrating empty state handling */ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; const MCP = { @@ -19,14 +20,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('Incidents - Mocking Examples', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); beforeEach(() => { diff --git a/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts b/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts index 98efcef99..8475c313f 100644 --- a/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts +++ b/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts @@ -16,6 +16,7 @@ Verifies: OBSINTA-1006 import { incidentsPage } from '../../../views/incidents-page'; import { BenchmarkCollector } from '../../../support/benchmark-utils'; +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; const MCP = { namespace: Cypress.env('COO_NAMESPACE'), @@ -27,11 +28,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - // Wall-clock thresholds in ms. Includes Cypress overhead (navigation, intercept // wait, command scheduling). Set conservatively for initial calibration — tighten // after observing stable baselines in your environment. @@ -57,7 +53,10 @@ describe( { tags: ['@cluster-health-analyzer'], numTestsKeptInMemory: 0 }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); afterEach(() => { diff --git a/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts b/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts index d063f1ca4..c2c19bf09 100644 --- a/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts +++ b/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts @@ -10,6 +10,7 @@ Verifies: OBSINTA-1006 import { incidentsPage } from '../../../views/incidents-page'; import { BenchmarkCollector } from '../../../support/benchmark-utils'; +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; const MCP = { namespace: Cypress.env('COO_NAMESPACE'), @@ -21,11 +22,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const THRESHOLDS = { FILTER_APPLY: 3_000, FILTER_CLEAR: 800, @@ -41,7 +37,10 @@ describe( { tags: ['@cluster-health-analyzer'], numTestsKeptInMemory: 0 }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); afterEach(() => { diff --git a/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts b/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts index 0763ce8b4..0f15ea92c 100644 --- a/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts +++ b/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts @@ -17,6 +17,7 @@ Both tests require continuously firing alerts and cannot be tested with mocked d Verifies: OU-XXX (time-based resolution bugs) */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const MCP = { @@ -29,11 +30,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'Regression: Time-Based Alert Resolution (E2E with Firing Alerts)', { tags: ['@cluster-health-analyzer', '@slow'] }, @@ -41,7 +37,10 @@ describe( let currentAlertName: string; before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); // Reset the search timeout so this spec gets a fresh 35-minute window diff --git a/web/cypress/e2e/incidents/regression/filtering.cy.ts b/web/cypress/e2e/incidents/regression/filtering.cy.ts index 8e3e4d3e7..c1b914b79 100644 --- a/web/cypress/e2e/incidents/regression/filtering.cy.ts +++ b/web/cypress/e2e/incidents/regression/filtering.cy.ts @@ -8,6 +8,7 @@ Uses elements defined in incidents-page.ts for all interactions. Verifies: OU-727 */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const MCP = { @@ -20,14 +21,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('Regression: Incidents Filtering', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); beforeEach(() => { diff --git a/web/cypress/e2e/incidents/regression/interval.cy.ts b/web/cypress/e2e/incidents/regression/interval.cy.ts index dfc8cfadd..a5e75aa0c 100644 --- a/web/cypress/e2e/incidents/regression/interval.cy.ts +++ b/web/cypress/e2e/incidents/regression/interval.cy.ts @@ -11,6 +11,7 @@ with no 5-minute gap between End of one segment and Start of the next. */ /* eslint-disable @typescript-eslint/no-unused-expressions */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const MCP = { @@ -23,17 +24,15 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'Regression: Mixed Severity Interval Boundary Times', { tags: ['@cluster-health-analyzer', '@xfail'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); beforeEach(() => { diff --git a/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts b/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts index 0e8440f65..aeb614e1f 100644 --- a/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts +++ b/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts @@ -13,6 +13,7 @@ Tests: Verifies: OU-1020, OU-706, OU-1213 */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; import { nav } from '../../../views/nav'; @@ -26,17 +27,15 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'Regression: Silences Not Applied Correctly', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); }); @@ -143,7 +142,10 @@ describe( describe('Regression: Permission Denied Handling', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); }); beforeEach(() => { diff --git a/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts b/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts index ee8793ab7..e518b3c32 100644 --- a/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts +++ b/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts @@ -11,6 +11,7 @@ test is independent of timeline length. See WIP.stress-test-1000-alerts.cy.ts to the overflow with the original 5d timeline. */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const MCP = { @@ -23,17 +24,15 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const MAX_GAP_STANDARD = 250; const MAX_GAP_RELAXED = 500; describe('Regression: Stress Testing UI', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); }); diff --git a/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts b/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts index 8b636961e..dd2a10fcc 100644 --- a/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts +++ b/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts @@ -13,6 +13,7 @@ Test cases: Verifies: OU-1030 */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const MCP = { @@ -25,14 +26,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('Regression: Redux State Management', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); }); diff --git a/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts b/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts index e2d3b3f71..c73a02c65 100644 --- a/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts +++ b/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts @@ -10,6 +10,7 @@ This test loads comprehensive test data covering: */ +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const ARROW_HEIGHT = 12; @@ -95,14 +96,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe('Regression: Charts UI - Comprehensive', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: false, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: false, + troubleshootingPanel: false, + }); incidentsPage.warmUpForPlugin(); }); diff --git a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_regression.cy.ts b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_regression.cy.ts index 2eb3450be..3e4e8b6ad 100644 --- a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_regression.cy.ts +++ b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_regression.cy.ts @@ -1,20 +1,16 @@ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { runAllRegressionLegacyDashboardsTests } from '../../support/monitoring/03.reg_legacy_dashboards.cy'; import { runAllRegressionLegacyDashboardsTestsNamespace } from '../../support/monitoring/06.reg_legacy_dashboards_namespace.cy'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - // Test suite for Administrator perspective describe( 'Regression: Monitoring - Legacy Dashboards (Administrator)', { tags: ['@legacy-dashboards'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -42,13 +38,13 @@ describe( { tags: ['@legacy-dashboards', '@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { nav.sidenav.clickNavLink(['Observe', 'Dashboards']); commonPages.titleShouldHaveText('Dashboards'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); // Run tests in Administrator perspective diff --git a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts index 997234ed1..b44797664 100644 --- a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts +++ b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts @@ -1,3 +1,4 @@ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { runAllRegressionLegacyDashboardsTests } from '../../support/monitoring/03.reg_legacy_dashboards.cy'; import { runAllRegressionLegacyDashboardsTestsNamespace } from '../../support/monitoring/06.reg_legacy_dashboards_namespace.cy'; import { commonPages } from '../../views/common'; @@ -14,10 +15,6 @@ const MCP = { name: 'monitoring', }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; const KBV = { namespace: 'openshift-cnv', @@ -37,7 +34,7 @@ describe( { tags: ['@legacy-dashboards', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); @@ -71,7 +68,7 @@ describe( guidedTour.closeKubevirtTour(); nav.sidenav.clickNavLink(['Observe', 'Dashboards']); commonPages.titleShouldHaveText('Dashboards'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); runAllRegressionLegacyDashboardsTestsNamespace({ diff --git a/web/cypress/e2e/metrics/metrics_regression.cy.ts b/web/cypress/e2e/metrics/metrics_regression.cy.ts index 512c53d64..9d36dfee2 100644 --- a/web/cypress/e2e/metrics/metrics_regression.cy.ts +++ b/web/cypress/e2e/metrics/metrics_regression.cy.ts @@ -4,16 +4,12 @@ import { runAllRegressionMetricsTestsNamespace1 } from '../../support/monitoring import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring/05.reg_metrics_namespace_2.cy'; - -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Test suite for Administrator perspective describe('Regression: Monitoring - Metrics (Administrator)', { tags: ['@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -34,13 +30,13 @@ describe( { tags: ['@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); // Run tests in Administrator perspective @@ -53,7 +49,7 @@ describe( // Test suite for Administrator perspective describe('Regression: Monitoring - Metrics (Administrator)', { tags: ['@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -74,13 +70,13 @@ describe( { tags: ['@metrics'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); }); // Run tests in Administrator perspective diff --git a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts index 0cb8a4f30..96cd5828a 100644 --- a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts @@ -6,6 +6,7 @@ import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring/05.reg_metrics_namespace_2.cy'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -17,10 +18,6 @@ const MCP = { name: 'monitoring', }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; const KBV = { namespace: 'openshift-cnv', @@ -40,7 +37,7 @@ describe( { tags: ['@metrics', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); @@ -77,7 +74,7 @@ describe( alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); alerts.interceptWatchdogAlert(); }); @@ -92,7 +89,7 @@ describe( { tags: ['@metrics', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); @@ -129,7 +126,7 @@ describe( alerts.interceptWatchdogAlert(); nav.sidenav.clickNavLink(['Observe', 'Metrics']); commonPages.titleShouldHaveText('Metrics'); - cy.changeNamespace(MP.namespace); + cy.changeNamespace(CLUSTER_MONITORING_OPERATOR.namespace); alerts.interceptWatchdogAlert(); }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts index d559d3c4b..ed4965a19 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts @@ -1,6 +1,7 @@ import { nav } from '../../views/nav'; //TODO: rename after customizable-dashboards gets merged import { runBVTCOOPersesTests1 } from '../../support/perses/00.coo_bvt_perses_admin.cy'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -13,17 +14,15 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'BVT: COO - Dashboards (Perses) - Core platform perspective', { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: true, + troubleshootingPanel: false, + }); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts index 3a4544a14..fdd98df27 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts @@ -13,18 +13,12 @@ import { operatorAuthUtils } from '../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Create perses dashboard', { tags: ['@perses-dashboards'] }, () => { before(() => { - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts index e4e81cc0a..00395948e 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts @@ -1,3 +1,4 @@ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { runCOOCreateImportPersesTests } from '../../support/perses/05.coo_create_import_perses_admin.cy'; import { nav } from '../../views/nav'; @@ -12,11 +13,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const OTEL = { namespace: 'openshift-opentelemetry-operator', packageName: 'opentelemetry-product', @@ -59,7 +55,10 @@ describe( cy.cleanupLoggingUIPlugin(); cy.cleanupExtraDashboards(); - cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: true, + troubleshootingPanel: false, + }); cy.cleanupPersesTestDashboardsBeforeTests(); cy.setupPersesExtraDashboards(); cy.installDistributeTracingUIPlugin(); @@ -81,7 +80,10 @@ describe( cy.cleanupLoggingUIPlugin(); cy.cleanupDistributeTracingUIPlugin(); cy.cleanupExtraDashboards(); - cy.cleanupCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: true, + troubleshootingPanel: false, + }); cy.cleanupLoggingLoki(); cy.cleanupLogging(CLO); cy.cleanupLoki(LOKI); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts index b3618b6c8..d486541d6 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts @@ -14,18 +14,12 @@ import { operatorAuthUtils } from '../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Edit perses dashboard', { tags: ['@perses-dashboards'] }, () => { before(() => { - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts index 599f50059..3f8ec888b 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts @@ -13,18 +13,12 @@ import { operatorAuthUtils } from '../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Import perses dashboard', { tags: ['@perses-dashboards'] }, () => { before(() => { - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts index f3c86aafa..e469434d1 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts @@ -4,6 +4,7 @@ import { runCOOListPersesTests, } from '../../support/perses/01.coo_list_perses_admin.cy'; import { runCOOListPersesTestsNamespace } from '../../support/perses/01.coo_list_perses_admin_namespace.cy'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -16,18 +17,16 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - //TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - List perses dashboards', { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: true, + troubleshootingPanel: false, + }); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); }); @@ -54,7 +53,7 @@ describe( { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts index 0f5bc054f..79405c174 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts @@ -3,6 +3,7 @@ import { nav } from '../../views/nav'; import { runBVTCOOPersesTests1 } from '../../support/perses/00.coo_bvt_perses_admin.cy'; import { guidedTour } from '../../views/tour'; import { commonPages } from '../../views/common'; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -15,11 +16,6 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - const KBV = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', @@ -39,7 +35,7 @@ describe( () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts index 6d1e89a33..b7c1ae488 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts @@ -1,5 +1,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser1 } from '../../../support/perses/99.coo_rbac_perses_user1.cy'; +import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; // Set constants for the operators that need to be installed for tests. const MCP = { @@ -12,18 +13,16 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'RBAC User1: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, () => { before(() => { // Setup COO and Perses dashboards (requires admin privileges) - cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + dashboards: true, + troubleshootingPanel: false, + }); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); cy.setupPersesRBACandExtraDashboards(); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts index 629ba3621..0ed6cfb56 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts @@ -13,11 +13,6 @@ import { operatorAuthUtils } from '../../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User2: COO - Dashboards (Perses) - Administrator perspective', @@ -32,7 +27,6 @@ describe( // ); // Step 2: Setup COO and Perses dashboards (requires admin privileges) - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts index 01e4f1617..41873d8f8 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts @@ -13,11 +13,6 @@ import { operatorAuthUtils } from '../../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User3: COO - Dashboards (Perses) - Administrator perspective', @@ -32,7 +27,6 @@ describe( // ); // Step 2: Setup COO and Perses dashboards (requires admin privileges) - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts index 9b8847f42..8ba907816 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts @@ -13,11 +13,6 @@ import { operatorAuthUtils } from '../../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User4: COO - Dashboards (Perses) - Administrator perspective', @@ -32,7 +27,6 @@ describe( // ); // Step 2: Setup COO and Perses dashboards (requires admin privileges) - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts index b25ba23e7..8c64d1090 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts @@ -13,11 +13,6 @@ import { operatorAuthUtils } from '../../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User5: COO - Dashboards (Perses) - Administrator perspective', @@ -32,7 +27,6 @@ describe( // ); // Step 2: Setup COO and Perses dashboards (requires admin privileges) - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts index 6cccd61ae..064635722 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts @@ -13,11 +13,6 @@ import { operatorAuthUtils } from '../../../support/commands/auth-commands'; // }, // }; -// const MP = { -// namespace: 'openshift-monitoring', -// operatorName: 'Cluster Monitoring Operator', -// }; - //TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User6: COO - Dashboards (Perses) - Administrator perspective', @@ -32,8 +27,8 @@ describe( // ); // Step 2: Setup COO and Perses dashboards (requires admin privileges) - // cy.beforeBlockCOO(MCP, MP, { dashboards: true, troubleshootingPanel: false }); operatorAuthUtils.loginAndAuth(); + cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); cy.setupPersesRBACandExtraDashboards(); diff --git a/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts b/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts index 05518e729..f898e8eb6 100644 --- a/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts +++ b/web/cypress/e2e/shared/admin_perspective_bvt.cy.ts @@ -3,18 +3,14 @@ import { alerts } from '../../fixtures/monitoring/alert'; import { runBVTMonitoringTests } from '../../support/monitoring/00.bvt_monitoring.cy'; import { commonPages } from '../../views/common'; import { overviewPage } from '../../views/overview-page'; -// Set constants for the operators that need to be installed for tests. -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; describe( 'BVT: Monitoring', { tags: ['@alerting', '@legacy-dashboards', '@metrics', '@targets'] }, () => { before(() => { - cy.beforeBlock(MP); + cy.beforeBlock(CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { diff --git a/web/cypress/e2e/shared/coo_submenus.cy.ts b/web/cypress/e2e/shared/coo_submenus.cy.ts index 2f9c42e93..13b77e8ef 100644 --- a/web/cypress/e2e/shared/coo_submenus.cy.ts +++ b/web/cypress/e2e/shared/coo_submenus.cy.ts @@ -1,3 +1,4 @@ +import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { troubleshootingPanelPage } from '../../views/troubleshooting-panel'; @@ -13,17 +14,12 @@ const MCP = { }, }; -const MP = { - namespace: 'openshift-monitoring', - operatorName: 'Cluster Monitoring Operator', -}; - describe( 'BVT: COO', { tags: ['@alerting', '@cluster-health-analyzer', '@perses-dashboards', '@legacy-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, MP); + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); }); it('1. Admin perspective - Observe Menu', () => { diff --git a/web/cypress/support/commands/auth-commands.ts b/web/cypress/support/commands/auth-commands.ts index c05930213..d02ee1de2 100644 --- a/web/cypress/support/commands/auth-commands.ts +++ b/web/cypress/support/commands/auth-commands.ts @@ -118,7 +118,7 @@ export const operatorAuthUtils = { generateCOOSessionKey( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, ): string[] { const baseKey = [ Cypress.env('LOGIN_IDP'), @@ -126,8 +126,8 @@ export const operatorAuthUtils = { MCP.namespace, MCP.operatorName, MCP.packageName, - MP.namespace, - MP.operatorName, + CLUSTER_MONITORING_OPERATOR.namespace, + CLUSTER_MONITORING_OPERATOR.operatorName, ]; const envVars = [ Cypress.env('SKIP_ALL_INSTALL'), @@ -143,12 +143,15 @@ export const operatorAuthUtils = { return [...baseKey, ...envVars.map((v) => v || '')]; }, - generateMPSessionKey(MP: { namespace: string; operatorName: string }): string[] { + generateMPSessionKey(CLUSTER_MONITORING_OPERATOR: { + namespace: string; + operatorName: string; + }): string[] { const baseKey = [ Cypress.env('LOGIN_IDP'), Cypress.env('LOGIN_USERNAME'), - MP.namespace, - MP.operatorName, + CLUSTER_MONITORING_OPERATOR.namespace, + CLUSTER_MONITORING_OPERATOR.operatorName, ]; const envVars = [Cypress.env('SKIP_ALL_INSTALL'), Cypress.env('MP_IMAGE')]; return [...baseKey, ...envVars.map((v) => v || '')]; diff --git a/web/cypress/support/commands/image-patch-commands.ts b/web/cypress/support/commands/image-patch-commands.ts index 5bf3a6c60..391380dee 100644 --- a/web/cypress/support/commands/image-patch-commands.ts +++ b/web/cypress/support/commands/image-patch-commands.ts @@ -5,14 +5,14 @@ export {}; const readyTimeoutMilliseconds = Cypress.config('readyTimeoutMilliseconds') as number; export const imagePatchUtils = { - setupMonitoringPluginImage(MP: { namespace: string }): void { + setupMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR: { namespace: string }): void { cy.log('Set Monitoring Plugin image in operator CSV'); if (Cypress.env('MP_IMAGE')) { cy.exec('./cypress/fixtures/cmo/update-monitoring-plugin-image.sh', { env: { MP_IMAGE: Cypress.env('MP_IMAGE'), KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), - MP_NAMESPACE: `${MP.namespace}`, + MP_NAMESPACE: `${CLUSTER_MONITORING_OPERATOR.namespace}`, }, timeout: readyTimeoutMilliseconds, failOnNonZeroExit: true, @@ -23,10 +23,13 @@ export const imagePatchUtils = { waitForPodsReady( 'app.kubernetes.io/name=monitoring-plugin', - MP.namespace, + CLUSTER_MONITORING_OPERATOR.namespace, readyTimeoutMilliseconds, ); - cy.log(`Monitoring plugin pod is now running in namespace: ${MP.namespace}`); + cy.log( + `Monitoring plugin pod is now running in namespace: ` + + `${CLUSTER_MONITORING_OPERATOR.namespace}`, + ); cy.reload(true); } else { cy.log('MP_IMAGE is NOT set. Skipping patching the image in CMO operator CSV.'); @@ -180,14 +183,111 @@ export const imagePatchUtils = { checkAndFix(1); }, - revertMonitoringPluginImage(MP: { namespace: string }): void { + /** + * After the monitoring-console-plugin pod is running, verify it uses the + * expected CI image. If OLM reverted the CSV patch, re-apply it, patch the + * deployment directly, and wait until the pod rolls out with the correct image. + */ + verifyMonitoringConsolePluginImage(MCP: { namespace: string }): void { + const expectedImage = Cypress.env('MCP_CONSOLE_IMAGE'); + if (!expectedImage) { + return; + } + + cy.log('Verify monitoring-console-plugin pod image matches expected CI image'); + const kubeconfig = Cypress.env('KUBECONFIG_PATH'); + const maxAttempts = 5; + const ns = MCP.namespace; + + if (!/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/.test(ns)) { + throw new Error(`Invalid Kubernetes namespace: ${ns}`); + } + if (!/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]*$/.test(expectedImage)) { + throw new Error(`Invalid container image reference: ${expectedImage}`); + } + + const execEnv = { KUBECONFIG: kubeconfig, NS: ns }; + + const checkAndFix = (attempt: number): void => { + cy.exec( + 'oc get pods -l app.kubernetes.io/instance=monitoring -n "$NS" ' + + "-o jsonpath='{.items[0].spec.containers[0].image}'", + { failOnNonZeroExit: false, env: execEnv }, + ).then((result) => { + const currentImage = result.stdout.replace(/'/g, '').trim(); + cy.log( + `monitoring-console-plugin image check ` + + `(attempt ${attempt}/${maxAttempts}): ${currentImage}`, + ); + + if (currentImage === expectedImage) { + cy.log('monitoring-console-plugin pod image verified successfully'); + return; + } + + if (attempt >= maxAttempts) { + throw new Error( + `monitoring-console-plugin pod image mismatch after ${maxAttempts} attempts.\n` + + `Expected: ${expectedImage}\nActual: ${currentImage}`, + ); + } + + cy.log('Image mismatch detected. Re-patching CSV and deployment...'); + + cy.exec('./cypress/fixtures/coo/update-mcp-image.sh', { + env: { + MCP_CONSOLE_IMAGE: expectedImage, + KUBECONFIG: kubeconfig, + MCP_NAMESPACE: ns, + }, + timeout: readyTimeoutMilliseconds, + failOnNonZeroExit: false, + }); + + cy.exec( + 'oc get deployment -l app.kubernetes.io/instance=monitoring -n "$NS" ' + + "-o jsonpath='{.items[0].metadata.name}'", + { failOnNonZeroExit: false, env: execEnv }, + ).then((deployResult) => { + const deployName = deployResult.stdout.replace(/'/g, '').trim(); + if (deployName && /^[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/.test(deployName)) { + cy.log(`Patching deployment/${deployName} image directly`); + cy.exec( + 'oc patch deployment "$DEPLOY_NAME" -n "$NS" --type=json ' + + '-p "[{\\"op\\":\\"replace\\",\\"path\\":\\"/spec/template/spec/containers/0/image\\",' + + '\\"value\\":\\"$EXPECTED_IMAGE\\"}]"', + { + env: { + ...execEnv, + DEPLOY_NAME: deployName, + EXPECTED_IMAGE: expectedImage, + }, + }, + ); + cy.exec('oc rollout status deployment/"$DEPLOY_NAME" -n "$NS" --timeout=120s', { + timeout: 130000, + env: { ...execEnv, DEPLOY_NAME: deployName }, + }); + } + }); + + waitForPodsReady('app.kubernetes.io/instance=monitoring', ns, readyTimeoutMilliseconds); + + checkAndFix(attempt + 1); + }); + }; + + checkAndFix(1); + }, + + revertMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR: { namespace: string }): void { if (Cypress.env('MP_IMAGE')) { cy.log('MP_IMAGE is set. Lets revert CMO operator CSV'); cy.exec('./cypress/fixtures/cmo/reenable-monitoring.sh', { env: { MP_IMAGE: Cypress.env('MP_IMAGE'), KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), - MP_NAMESPACE: `${MP.namespace}`, + MP_NAMESPACE: `${CLUSTER_MONITORING_OPERATOR.namespace}`, }, timeout: readyTimeoutMilliseconds, failOnNonZeroExit: true, @@ -197,10 +297,12 @@ export const imagePatchUtils = { waitForPodsReadyOrAbsent( 'app.kubernetes.io/name=monitoring-plugin', - MP.namespace, + CLUSTER_MONITORING_OPERATOR.namespace, readyTimeoutMilliseconds, ); - cy.log(`Monitoring plugin pods verified in namespace: ${MP.namespace}`); + cy.log( + `Monitoring plugin pods verified in namespace: ${CLUSTER_MONITORING_OPERATOR.namespace}`, + ); cy.reload(true); }); diff --git a/web/cypress/support/commands/operator-commands.ts b/web/cypress/support/commands/operator-commands.ts index 4ff84759d..984fb2e70 100644 --- a/web/cypress/support/commands/operator-commands.ts +++ b/web/cypress/support/commands/operator-commands.ts @@ -22,27 +22,27 @@ declare global { // eslint-disable-next-line @typescript-eslint/no-namespace namespace Cypress { interface Chainable { - beforeBlock(MP: { namespace: string; operatorName: string }); - cleanupMP(MP: { namespace: string; operatorName: string }); + beforeBlock(CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }); + cleanupMP(CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }); beforeBlockCOO( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); cleanupCOO( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); RemoveClusterAdminRole(); setupCOO( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); beforeBlockACM( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, ): Chainable; waitForAcmAlertsFiring(alertNames?: string[]): Chainable; closeOnboardingModalIfPresent(): Chainable; @@ -67,13 +67,16 @@ function removeClusterAdminRole(): void { ); } -function collectDebugInfo(MP: { namespace: string }, MCP?: { namespace: string }): void { +function collectDebugInfo( + CLUSTER_MONITORING_OPERATOR: { namespace: string }, + MCP?: { namespace: string }, +): void { if (!Cypress.env('DEBUG')) { cy.log('DEBUG not set. Skipping operator debug information collection.'); return; } cy.aboutModal(); - cy.podImage('monitoring-plugin', MP.namespace); + cy.podImage('monitoring-plugin', CLUSTER_MONITORING_OPERATOR.namespace); if (MCP && MCP.namespace) { cy.podImage('monitoring', MCP.namespace); } @@ -180,59 +183,65 @@ function cleanupUIPlugin( // ── Cypress commands ─────────────────────────────────────────────── -Cypress.Commands.add('beforeBlock', (MP: { namespace: string; operatorName: string }) => { - if (useSession) { - const sessionKey = operatorAuthUtils.generateMPSessionKey(MP); - - cy.session( - sessionKey, - () => { - cy.log('Before block (session)'); - cy.cleanupMP(MP); - operatorAuthUtils.loginAndAuthNoSession(); - imagePatchUtils.setupMonitoringPluginImage(MP); - collectDebugInfo(MP); - cy.task('clearDownloads'); - cy.log('Before block (session) completed'); - }, - { - cacheAcrossSpecs: true, - validate() { - cy.validateLogin(); +Cypress.Commands.add( + 'beforeBlock', + (CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }) => { + if (useSession) { + const sessionKey = operatorAuthUtils.generateMPSessionKey(CLUSTER_MONITORING_OPERATOR); + + cy.session( + sessionKey, + () => { + cy.log('Before block (session)'); + cy.cleanupMP(CLUSTER_MONITORING_OPERATOR); + operatorAuthUtils.loginAndAuthNoSession(); + imagePatchUtils.setupMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); + collectDebugInfo(CLUSTER_MONITORING_OPERATOR); + cy.task('clearDownloads'); + cy.log('Before block (session) completed'); }, - }, - ); - } else { - cy.log('Before block (no session)'); - cy.cleanupMP(MP); - operatorAuthUtils.loginAndAuth(); - imagePatchUtils.setupMonitoringPluginImage(MP); - collectDebugInfo(MP); - cy.task('clearDownloads'); - cy.log('Before block (no session) completed'); - } -}); + { + cacheAcrossSpecs: true, + validate() { + cy.validateLogin(); + }, + }, + ); + } else { + cy.log('Before block (no session)'); + cy.cleanupMP(CLUSTER_MONITORING_OPERATOR); + operatorAuthUtils.loginAndAuth(); + imagePatchUtils.setupMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); + collectDebugInfo(CLUSTER_MONITORING_OPERATOR); + cy.task('clearDownloads'); + cy.log('Before block (no session) completed'); + } + }, +); -Cypress.Commands.add('cleanupMP', (MP: { namespace: string; operatorName: string }) => { - if (useSession) { - cy.log('cleanupMP (session)'); - imagePatchUtils.revertMonitoringPluginImage(MP); - cy.log('cleanupMP (session) completed'); - } -}); +Cypress.Commands.add( + 'cleanupMP', + (CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }) => { + if (useSession) { + cy.log('cleanupMP (session)'); + imagePatchUtils.revertMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); + cy.log('cleanupMP (session) completed'); + } + }, +); Cypress.Commands.add( 'beforeBlockCOO', ( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { const opts = { ...DEFAULT_COO_OPTIONS, ...options }; if (useSession) { const sessionKey = [ - ...operatorAuthUtils.generateCOOSessionKey(MCP, MP), + ...operatorAuthUtils.generateCOOSessionKey(MCP, CLUSTER_MONITORING_OPERATOR), `dash:${opts.dashboards}`, `tp:${opts.troubleshootingPanel}`, `cha:${opts.healthAnalyzer}`, @@ -242,9 +251,9 @@ Cypress.Commands.add( sessionKey, () => { cy.log('Before block COO (session)'); - cy.cleanupCOO(MCP, MP, opts); + cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); operatorAuthUtils.loginAndAuthNoSession(); - cy.setupCOO(MCP, MP, opts); + cy.setupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); cy.log('Before block COO (session) completed'); }, { @@ -260,9 +269,9 @@ Cypress.Commands.add( ); } else { cy.log('Before block COO (no session)'); - cy.cleanupCOO(MCP, MP, opts); + cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); operatorAuthUtils.loginAndAuth(); - cy.setupCOO(MCP, MP, opts); + cy.setupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); cy.log('Before block COO (no session) completed'); } }, @@ -272,7 +281,7 @@ Cypress.Commands.add( 'cleanupCOO', ( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { const opts = { ...DEFAULT_COO_OPTIONS, ...options }; @@ -288,7 +297,7 @@ Cypress.Commands.add( dashboardsUtils.cleanupTroubleshootingPanel(MCP); } cleanupUIPlugin(MCP, opts); - imagePatchUtils.revertMonitoringPluginImage(MP); + imagePatchUtils.revertMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); cy.log('Cleanup COO completed'); }, ); @@ -297,7 +306,7 @@ Cypress.Commands.add( 'setupCOO', ( MCP: { namespace: string; operatorName: string; packageName: string }, - MP: { namespace: string; operatorName: string }, + CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { const opts = { ...DEFAULT_COO_OPTIONS, ...options }; @@ -323,9 +332,9 @@ Cypress.Commands.add( if (opts.troubleshootingPanel) { dashboardsUtils.setupTroubleshootingPanel(MCP); } - imagePatchUtils.setupMonitoringPluginImage(MP); + imagePatchUtils.setupMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); removeClusterAdminRole(); - collectDebugInfo(MP, MCP); + collectDebugInfo(CLUSTER_MONITORING_OPERATOR, MCP); }, ); @@ -339,8 +348,8 @@ Cypress.Commands.add('waitForAcmAlertsFiring', (alertNames?: string[]) => { waitForAcmAlertsFiring(alertNames); }); -Cypress.Commands.add('beforeBlockACM', (MCP, MP) => { - cy.beforeBlockCOO(MCP, MP); +Cypress.Commands.add('beforeBlockACM', (MCP, CLUSTER_MONITORING_OPERATOR) => { + cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); cy.log('=== [Setup] Installing ACM test resources ==='); cy.exec('bash ./cypress/fixtures/coo/acm-install.sh', { env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') }, diff --git a/web/cypress/support/operators.ts b/web/cypress/support/operators.ts new file mode 100644 index 000000000..3f72e6f34 --- /dev/null +++ b/web/cypress/support/operators.ts @@ -0,0 +1,4 @@ +export const CLUSTER_MONITORING_OPERATOR = { + namespace: 'openshift-monitoring', + operatorName: 'Cluster Monitoring Operator', +}; From 52ddf5ed7d2e03f6ba7fbebebd4a47dbc6a886da Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 12 Aug 2026 09:57:28 -0400 Subject: [PATCH 3/5] refactor: standardize MCP and change name to CLUSTER_OBSERVABILITY_OPERATOR --- .cursor/commands/generate-regression-test.md | 44 ++-- .../rules/incidents-testing-guidelines.mdc | 18 +- .../performance/03.endurance_test_source.md | 27 +-- web/cypress.config.ts | 4 +- web/cypress/README.md | 10 +- web/cypress/e2e/alerts/alerts_acm.cy.ts | 18 +- web/cypress/e2e/alerts/alerts_ivt.cy.ts | 16 +- .../alerts/alerts_virtualization_bvt.cy.ts | 16 +- web/cypress/e2e/incidents/incidents_bvt.cy.ts | 17 +- web/cypress/e2e/incidents/incidents_e2e.cy.ts | 18 +- .../incidents/incidents_mocking_example.cy.ts | 17 +- .../performance/performance_benchmark.cy.ts | 17 +- .../performance/performance_walkthrough.cy.ts | 17 +- .../regression/end_and_resolution.cy.ts | 17 +- .../e2e/incidents/regression/filtering.cy.ts | 17 +- .../e2e/incidents/regression/interval.cy.ts | 17 +- .../regression/permission_and_silences.cy.ts | 19 +- .../incidents/regression/stress_test_ui.cy.ts | 17 +- .../incidents/regression/ui_interaction.cy.ts | 17 +- .../incidents/regression/ui_regressions.cy.ts | 16 +- ...dashboards_virtualization_regression.cy.ts | 17 +- .../metrics/metrics_virtualization_ivt.cy.ts | 19 +- .../lightspeed_integration.cy.ts | 2 +- .../perses_dashboards_bvt.cy.ts | 18 +- .../perses_dashboards_create.cy.ts | 12 - .../perses_dashboards_datasources.cy.ts | 18 +- .../perses_dashboards_edit.cy.ts | 12 - .../perses_dashboards_import.cy.ts | 12 - .../perses_dashboards_list.cy.ts | 20 +- ...perses_dashboards_virtualization_ivt.cy.ts | 18 +- .../rbac/perses_dashboards_user1.cy.ts | 18 +- .../rbac/perses_dashboards_user2.cy.ts | 12 - .../rbac/perses_dashboards_user3.cy.ts | 12 - .../rbac/perses_dashboards_user4.cy.ts | 12 - .../rbac/perses_dashboards_user5.cy.ts | 12 - .../rbac/perses_dashboards_user6.cy.ts | 12 - web/cypress/e2e/shared/coo_submenus.cy.ts | 18 +- web/cypress/fixtures/coo/coo_stage.sh | 11 +- web/cypress/support/commands/auth-commands.ts | 12 +- .../support/commands/coo-install-commands.ts | 133 ++++++----- .../support/commands/dashboards-commands.ts | 44 ++-- .../support/commands/image-patch-commands.ts | 12 +- .../support/commands/operator-commands.ts | 207 +++++++++++++----- .../commands/traces-logging-commands.ts | 4 +- .../mock-generators.ts | 2 +- web/cypress/support/operators.ts | 10 + 46 files changed, 454 insertions(+), 584 deletions(-) diff --git a/.cursor/commands/generate-regression-test.md b/.cursor/commands/generate-regression-test.md index d16be993f..2e7cfa50f 100644 --- a/.cursor/commands/generate-regression-test.md +++ b/.cursor/commands/generate-regression-test.md @@ -91,21 +91,17 @@ Verifies: OU-XXX */ import { incidentsPage } from "../../../views/incidents-page"; -import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; - -const MCP = { - namespace: "openshift-cluster-observability-operator", - packageName: "cluster-observability-operator", - operatorName: "Cluster Observability Operator", - config: { - kind: "UIPlugin", - name: "monitoring", - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from "../../../support/operators"; describe("Regression: [Section Name]", () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO( + CLUSTER_OBSERVABILITY_OPERATOR, + CLUSTER_MONITORING_OPERATOR, + ); }); beforeEach(() => { @@ -486,8 +482,8 @@ Continue? (y/n/specify) **Automated checks (AI should verify):** - [ ] File naming matches `XX.reg_.cy.ts` -- [ ] Standard MCP/CLUSTER_MONITORING_OPERATOR configuration blocks present -- [ ] Uses `cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR)` in `before()` hook +- [ ] Standard CLUSTER_OBSERVABILITY_OPERATOR/CLUSTER_MONITORING_OPERATOR configuration blocks present +- [ ] Uses `cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR)` in `before()` hook - [ ] Uses `incidentsPage.goTo()` in `beforeEach()` - [ ] Uses `cy.mockIncidentFixture()` with valid fixture path - [ ] No emojis in cy.log() statements @@ -535,21 +531,17 @@ Verifies: OU-XXX */ import { incidentsPage } from "../../../views/incidents-page"; -import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; - -const MCP = { - namespace: "openshift-cluster-observability-operator", - packageName: "cluster-observability-operator", - operatorName: "Cluster Observability Operator", - config: { - kind: "UIPlugin", - name: "monitoring", - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from "../../../support/operators"; describe("Regression: Tooltip Positioning", () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO( + CLUSTER_OBSERVABILITY_OPERATOR, + CLUSTER_MONITORING_OPERATOR, + ); }); beforeEach(() => { diff --git a/.cursor/rules/incidents-testing-guidelines.mdc b/.cursor/rules/incidents-testing-guidelines.mdc index a390bbaf5..d11b0809f 100644 --- a/.cursor/rules/incidents-testing-guidelines.mdc +++ b/.cursor/rules/incidents-testing-guidelines.mdc @@ -100,21 +100,11 @@ Verifies: OU-XXX */ import { incidentsPage } from '../../../views/incidents-page'; -import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; - -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR } from "../../../support/operators"; describe('Regression:
', () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); }); beforeEach(() => { @@ -136,8 +126,8 @@ describe('Regression:
', () => { ### Required Elements - File header comment with purpose and issue reference (e.g., "Verifies: OU-XXX") - Import `incidentsPage` from relative path -- Standard MCP/CLUSTER_MONITORING_OPERATOR configuration blocks -- Use `cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR)` in `before()` hook +- Standard CLUSTER_OBSERVABILITY_OPERATOR/CLUSTER_MONITORING_OPERATOR configuration blocks +- Use `cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR)` in `before()` hook - Use `incidentsPage.goTo()` in `beforeEach()` - Use `cy.mockIncidentFixture()` for test data diff --git a/docs/incident_detection/tests/performance/03.endurance_test_source.md b/docs/incident_detection/tests/performance/03.endurance_test_source.md index cdeb3cc43..4c969e6d3 100644 --- a/docs/incident_detection/tests/performance/03.endurance_test_source.md +++ b/docs/incident_detection/tests/performance/03.endurance_test_source.md @@ -6,17 +6,10 @@ Shelved due to Cypress DOM snapshot accumulation causing ~10x degradation over 1 ```typescript import { incidentsPage } from "../../../views/incidents-page"; -import { CLUSTER_MONITORING_OPERATOR } from "../../../support/operators"; - -const MCP = { - namespace: Cypress.env("COO_NAMESPACE"), - packageName: "cluster-observability-operator", - operatorName: "Cluster Observability Operator", - config: { - kind: "UIPlugin", - name: "monitoring", - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from "../../../support/operators"; const INCIDENT_COUNT = 20; const CYCLES_PER_INCIDENT = 5; @@ -36,10 +29,14 @@ describe( { tags: ["@cluster-health-analyzer"] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { - dashboards: false, - troubleshootingPanel: false, - }); + cy.beforeBlockCOO( + CLUSTER_OBSERVABILITY_OPERATOR, + CLUSTER_MONITORING_OPERATOR, + { + dashboards: false, + troubleshootingPanel: false, + }, + ); }); it("8.1 Endurance: Incident select/deselect cycling across 20 incidents", () => { diff --git a/web/cypress.config.ts b/web/cypress.config.ts index 492d3cf81..40e8b76b4 100644 --- a/web/cypress.config.ts +++ b/web/cypress.config.ts @@ -5,8 +5,8 @@ import * as path from 'path'; import registerCypressGrep from '@cypress/grep/src/plugin'; import { DefinePlugin, NormalModuleReplacementPlugin } from 'webpack'; import { - writeBenchmarkReport, injectBenchmarksIntoMochawesome, + writeBenchmarkReport, } from './cypress/plugins/benchmark-reporter'; const getLoginCredentials = (index: number): { username: string; password: string } => { @@ -55,7 +55,7 @@ export default defineConfig({ LOGIN_PASSWORD6: getLoginCredentials(6).password, TIMEZONE: process.env.CYPRESS_TIMEZONE || 'UTC', MOCK_NEW_METRICS: process.env.CYPRESS_MOCK_NEW_METRICS || 'false', - COO_NAMESPACE: process.env.CYPRESS_COO_NAMESPACE || 'openshift-cluster-observability-operator', + COO_NAMESPACE: 'openshift-cluster-observability-operator', typeDelay: 200, }, fixturesFolder: 'cypress/fixtures', diff --git a/web/cypress/README.md b/web/cypress/README.md index eb3ba55ca..70a35a53c 100644 --- a/web/cypress/README.md +++ b/web/cypress/README.md @@ -105,11 +105,11 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA ### Plugin Image Configuration -| Variable | Description | Use Case | -| --------------------------- | -------------------------------------- | ------------------------------------------------- | -| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom CLUSTER_MONITORING_OPERATOR builds | -| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom MCP builds | -| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds | +| Variable | Description | Use Case | +| --------------------------- | -------------------------------------- | ---------------------------------------------------- | +| `CYPRESS_MP_IMAGE` | Custom Monitoring Plugin image | Testing custom CLUSTER_MONITORING_OPERATOR builds | +| `CYPRESS_MCP_CONSOLE_IMAGE` | Custom Monitoring Console Plugin image | Testing custom CLUSTER_OBSERVABILITY_OPERATOR builds | +| `CYPRESS_CHA_IMAGE` | Custom cluster-health-analyzer image | Testing custom CHA builds | ### Operator Installation Control diff --git a/web/cypress/e2e/alerts/alerts_acm.cy.ts b/web/cypress/e2e/alerts/alerts_acm.cy.ts index e2c85e043..8e18d96e8 100644 --- a/web/cypress/e2e/alerts/alerts_acm.cy.ts +++ b/web/cypress/e2e/alerts/alerts_acm.cy.ts @@ -4,27 +4,21 @@ import '../../support/commands/auth-commands'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { acmAlertingPage } from '../../views/acm-alerting-page'; + import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; import { incidentsPage } from 'cypress/views/incidents-page'; import { runAllRegressionFleetManagementAlertsTests } from 'cypress/support/monitoring/01.reg_alerts.cy'; import { listPage } from 'cypress/views/list-page'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; - -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; const expectedAlerts = ['Watchdog', 'Watchdog-spoke', 'ClusterCPUHealth-jb']; describe('ACM Alerting UI', { tags: ['@alerting', '@acm-alerting'] }, () => { before(() => { - cy.beforeBlockACM(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockACM(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); }); it('Navigate to Fleet Management > Observe > Alerting', () => { diff --git a/web/cypress/e2e/alerts/alerts_ivt.cy.ts b/web/cypress/e2e/alerts/alerts_ivt.cy.ts index 5e7a59c4f..3027e6a8c 100644 --- a/web/cypress/e2e/alerts/alerts_ivt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_ivt.cy.ts @@ -1,4 +1,7 @@ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { alerts } from '../../fixtures/monitoring/alert'; import { runAllRegressionAlertsTests } from '../../support/monitoring/01.reg_alerts.cy'; import { commonPages } from '../../views/common'; @@ -6,15 +9,6 @@ import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; // Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; const KBV = { namespace: 'openshift-cnv', @@ -34,7 +28,7 @@ describe( { tags: ['@alerting', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts index bf9967dd7..cdda0a8de 100644 --- a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts @@ -4,18 +4,12 @@ import { alerts } from '../../fixtures/monitoring/alert'; import { nav } from '../../views/nav'; import { commonPages } from '../../views/common'; import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; // Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; const KBV = { namespace: 'openshift-cnv', @@ -32,7 +26,7 @@ const KBV = { describe('IVT: Monitoring + Virtualization', { tags: ['@metrics', '@alerting', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/incidents/incidents_bvt.cy.ts b/web/cypress/e2e/incidents/incidents_bvt.cy.ts index fa69fde8d..67e0cefc7 100644 --- a/web/cypress/e2e/incidents/incidents_bvt.cy.ts +++ b/web/cypress/e2e/incidents/incidents_bvt.cy.ts @@ -7,22 +7,15 @@ is irrelevant for toolbar/filter verification). Tests 4-5 switch mocks mid-test for empty state and traversal scenarios. */ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe('BVT: Incidents - UI', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/incidents_e2e.cy.ts b/web/cypress/e2e/incidents/incidents_e2e.cy.ts index 312e06a8e..5ea7361fc 100644 --- a/web/cypress/e2e/incidents/incidents_e2e.cy.ts +++ b/web/cypress/e2e/incidents/incidents_e2e.cy.ts @@ -2,25 +2,17 @@ The test verifies the whole lifecycle of the Incident feature, without any external dependencies. The run time can be 15 - 20 minutes. (Waiting untill the incident detection captures the new alert) */ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe('BVT: Incidents - e2e', { tags: ['@slow', '@cluster-health-analyzer'] }, () => { let currentAlertName: string; before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts b/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts index 3655b05d6..b86fe8995 100644 --- a/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts +++ b/web/cypress/e2e/incidents/incidents_mocking_example.cy.ts @@ -7,22 +7,15 @@ This test showcases different mocking approaches: 3. Demonstrating empty state handling */ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { incidentsPage } from '../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe('Incidents - Mocking Examples', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts b/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts index 8475c313f..1eb0e2125 100644 --- a/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts +++ b/web/cypress/e2e/incidents/performance/performance_benchmark.cy.ts @@ -16,17 +16,10 @@ Verifies: OBSINTA-1006 import { incidentsPage } from '../../../views/incidents-page'; import { BenchmarkCollector } from '../../../support/benchmark-utils'; -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; - -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; // Wall-clock thresholds in ms. Includes Cypress overhead (navigation, intercept // wait, command scheduling). Set conservatively for initial calibration — tighten @@ -53,7 +46,7 @@ describe( { tags: ['@cluster-health-analyzer'], numTestsKeptInMemory: 0 }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts b/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts index c2c19bf09..85ece765a 100644 --- a/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts +++ b/web/cypress/e2e/incidents/performance/performance_walkthrough.cy.ts @@ -10,17 +10,10 @@ Verifies: OBSINTA-1006 import { incidentsPage } from '../../../views/incidents-page'; import { BenchmarkCollector } from '../../../support/benchmark-utils'; -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; - -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; const THRESHOLDS = { FILTER_APPLY: 3_000, @@ -37,7 +30,7 @@ describe( { tags: ['@cluster-health-analyzer'], numTestsKeptInMemory: 0 }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts b/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts index 0f15ea92c..08ada85df 100644 --- a/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts +++ b/web/cypress/e2e/incidents/regression/end_and_resolution.cy.ts @@ -17,19 +17,12 @@ Both tests require continuously firing alerts and cannot be tested with mocked d Verifies: OU-XXX (time-based resolution bugs) */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe( 'Regression: Time-Based Alert Resolution (E2E with Firing Alerts)', { tags: ['@cluster-health-analyzer', '@slow'] }, @@ -37,7 +30,7 @@ describe( let currentAlertName: string; before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/filtering.cy.ts b/web/cypress/e2e/incidents/regression/filtering.cy.ts index c1b914b79..4e12db67c 100644 --- a/web/cypress/e2e/incidents/regression/filtering.cy.ts +++ b/web/cypress/e2e/incidents/regression/filtering.cy.ts @@ -8,22 +8,15 @@ Uses elements defined in incidents-page.ts for all interactions. Verifies: OU-727 */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe('Regression: Incidents Filtering', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/interval.cy.ts b/web/cypress/e2e/incidents/regression/interval.cy.ts index a5e75aa0c..c7a04b32c 100644 --- a/web/cypress/e2e/incidents/regression/interval.cy.ts +++ b/web/cypress/e2e/incidents/regression/interval.cy.ts @@ -11,25 +11,18 @@ with no 5-minute gap between End of one segment and Start of the next. */ /* eslint-disable @typescript-eslint/no-unused-expressions */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe( 'Regression: Mixed Severity Interval Boundary Times', { tags: ['@cluster-health-analyzer', '@xfail'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts b/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts index aeb614e1f..8af772a95 100644 --- a/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts +++ b/web/cypress/e2e/incidents/regression/permission_and_silences.cy.ts @@ -13,26 +13,19 @@ Tests: Verifies: OU-1020, OU-706, OU-1213 */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; import { nav } from '../../../views/nav'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe( 'Regression: Silences Not Applied Correctly', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); @@ -142,7 +135,7 @@ describe( describe('Regression: Permission Denied Handling', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts b/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts index e518b3c32..939ca55bb 100644 --- a/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts +++ b/web/cypress/e2e/incidents/regression/stress_test_ui.cy.ts @@ -11,25 +11,18 @@ test is independent of timeline length. See WIP.stress-test-1000-alerts.cy.ts to the overflow with the original 5d timeline. */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - const MAX_GAP_STANDARD = 250; const MAX_GAP_RELAXED = 500; describe('Regression: Stress Testing UI', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts b/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts index dd2a10fcc..477c2a9a0 100644 --- a/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts +++ b/web/cypress/e2e/incidents/regression/ui_interaction.cy.ts @@ -13,22 +13,15 @@ Test cases: Verifies: OU-1030 */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe('Regression: Redux State Management', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts b/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts index c73a02c65..eef2002a0 100644 --- a/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts +++ b/web/cypress/e2e/incidents/regression/ui_regressions.cy.ts @@ -10,7 +10,10 @@ This test loads comprehensive test data covering: */ -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; import { incidentsPage } from '../../../views/incidents-page'; const ARROW_HEIGHT = 12; @@ -86,19 +89,10 @@ function verifyIncidentBarIsVisible(index: number, context: string) { verifyIncidentBarDimensions(index, context); verifyIncidentBarHasVisiblePaths(index, context); } -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; describe('Regression: Charts UI - Comprehensive', { tags: ['@cluster-health-analyzer'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: false, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts index b44797664..8cb275ee6 100644 --- a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts +++ b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts @@ -1,4 +1,7 @@ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { runAllRegressionLegacyDashboardsTests } from '../../support/monitoring/03.reg_legacy_dashboards.cy'; import { runAllRegressionLegacyDashboardsTestsNamespace } from '../../support/monitoring/06.reg_legacy_dashboards_namespace.cy'; import { commonPages } from '../../views/common'; @@ -6,16 +9,6 @@ import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; // Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - const KBV = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', @@ -34,7 +27,7 @@ describe( { tags: ['@legacy-dashboards', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts index 96cd5828a..700c78cad 100644 --- a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts @@ -6,19 +6,12 @@ import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring/05.reg_metrics_namespace_2.cy'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; // Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - const KBV = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', @@ -37,7 +30,7 @@ describe( { tags: ['@metrics', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); @@ -89,7 +82,7 @@ describe( { tags: ['@metrics', '@slow'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/perses-dashboards/lightspeed_integration.cy.ts b/web/cypress/e2e/perses-dashboards/lightspeed_integration.cy.ts index f93101859..2f06db5eb 100644 --- a/web/cypress/e2e/perses-dashboards/lightspeed_integration.cy.ts +++ b/web/cypress/e2e/perses-dashboards/lightspeed_integration.cy.ts @@ -11,7 +11,7 @@ const PROMPT = 'visualize CPU consumption in the openshift-monitoring namespace // LLM responses can be slow under CI load or cold-start conditions const OLS_RESPONSE_TIMEOUT = 120_000; -const DASHBOARD_PROJECT = Cypress.env('COO_NAMESPACE'); +const DASHBOARD_PROJECT = 'openshift-cluster-observability-operator'; const DASHBOARD_NAME = 'OLS-test-dashboard-' + Math.random().toString(36).substring(2, 8); // Selectors prefixed with ols-plugin__ are defined in the OLS plugin repo (openshift-lightspeed) diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts index ed4965a19..bb6e6e043 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_bvt.cy.ts @@ -1,25 +1,17 @@ import { nav } from '../../views/nav'; //TODO: rename after customizable-dashboards gets merged import { runBVTCOOPersesTests1 } from '../../support/perses/00.coo_bvt_perses_admin.cy'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; - -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; describe( 'BVT: COO - Dashboards (Perses) - Core platform perspective', { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: true, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts index fdd98df27..7265534c0 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_create.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../views/nav'; import { runCOOCreatePersesTests } from '../../support/perses/03.coo_create_perses_admin.cy'; import { operatorAuthUtils } from '../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Create perses dashboard', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts index 00395948e..fcf55752c 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts @@ -1,17 +1,11 @@ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { runCOOCreateImportPersesTests } from '../../support/perses/05.coo_create_import_perses_admin.cy'; import { nav } from '../../views/nav'; // Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; const OTEL = { namespace: 'openshift-opentelemetry-operator', @@ -55,7 +49,7 @@ describe( cy.cleanupLoggingUIPlugin(); cy.cleanupExtraDashboards(); - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: true, troubleshootingPanel: false, }); @@ -80,7 +74,7 @@ describe( cy.cleanupLoggingUIPlugin(); cy.cleanupDistributeTracingUIPlugin(); cy.cleanupExtraDashboards(); - cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.cleanupCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: true, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts index d486541d6..7e3a28719 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_edit.cy.ts @@ -3,18 +3,6 @@ import { runCOOEditPersesTests1 } from '../../support/perses/02.coo_edit_perses_ import { runCOOEditPersesTests } from '../../support/perses/02.coo_edit_perses_admin.cy'; import { operatorAuthUtils } from '../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Edit perses dashboard', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts index 3f8ec888b..02480110a 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_import.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../views/nav'; import { runCOOImportPersesTests } from '../../support/perses/04.coo_import_perses_admin.cy'; import { operatorAuthUtils } from '../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @dashboards when customizable-dashboards gets merged describe( 'COO - Dashboards (Perses) - Import perses dashboard', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts index e469434d1..52af8a466 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_list.cy.ts @@ -4,18 +4,10 @@ import { runCOOListPersesTests, } from '../../support/perses/01.coo_list_perses_admin.cy'; import { runCOOListPersesTestsNamespace } from '../../support/perses/01.coo_list_perses_admin_namespace.cy'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; - -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; //TODO: change tag to @dashboards when customizable-dashboards gets merged describe( @@ -23,7 +15,7 @@ describe( { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: true, troubleshootingPanel: false, }); @@ -53,7 +45,7 @@ describe( { tags: ['@perses-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.switchPerspective('Core platform'); cy.cleanupPersesTestDashboardsBeforeTests(); }); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts index 79405c174..a32d0db3e 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts @@ -3,18 +3,10 @@ import { nav } from '../../views/nav'; import { runBVTCOOPersesTests1 } from '../../support/perses/00.coo_bvt_perses_admin.cy'; import { guidedTour } from '../../views/tour'; import { commonPages } from '../../views/common'; -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; - -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; const KBV = { namespace: 'openshift-cnv', @@ -35,7 +27,7 @@ describe( () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); cy.beforeBlockVirtualization(KBV); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts index b7c1ae488..a08badbef 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user1.cy.ts @@ -1,17 +1,9 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser1 } from '../../../support/perses/99.coo_rbac_perses_user1.cy'; -import { CLUSTER_MONITORING_OPERATOR } from '../../../support/operators'; - -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: 'openshift-cluster-observability-operator', - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../../support/operators'; describe( 'RBAC User1: COO - Dashboards (Perses) - Administrator perspective', @@ -19,7 +11,7 @@ describe( () => { before(() => { // Setup COO and Perses dashboards (requires admin privileges) - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR, { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, { dashboards: true, troubleshootingPanel: false, }); diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts index 0ed6cfb56..7b4492709 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user2.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser2 } from '../../../support/perses/99.coo_rbac_perses_user2.cy'; import { operatorAuthUtils } from '../../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User2: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts index 41873d8f8..fdf9ff0bf 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user3.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser3 } from '../../../support/perses/99.coo_rbac_perses_user3.cy'; import { operatorAuthUtils } from '../../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User3: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts index 8ba907816..f8d57870b 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user4.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser4 } from '../../../support/perses/99.coo_rbac_perses_user4.cy'; import { operatorAuthUtils } from '../../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User4: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts index 8c64d1090..946c0782e 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user5.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser5 } from '../../../support/perses/99.coo_rbac_perses_user5.cy'; import { operatorAuthUtils } from '../../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User5: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts index 064635722..c31d424a2 100644 --- a/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts +++ b/web/cypress/e2e/perses-dashboards/rbac/perses_dashboards_user6.cy.ts @@ -2,18 +2,6 @@ import { nav } from '../../../views/nav'; import { runCOORBACPersesTestsDevUser6 } from '../../../support/perses/99.coo_rbac_perses_user6.cy'; import { operatorAuthUtils } from '../../../support/commands/auth-commands'; -// Set constants for the operators that need to be installed for tests. -// const MCP = { -// namespace: 'openshift-cluster-observability-operator', -// packageName: 'cluster-observability-operator', -// operatorName: 'Cluster Observability Operator', -// config: { -// kind: 'UIPlugin', -// name: 'monitoring', -// }, -// }; - -//TODO: change tag to @smoke, @dashboards, @perses when customizable-dashboards gets merged describe( 'RBAC User6: COO - Dashboards (Perses) - Administrator perspective', { tags: ['@perses-dashboards'] }, diff --git a/web/cypress/e2e/shared/coo_submenus.cy.ts b/web/cypress/e2e/shared/coo_submenus.cy.ts index 13b77e8ef..6f9173512 100644 --- a/web/cypress/e2e/shared/coo_submenus.cy.ts +++ b/web/cypress/e2e/shared/coo_submenus.cy.ts @@ -1,25 +1,17 @@ -import { CLUSTER_MONITORING_OPERATOR } from '../../support/operators'; +import { + CLUSTER_MONITORING_OPERATOR, + CLUSTER_OBSERVABILITY_OPERATOR, +} from '../../support/operators'; import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { troubleshootingPanelPage } from '../../views/troubleshooting-panel'; -// Set constants for the operators that need to be installed for tests. -const MCP = { - namespace: Cypress.env('COO_NAMESPACE'), - packageName: 'cluster-observability-operator', - operatorName: 'Cluster Observability Operator', - config: { - kind: 'UIPlugin', - name: 'monitoring', - }, -}; - describe( 'BVT: COO', { tags: ['@alerting', '@cluster-health-analyzer', '@perses-dashboards', '@legacy-dashboards'] }, () => { before(() => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); }); it('1. Admin perspective - Observe Menu', () => { diff --git a/web/cypress/fixtures/coo/coo_stage.sh b/web/cypress/fixtures/coo/coo_stage.sh index d7d522852..cafc2d197 100755 --- a/web/cypress/fixtures/coo/coo_stage.sh +++ b/web/cypress/fixtures/coo/coo_stage.sh @@ -1,30 +1,27 @@ #!/bin/bash echo COO install through FBC -COO_NAMESPACE="${CYPRESS_COO_NAMESPACE:-openshift-cluster-observability-operator}" - oc apply -f - < cy .exec( - `oc get pods -n ${MCP.namespace} -o name --kubeconfig ${kubeconfig} ` + - '| grep observability-operator | grep -v bundle', + `oc get pods -n ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} -o name --kubeconfig ` + + `${kubeconfig} | grep observability-operator | grep -v bundle`, { failOnNonZeroExit: false }, ) .then((result) => result.code === 0 && result.stdout.trim().length > 0), { timeout: readyTimeoutMilliseconds, interval: 10000, - errorMsg: `Observability operator pod not found in namespace ${MCP.namespace}`, + errorMsg: + `Observability operator pod not found in namespace ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, }, ); cy.exec( - `oc get pods -n ${MCP.namespace} -o name --kubeconfig ${kubeconfig} ` + - '| grep observability-operator | grep -v bundle', + `oc get pods -n ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} -o name --kubeconfig ` + + `${kubeconfig} | grep observability-operator | grep -v bundle`, ) .its('stdout') .then((podOutput) => { @@ -141,12 +151,15 @@ export const cooInstallUtils = { cy.log(`Found COO pod: ${podName}`); cy.exec( - `oc wait --for=condition=Ready ${podName} -n ${MCP.namespace} ` + - `--timeout=120s --kubeconfig ${kubeconfig}`, + `oc wait --for=condition=Ready ${podName} -n ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace} --timeout=120s --kubeconfig ${kubeconfig}`, { timeout: readyTimeoutMilliseconds, failOnNonZeroExit: true }, ).then((result) => { expect(result.code).to.eq(0); - cy.log(`Observability-operator pod is now running in namespace: ${MCP.namespace}`); + cy.log( + `Observability-operator pod is now running in namespace: ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, + ); }); }); @@ -166,13 +179,13 @@ export const cooInstallUtils = { } }, - enableOpenShiftMode(MCP: { namespace: string }): void { + enableOpenShiftMode(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { if (!Cypress.env('KONFLUX_COO_BUNDLE_IMAGE') && !Cypress.env('CUSTOM_COO_BUNDLE_IMAGE')) { return; } const kubeconfig = Cypress.env('KUBECONFIG_PATH'); - const ns = MCP.namespace; + const ns = CLUSTER_OBSERVABILITY_OPERATOR.namespace; cy.log('Enabling OpenShift mode on bundle-installed COO'); // Patch the CSV so OLM's source of truth includes the flag. @@ -267,7 +280,7 @@ export const cooInstallUtils = { }); }, - cleanupCOONamespace(MCP: { namespace: string }): void { + cleanupCOONamespace(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { if (Cypress.env('SKIP_COO_INSTALL')) { return; } @@ -276,12 +289,13 @@ export const cooInstallUtils = { // For bundle installs, run operator-sdk cleanup first to remove // CatalogSource, registry pod, and other bundle-specific resources. - // The bundle package name is "observability-operator" (not the MCP.packageName + // The bundle package name is "observability-operator" + // (not the CLUSTER_OBSERVABILITY_OPERATOR.packageName // which is "cluster-observability-operator" used for catalog installs). if (Cypress.env('KONFLUX_COO_BUNDLE_IMAGE') || Cypress.env('CUSTOM_COO_BUNDLE_IMAGE')) { cy.exec( - `operator-sdk cleanup observability-operator -n ${MCP.namespace} ` + - `--kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + `operator-sdk cleanup observability-operator -n ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace} --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, { failOnNonZeroExit: false, timeout: 60000 }, ).then((result) => { if (result.code === 0) { @@ -292,21 +306,24 @@ export const cooInstallUtils = { }); } - cy.exec(`oc get namespace ${MCP.namespace} --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, { - timeout: readyTimeoutMilliseconds, - failOnNonZeroExit: false, - }).then((checkResult) => { + cy.exec( + `oc get namespace ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} --kubeconfig ${Cypress.env('KUBECONFIG_PATH')}`, + { + timeout: readyTimeoutMilliseconds, + failOnNonZeroExit: false, + }, + ).then((checkResult) => { if (checkResult.code === 0) { cy.log('Namespace exists, proceeding with deletion'); cy.exec( `oc delete csv --all -n ${ - MCP.namespace + CLUSTER_OBSERVABILITY_OPERATOR.namespace } --ignore-not-found --wait=false --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { timeout: 30000, failOnNonZeroExit: false }, ).then((result) => { if (result.code === 0) { - cy.log(`CSV deletion initiated in ${MCP.namespace}`); + cy.log(`CSV deletion initiated in ${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`); } else { cy.log(`CSV deletion failed or not found: ${result.stderr}`); } @@ -314,12 +331,14 @@ export const cooInstallUtils = { cy.exec( `oc delete subscription --all -n ${ - MCP.namespace + CLUSTER_OBSERVABILITY_OPERATOR.namespace } --ignore-not-found --wait=false --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { timeout: 30000, failOnNonZeroExit: false }, ).then((result) => { if (result.code === 0) { - cy.log(`Subscription deletion initiated in ${MCP.namespace}`); + cy.log( + `Subscription deletion initiated in ${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, + ); } else { cy.log(`Subscription deletion failed or not found: ${result.stderr}`); } @@ -327,12 +346,12 @@ export const cooInstallUtils = { cy.exec( `oc delete namespace ${ - MCP.namespace + CLUSTER_OBSERVABILITY_OPERATOR.namespace } --ignore-not-found --wait=false --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { timeout: 30000, failOnNonZeroExit: false }, ).then((result) => { if (result.code === 0) { - cy.log(`Namespace deletion initiated for ${MCP.namespace}`); + cy.log(`Namespace deletion initiated for ${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`); } else { cy.log(`Failed to initiate deletion: ${result.stderr}`); } @@ -348,14 +367,13 @@ export const cooInstallUtils = { if (elapsed > maxWaitTimeMs) { cy.log( `${elapsed}ms - Timeout reached (${maxWaitTimeMs / 60000}m). Namespace ${ - MCP.namespace + CLUSTER_OBSERVABILITY_OPERATOR.namespace } still terminating. Attempting force-delete.`, ); return cy .exec( - `./cypress/fixtures/coo/force_delete_ns.sh ${MCP.namespace} "${Cypress.env( - 'KUBECONFIG_PATH', - )}"`, + `./cypress/fixtures/coo/force_delete_ns.sh ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace} "${Cypress.env('KUBECONFIG_PATH')}"`, { failOnNonZeroExit: false, timeout: installTimeoutMilliseconds }, ) .then((result) => { @@ -367,27 +385,30 @@ export const cooInstallUtils = { } cy.exec( - `oc get ns ${MCP.namespace} --kubeconfig "${Cypress.env( + `oc get ns ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} --kubeconfig "${Cypress.env( 'KUBECONFIG_PATH', )}" -o jsonpath='{.status.phase}'`, { failOnNonZeroExit: false }, ).then((result) => { if (result.code !== 0) { - cy.log(`${elapsed}ms - ${MCP.namespace} is successfully deleted.`); + cy.log( + `${elapsed}ms - ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} is ` + + `successfully deleted.`, + ); return; } const status = result.stdout.trim(); if (status === 'Terminating') { cy.log( - `${elapsed}ms - ${MCP.namespace} is still 'Terminating'. Retrying in ${ - checkIntervalMs / 1000 - }s. Elapsed: ${Math.round(elapsed / 1000)}s`, + `${elapsed}ms - ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} is still ` + + `'Terminating'. Retrying in ${ + checkIntervalMs / 1000 + }s. Elapsed: ${Math.round(elapsed / 1000)}s`, ); cy.exec( - `./cypress/fixtures/coo/force_delete_ns.sh ${MCP.namespace} "${Cypress.env( - 'KUBECONFIG_PATH', - )}"`, + `./cypress/fixtures/coo/force_delete_ns.sh ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace} "${Cypress.env('KUBECONFIG_PATH')}"`, { failOnNonZeroExit: false, timeout: installTimeoutMilliseconds }, ).then((forceResult) => { cy.log(`${elapsed}ms - Force delete output: ${forceResult.stdout}`); @@ -400,8 +421,8 @@ export const cooInstallUtils = { cy.wait(checkIntervalMs).then(checkStatus); } else { cy.log( - `${elapsed}ms - ${MCP.namespace} changed to unexpected state: ${status}. ` + - 'Stopping monitoring.', + `${elapsed}ms - ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} changed to ` + + `unexpected state: ${status}. Stopping monitoring.`, ); } }); @@ -410,7 +431,7 @@ export const cooInstallUtils = { checkStatus(); cy.then(() => { - cooInstallUtils.waitForPodsDeleted(MCP.namespace, 300000); + cooInstallUtils.waitForPodsDeleted(CLUSTER_OBSERVABILITY_OPERATOR.namespace, 300000); }); } else { cy.log('Namespace does not exist, skipping deletion'); diff --git a/web/cypress/support/commands/dashboards-commands.ts b/web/cypress/support/commands/dashboards-commands.ts index b33cd87dd..45fed7c33 100644 --- a/web/cypress/support/commands/dashboards-commands.ts +++ b/web/cypress/support/commands/dashboards-commands.ts @@ -8,7 +8,7 @@ const readyTimeoutMilliseconds = Cypress.config('readyTimeoutMilliseconds') as n const installTimeoutMilliseconds = Cypress.config('installTimeoutMilliseconds') as number; export const dashboardsUtils = { - setupMonitoringUIPlugin(MCP: { namespace: string }): void { + setupMonitoringUIPlugin(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { cy.log('Create Monitoring UI Plugin instance.'); cy.exec( `oc apply -f ./cypress/fixtures/coo/monitoring-ui-plugin.yaml --kubeconfig ${Cypress.env( @@ -17,15 +17,18 @@ export const dashboardsUtils = { ); waitForPodsReady( 'app.kubernetes.io/instance=monitoring', - MCP.namespace, + CLUSTER_OBSERVABILITY_OPERATOR.namespace, readyTimeoutMilliseconds, ); - cy.log(`Monitoring plugin pod is now running in namespace: ${MCP.namespace}`); + cy.log( + `Monitoring plugin pod is now running in namespace: ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, + ); cy.checkForAlertRecursively(); cy.dynamicPluginWorkConsoleAround(); }, - setupDashboardsAndPlugins(MCP: { namespace: string }): void { + setupDashboardsAndPlugins(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { cy.log('Create perses-dev namespace.'); cy.exec(`oc new-project perses-dev --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { failOnNonZeroExit: false, @@ -67,32 +70,35 @@ export const dashboardsUtils = { ); cy.exec( - `oc label namespace ${MCP.namespace} ` + + `oc label namespace ${CLUSTER_OBSERVABILITY_OPERATOR.namespace} ` + `openshift.io/cluster-monitoring=true --overwrite=true ` + `--kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); waitForPodsReady( 'app.kubernetes.io/instance=perses', - MCP.namespace, + CLUSTER_OBSERVABILITY_OPERATOR.namespace, installTimeoutMilliseconds, ); - cy.log(`Perses-0 pod is now running in namespace: ${MCP.namespace}`); + cy.log(`Perses-0 pod is now running in namespace: ${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`); waitForResourceCondition( 'servicemonitor/health-analyzer', "jsonpath='{.metadata.name}'=health-analyzer", - MCP.namespace, + CLUSTER_OBSERVABILITY_OPERATOR.namespace, readyTimeoutMilliseconds, ); - cy.log(`Health-analyzer service monitor is now running in namespace: ${MCP.namespace}`); + cy.log( + `Health-analyzer service monitor is now running in namespace: ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, + ); cy.reload(true); cy.visit('/monitoring/v2/dashboards'); cy.url().should('include', '/monitoring/v2/dashboards'); }, - setupTroubleshootingPanel(MCP: { namespace: string }): void { + setupTroubleshootingPanel(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { cy.log('Create troubleshooting panel instance.'); cy.exec( `oc apply -f ./cypress/fixtures/coo/troubleshooting-panel-ui-plugin.yaml ` + @@ -102,17 +108,20 @@ export const dashboardsUtils = { cy.log('Troubleshooting panel instance created. Waiting for pods to be ready.'); waitForPodsReady( 'app.kubernetes.io/instance=troubleshooting-panel', - MCP.namespace, + CLUSTER_OBSERVABILITY_OPERATOR.namespace, readyTimeoutMilliseconds, ); - cy.log(`Troubleshooting panel pod is now running in namespace: ${MCP.namespace}`); + cy.log( + `Troubleshooting panel pod is now running in namespace: ` + + `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, + ); waitForPodsReady( 'app.kubernetes.io/instance=korrel8r', - MCP.namespace, + CLUSTER_OBSERVABILITY_OPERATOR.namespace, installTimeoutMilliseconds, ); - cy.log(`Korrel8r pod is now running in namespace: ${MCP.namespace}`); + cy.log(`Korrel8r pod is now running in namespace: ${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`); cy.checkForAlertRecursively(); cy.dynamicPluginWorkConsoleAround(); cy.reload(true); @@ -151,11 +160,14 @@ export const dashboardsUtils = { ); }, - cleanupTroubleshootingPanel(MCP: { + cleanupTroubleshootingPanel(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string; config1?: { kind: string; name: string }; }): void { - const config1 = MCP.config1 || { kind: 'UIPlugin', name: 'troubleshooting-panel' }; + const config1 = CLUSTER_OBSERVABILITY_OPERATOR.config1 || { + kind: 'UIPlugin', + name: 'troubleshooting-panel', + }; if (Cypress.env('SKIP_ALL_INSTALL')) { cy.log('SKIP_ALL_INSTALL is set. Skipping Troubleshooting Panel instance deletion.'); diff --git a/web/cypress/support/commands/image-patch-commands.ts b/web/cypress/support/commands/image-patch-commands.ts index 391380dee..f96217136 100644 --- a/web/cypress/support/commands/image-patch-commands.ts +++ b/web/cypress/support/commands/image-patch-commands.ts @@ -40,7 +40,7 @@ export const imagePatchUtils = { * Generic function to patch a component image in the COO CSV. */ patchCOOCSVImage( - MCP: { namespace: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }, config: { envVar: string; scriptPath: string; @@ -56,7 +56,7 @@ export const imagePatchUtils = { env: { [config.envVar]: imageValue, KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), - MCP_NAMESPACE: `${MCP.namespace}`, + MCP_NAMESPACE: `${CLUSTER_OBSERVABILITY_OPERATOR.namespace}`, }, timeout: readyTimeoutMilliseconds, failOnNonZeroExit: true, @@ -70,16 +70,16 @@ export const imagePatchUtils = { } }, - setupMonitoringConsolePlugin(MCP: { namespace: string }): void { - imagePatchUtils.patchCOOCSVImage(MCP, { + setupMonitoringConsolePlugin(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { + imagePatchUtils.patchCOOCSVImage(CLUSTER_OBSERVABILITY_OPERATOR, { envVar: 'MCP_CONSOLE_IMAGE', scriptPath: './cypress/fixtures/coo/update-mcp-image.sh', componentName: 'Monitoring Console Plugin', }); }, - setupClusterHealthAnalyzer(MCP: { namespace: string }): void { - imagePatchUtils.patchCOOCSVImage(MCP, { + setupClusterHealthAnalyzer(CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string }): void { + imagePatchUtils.patchCOOCSVImage(CLUSTER_OBSERVABILITY_OPERATOR, { envVar: 'CHA_IMAGE', scriptPath: './cypress/fixtures/coo/update-cha-image.sh', componentName: 'cluster-health-analyzer', diff --git a/web/cypress/support/commands/operator-commands.ts b/web/cypress/support/commands/operator-commands.ts index 984fb2e70..b652c7edb 100644 --- a/web/cypress/support/commands/operator-commands.ts +++ b/web/cypress/support/commands/operator-commands.ts @@ -25,23 +25,39 @@ declare global { beforeBlock(CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }); cleanupMP(CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }); beforeBlockCOO( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); cleanupCOO( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); RemoveClusterAdminRole(); setupCOO( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ); beforeBlockACM( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, ): Chainable; waitForAcmAlertsFiring(alertNames?: string[]): Chainable; @@ -69,7 +85,7 @@ function removeClusterAdminRole(): void { function collectDebugInfo( CLUSTER_MONITORING_OPERATOR: { namespace: string }, - MCP?: { namespace: string }, + CLUSTER_OBSERVABILITY_OPERATOR?: { namespace: string }, ): void { if (!Cypress.env('DEBUG')) { cy.log('DEBUG not set. Skipping operator debug information collection.'); @@ -77,8 +93,8 @@ function collectDebugInfo( } cy.aboutModal(); cy.podImage('monitoring-plugin', CLUSTER_MONITORING_OPERATOR.namespace); - if (MCP && MCP.namespace) { - cy.podImage('monitoring', MCP.namespace); + if (CLUSTER_OBSERVABILITY_OPERATOR && CLUSTER_OBSERVABILITY_OPERATOR.namespace) { + cy.podImage('monitoring', CLUSTER_OBSERVABILITY_OPERATOR.namespace); } } @@ -153,11 +169,82 @@ function waitForAcmAlertsFiring(alertNames: string[] = ACM_DEFAULT_TEST_ALERTS): ); } +/** + * Wait until ACM custom alert rules are evaluated and present in Alertmanager. + * oc apply of thanos-ruler-custom-rules only updates the ConfigMap; Thanos Ruler + * must reload/evaluate rules and push alerts to Alertmanager before the UI can show them. + */ +function waitForAcmAlertsFiring(alertNames: string[] = ACM_DEFAULT_TEST_ALERTS): void { + const kubeconfig = Cypress.env('KUBECONFIG_PATH'); + const ns = ACM_OBSERVABILITY_NS; + + cy.log(`Waiting for ACM alerts to become firing: ${alertNames.join(', ')}`); + + cy.log('Waiting for observability-thanos-rule pods to be Ready'); + cy.exec( + `oc rollout status statefulset/observability-thanos-rule ` + + `-n ${ns} --timeout=300s --kubeconfig "${kubeconfig}"`, + { failOnNonZeroExit: false, timeout: acmAlertReadyTimeoutMilliseconds }, + ).then((result) => { + if (result.code !== 0) { + cy.log( + `thanos-rule rollout status not ready yet (${result.stderr || result.stdout}); ` + + 'continuing to poll Alertmanager', + ); + } + }); + + cy.log('Waiting for ACM Alertmanager pods to be Ready'); + cy.exec( + `oc wait --for=condition=Ready pod ` + + `-l alertmanager=observability,app=multicluster-observability-alertmanager ` + + `-n ${ns} --timeout=300s --kubeconfig "${kubeconfig}"`, + { failOnNonZeroExit: false, timeout: acmAlertReadyTimeoutMilliseconds }, + ); + + cy.waitUntil( + () => + cy + .exec( + `POD=$(oc get pods -n ${ns} -l alertmanager=observability ` + + `--field-selector=status.phase=Running ` + + `-o jsonpath='{.items[0].metadata.name}' --kubeconfig "${kubeconfig}") && ` + + `test -n "$POD" && ` + + `(oc exec -n ${ns} "$POD" -c alertmanager --kubeconfig "${kubeconfig}" -- ` + + `amtool alert query --alertmanager.url=http://127.0.0.1:9093 || ` + + `oc exec -n ${ns} "$POD" -c alertmanager --kubeconfig "${kubeconfig}" -- ` + + `wget -qO- http://127.0.0.1:9093/api/v2/alerts)`, + { failOnNonZeroExit: false }, + ) + .then((result) => { + if (result.code !== 0 || !result.stdout) { + return false; + } + const missing = alertNames.filter((name) => !result.stdout.includes(name)); + if (missing.length > 0) { + // eslint-disable-next-line no-console + console.log(`ACM alerts still missing from Alertmanager: ${missing.join(', ')}`); + return false; + } + // eslint-disable-next-line no-console + console.log(`All expected ACM alerts found in Alertmanager: ${alertNames.join(', ')}`); + return true; + }), + { + timeout: acmAlertReadyTimeoutMilliseconds, + interval: 15000, + errorMsg: + `Timed out waiting for ACM alerts to fire in Alertmanager: ${alertNames.join(', ')}. ` + + 'ConfigMap may be applied but Thanos Ruler has not evaluated/pushed the alerts yet.', + }, + ); +} + function cleanupUIPlugin( - MCP: { namespace: string; config?: { kind: string; name: string } }, + CLUSTER_OBSERVABILITY_OPERATOR: { namespace: string; config?: { kind: string; name: string } }, opts: Required, ): void { - const config = MCP.config || { kind: 'UIPlugin', name: 'monitoring' }; + const config = CLUSTER_OBSERVABILITY_OPERATOR.config || { kind: 'UIPlugin', name: 'monitoring' }; cy.adminCLI( `oc adm policy add-cluster-role-to-user cluster-admin ${Cypress.env('LOGIN_USERNAME')}`, @@ -178,7 +265,7 @@ function cleanupUIPlugin( if (opts.dashboards) { dashboardsUtils.cleanupDashboards(); } - cooInstallUtils.cleanupCOONamespace(MCP); + cooInstallUtils.cleanupCOONamespace(CLUSTER_OBSERVABILITY_OPERATOR); } // ── Cypress commands ─────────────────────────────────────────────── @@ -233,7 +320,11 @@ Cypress.Commands.add( Cypress.Commands.add( 'beforeBlockCOO', ( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { @@ -241,7 +332,10 @@ Cypress.Commands.add( if (useSession) { const sessionKey = [ - ...operatorAuthUtils.generateCOOSessionKey(MCP, CLUSTER_MONITORING_OPERATOR), + ...operatorAuthUtils.generateCOOSessionKey( + CLUSTER_OBSERVABILITY_OPERATOR, + CLUSTER_MONITORING_OPERATOR, + ), `dash:${opts.dashboards}`, `tp:${opts.troubleshootingPanel}`, `cha:${opts.healthAnalyzer}`, @@ -251,9 +345,9 @@ Cypress.Commands.add( sessionKey, () => { cy.log('Before block COO (session)'); - cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); + cy.cleanupCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, opts); operatorAuthUtils.loginAndAuthNoSession(); - cy.setupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); + cy.setupCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, opts); cy.log('Before block COO (session) completed'); }, { @@ -269,9 +363,9 @@ Cypress.Commands.add( ); } else { cy.log('Before block COO (no session)'); - cy.cleanupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); + cy.cleanupCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, opts); operatorAuthUtils.loginAndAuth(); - cy.setupCOO(MCP, CLUSTER_MONITORING_OPERATOR, opts); + cy.setupCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR, opts); cy.log('Before block COO (no session) completed'); } }, @@ -280,7 +374,11 @@ Cypress.Commands.add( Cypress.Commands.add( 'cleanupCOO', ( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { @@ -294,9 +392,9 @@ Cypress.Commands.add( return; } if (opts.troubleshootingPanel) { - dashboardsUtils.cleanupTroubleshootingPanel(MCP); + dashboardsUtils.cleanupTroubleshootingPanel(CLUSTER_OBSERVABILITY_OPERATOR); } - cleanupUIPlugin(MCP, opts); + cleanupUIPlugin(CLUSTER_OBSERVABILITY_OPERATOR, opts); imagePatchUtils.revertMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); cy.log('Cleanup COO completed'); }, @@ -305,7 +403,11 @@ Cypress.Commands.add( Cypress.Commands.add( 'setupCOO', ( - MCP: { namespace: string; operatorName: string; packageName: string }, + CLUSTER_OBSERVABILITY_OPERATOR: { + namespace: string; + operatorName: string; + packageName: string; + }, CLUSTER_MONITORING_OPERATOR: { namespace: string; operatorName: string }, options?: COOSetupOptions, ) => { @@ -317,24 +419,24 @@ Cypress.Commands.add( ); return; } - cooInstallUtils.installCOO(MCP); - cooInstallUtils.waitForCOOReady(MCP); - cooInstallUtils.enableOpenShiftMode(MCP); - imagePatchUtils.setupMonitoringConsolePlugin(MCP); + cooInstallUtils.installCOO(CLUSTER_OBSERVABILITY_OPERATOR); + cooInstallUtils.waitForCOOReady(CLUSTER_OBSERVABILITY_OPERATOR); + cooInstallUtils.enableOpenShiftMode(CLUSTER_OBSERVABILITY_OPERATOR); + imagePatchUtils.setupMonitoringConsolePlugin(CLUSTER_OBSERVABILITY_OPERATOR); if (opts.healthAnalyzer) { - imagePatchUtils.setupClusterHealthAnalyzer(MCP); + imagePatchUtils.setupClusterHealthAnalyzer(CLUSTER_OBSERVABILITY_OPERATOR); } - dashboardsUtils.setupMonitoringUIPlugin(MCP); - imagePatchUtils.verifyMonitoringConsolePluginImage(MCP); + dashboardsUtils.setupMonitoringUIPlugin(CLUSTER_OBSERVABILITY_OPERATOR); + imagePatchUtils.verifyMonitoringConsolePluginImage(CLUSTER_OBSERVABILITY_OPERATOR); if (opts.dashboards) { - dashboardsUtils.setupDashboardsAndPlugins(MCP); + dashboardsUtils.setupDashboardsAndPlugins(CLUSTER_OBSERVABILITY_OPERATOR); } if (opts.troubleshootingPanel) { - dashboardsUtils.setupTroubleshootingPanel(MCP); + dashboardsUtils.setupTroubleshootingPanel(CLUSTER_OBSERVABILITY_OPERATOR); } imagePatchUtils.setupMonitoringPluginImage(CLUSTER_MONITORING_OPERATOR); removeClusterAdminRole(); - collectDebugInfo(CLUSTER_MONITORING_OPERATOR, MCP); + collectDebugInfo(CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR); }, ); @@ -348,27 +450,30 @@ Cypress.Commands.add('waitForAcmAlertsFiring', (alertNames?: string[]) => { waitForAcmAlertsFiring(alertNames); }); -Cypress.Commands.add('beforeBlockACM', (MCP, CLUSTER_MONITORING_OPERATOR) => { - cy.beforeBlockCOO(MCP, CLUSTER_MONITORING_OPERATOR); - cy.log('=== [Setup] Installing ACM test resources ==='); - cy.exec('bash ./cypress/fixtures/coo/acm-install.sh', { - env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') }, - failOnNonZeroExit: false, - timeout: 1200000, - }); - cy.exec( - `oc apply -f ./cypress/fixtures/coo/acm-uiplugin.yaml --kubeconfig ${Cypress.env( - 'KUBECONFIG_PATH', - )}`, - ); - cy.exec( - `oc apply -f ./cypress/fixtures/coo/acm-alerrule-test.yaml --kubeconfig ${Cypress.env( - 'KUBECONFIG_PATH', - )}`, - ); - cy.waitForAcmAlertsFiring(ACM_DEFAULT_TEST_ALERTS); - cy.log('ACM environment setup completed'); -}); +Cypress.Commands.add( + 'beforeBlockACM', + (CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR) => { + cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); + cy.log('=== [Setup] Installing ACM test resources ==='); + cy.exec('bash ./cypress/fixtures/coo/acm-install.sh', { + env: { KUBECONFIG: Cypress.env('KUBECONFIG_PATH') }, + failOnNonZeroExit: false, + timeout: 1200000, + }); + cy.exec( + `oc apply -f ./cypress/fixtures/coo/acm-uiplugin.yaml --kubeconfig ${Cypress.env( + 'KUBECONFIG_PATH', + )}`, + ); + cy.exec( + `oc apply -f ./cypress/fixtures/coo/acm-alerrule-test.yaml --kubeconfig ${Cypress.env( + 'KUBECONFIG_PATH', + )}`, + ); + cy.waitForAcmAlertsFiring(ACM_DEFAULT_TEST_ALERTS); + cy.log('ACM environment setup completed'); + }, +); Cypress.Commands.add('closeOnboardingModalIfPresent', () => { cy.get('body').then(($body) => { diff --git a/web/cypress/support/commands/traces-logging-commands.ts b/web/cypress/support/commands/traces-logging-commands.ts index 13d6f61ab..598e22915 100644 --- a/web/cypress/support/commands/traces-logging-commands.ts +++ b/web/cypress/support/commands/traces-logging-commands.ts @@ -45,7 +45,7 @@ const installTimeoutMilliseconds = Cypress.config('installTimeoutMilliseconds') const useSession = String(Cypress.env('SESSION')).toLowerCase() === 'true'; const DTP = { - namespace: Cypress.env('COO_NAMESPACE') || 'openshift-cluster-observability-operator', + namespace: 'openshift-cluster-observability-operator', packageName: 'cluster-observability-operator', operatorName: 'Cluster Observability Operator', config: { @@ -55,7 +55,7 @@ const DTP = { }; const LOGGING_PLUGIN = { - namespace: Cypress.env('COO_NAMESPACE') || 'openshift-cluster-observability-operator', + namespace: 'openshift-cluster-observability-operator', packageName: 'cluster-observability-operator', operatorName: 'Cluster Observability Operator', config: { diff --git a/web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts b/web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts index aa27800f9..2cdb9e9ee 100644 --- a/web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts +++ b/web/cypress/support/incidents_prometheus_query_mocks/mock-generators.ts @@ -160,7 +160,7 @@ export function createIncidentMock( endpoint: 'metrics', instance: '10.128.0.134:8443', job: 'health-analyzer', - namespace: Cypress.env('COO_NAMESPACE'), + namespace: 'openshift-cluster-observability-operator', pod: 'health-analyzer-55fc4cbbb6-5gjcv', prometheus: 'openshift-monitoring/k8s', service: 'health-analyzer', diff --git a/web/cypress/support/operators.ts b/web/cypress/support/operators.ts index 3f72e6f34..8acbb330b 100644 --- a/web/cypress/support/operators.ts +++ b/web/cypress/support/operators.ts @@ -2,3 +2,13 @@ export const CLUSTER_MONITORING_OPERATOR = { namespace: 'openshift-monitoring', operatorName: 'Cluster Monitoring Operator', }; + +export const CLUSTER_OBSERVABILITY_OPERATOR = { + namespace: 'openshift-cluster-observability-operator', + packageName: 'cluster-observability-operator', + operatorName: 'Cluster Observability Operator', + config: { + kind: 'UIPlugin', + name: 'monitoring', + }, +}; From d2d0139abe985d0de62c24988892a8e13e15393c Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 12 Aug 2026 10:19:12 -0400 Subject: [PATCH 4/5] refactor: standardize KNB and change name to HYPERCONVERGED_CLUSTER_OPERATOR and CNV --- web/cypress/README.md | 12 +- web/cypress/configure-env.sh | 823 +++++++++--------- web/cypress/e2e/alerts/alerts_ivt.cy.ts | 18 +- .../alerts/alerts_virtualization_bvt.cy.ts | 18 +- ...dashboards_virtualization_regression.cy.ts | 17 +- .../metrics/metrics_virtualization_ivt.cy.ts | 19 +- ...perses_dashboards_virtualization_ivt.cy.ts | 16 +- web/cypress/support/commands/auth-commands.ts | 8 +- .../commands/virtualization-commands.ts | 116 +-- web/cypress/support/operators.ts | 13 + 10 files changed, 513 insertions(+), 547 deletions(-) diff --git a/web/cypress/README.md b/web/cypress/README.md index 70a35a53c..d01adc2c3 100644 --- a/web/cypress/README.md +++ b/web/cypress/README.md @@ -74,7 +74,7 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA | ---------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | | **Released Version** | `CYPRESS_COO_UI_INSTALL=true` | Install operators from redhat-operators catalog. Production-like testing. | | **Pre-provisioned COO** | `CYPRESS_SKIP_COO_INSTALL=true`, optionally `CYPRESS_COO_NAMESPACE=` | COO already installed. Tests still enable the monitoring plugin. Specify namespace if non-default. | -| **Pre-provisioned Virtualization** | `CYPRESS_SKIP_KBV_INSTALL=true` | OpenShift Virtualization already installed. | +| **Pre-provisioned Virtualization** | `CYPRESS_SKIP_CNV_INSTALL=true` | OpenShift Virtualization already installed. | | **Local Dev / PR Testing** | `CYPRESS_SKIP_ALL_INSTALL=true` | Run UI locally via `make start-feature-frontend` ([details](../../README.md#development)). Skips all setup. | | **Custom Images** | `CYPRESS_MP_IMAGE`, `CYPRESS_MCP_CONSOLE_IMAGE`, `CYPRESS_CHA_IMAGE`, `CYPRESS_CUSTOM_COO_BUNDLE_IMAGE` | Patch component images in the CSV, or replace the operator bundle. Combine with an installation method above. | | **FBC Image** | `CYPRESS_FBC_STAGE_COO_IMAGE` | Install COO from File-Based Catalog image. For release validation. | @@ -116,10 +116,10 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA | Variable | Default | Description | | -------------------------- | ------- | -------------------------------------------------------------- | | `CYPRESS_SKIP_COO_INSTALL` | `false` | Skip Cluster Observability Operator installation | -| `CYPRESS_SKIP_KBV_INSTALL` | `false` | Skip OpenShift Virtualization installation | +| `CYPRESS_SKIP_CNV_INSTALL` | `false` | Skip OpenShift Virtualization installation | | `CYPRESS_SKIP_ALL_INSTALL` | `false` | Skip all operator installations (for pre-provisioned clusters) | | `CYPRESS_COO_UI_INSTALL` | `false` | Install COO from redhat-operators catalog | -| `CYPRESS_KBV_UI_INSTALL` | `false` | Install Virtualization from redhat-operators catalog | +| `CYPRESS_CNV_UI_INSTALL` | `false` | Install Virtualization from redhat-operators catalog | ### Bundle Images @@ -127,15 +127,15 @@ All scenarios require the [standard variables](#required-variables) (`CYPRESS_BA | ---------------------------------- | ---------------------------------------- | | `CYPRESS_KONFLUX_COO_BUNDLE_IMAGE` | COO bundle image from Konflux | | `CYPRESS_CUSTOM_COO_BUNDLE_IMAGE` | Custom COO bundle image | -| `CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE` | Virtualization bundle image from Konflux | -| `CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE` | Custom Virtualization bundle image | +| `CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE` | Virtualization bundle image from Konflux | +| `CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE` | Custom Virtualization bundle image | ### FBC images | Variable | Description | | ----------------------------- | ---------------------------------------- | | `CYPRESS_FBC_STAGE_COO_IMAGE` | Cluster Observability Operator FBC image | -| `CYPRESS_FBC_STAGE_KBV_IMAGE` | Virtualization FBC image | +| `CYPRESS_FBC_STAGE_CNV_IMAGE` | Virtualization FBC image | ### Testing Configuration diff --git a/web/cypress/configure-env.sh b/web/cypress/configure-env.sh index f2e74a153..d26906610 100755 --- a/web/cypress/configure-env.sh +++ b/web/cypress/configure-env.sh @@ -13,40 +13,40 @@ # When sourced from zsh, delegate to bash for the interactive prompts # (zsh doesn't support bash's `read -p`), then auto-source the result. if [[ -n "${ZSH_VERSION:-}" ]]; then - _cfg_dir="$(cd "$(dirname "$0")" && pwd)" - _cfg_out="$_cfg_dir/export-env.sh" - _CONFIGURE_ENV_AUTO_SOURCE=1 bash "$_cfg_dir/configure-env.sh" "$@" - _cfg_rc=$? - if [[ $_cfg_rc -eq 0 && -f "$_cfg_out" && "$*" != *--show* && "$*" != *-s* ]]; then - source "$_cfg_out" - echo "Exported variables into current shell." - fi - unset _cfg_dir _cfg_out _cfg_rc - return 0 2>/dev/null || exit 0 + _cfg_dir="$(cd "$(dirname "$0")" && pwd)" + _cfg_out="$_cfg_dir/export-env.sh" + _CONFIGURE_ENV_AUTO_SOURCE=1 bash "$_cfg_dir/configure-env.sh" "$@" + _cfg_rc=$? + if [[ $_cfg_rc -eq 0 && -f "$_cfg_out" && "$*" != *--show* && "$*" != *-s* ]]; then + source "$_cfg_out" + echo "Exported variables into current shell." + fi + unset _cfg_dir _cfg_out _cfg_rc + return 0 2>/dev/null || exit 0 fi is_sourced() { - [[ "${BASH_SOURCE[0]}" != "$0" ]] + [[ "${BASH_SOURCE[0]}" != "$0" ]] } if ! is_sourced; then - set -euo pipefail + set -euo pipefail fi SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" OUTPUT_FILE_DEFAULT="$SCRIPT_DIR/export-env.sh" print_header() { - echo "" - echo "========================================" - echo "Cypress environment setup" - echo "========================================" - echo "Values in brackets are defaults (press Enter to accept)." - echo "" + echo "" + echo "========================================" + echo "Cypress environment setup" + echo "========================================" + echo "Values in brackets are defaults (press Enter to accept)." + echo "" } print_usage() { - cat <<'EOF' + cat <<'EOF' Usage: configure-env.sh [--show] [--help] Options: @@ -59,431 +59,450 @@ EOF } section_header() { - echo "" - echo "--- $1 ---" - echo "" + echo "" + echo "--- $1 ---" + echo "" } ask() { - local prompt=$1 - local default_value=${2-} - local input - if [[ -n "$default_value" ]]; then - read -r -p "$prompt [$default_value]: " input || true - echo "${input:-$default_value}" - else - read -r -p "$prompt: " input || true - echo "$input" - fi + local prompt=$1 + local default_value=${2-} + local input + if [[ -n "$default_value" ]]; then + read -r -p "$prompt [$default_value]: " input || true + echo "${input:-$default_value}" + else + read -r -p "$prompt: " input || true + echo "$input" + fi } ask_required() { - local prompt=$1 - local default_value=${2-} - local value - while true; do - value=$(ask "$prompt" "$default_value") - if [[ -n "$value" ]]; then - echo "$value" - return 0 - fi - echo "Value is required. Please enter a value." 1>&2 - done + local prompt=$1 + local default_value=${2-} + local value + while true; do + value=$(ask "$prompt" "$default_value") + if [[ -n "$value" ]]; then + echo "$value" + return 0 + fi + echo "Value is required. Please enter a value." 1>&2 + done } ask_yes_no() { - local prompt=$1 - local default_answer=${2:-n} - local suffix="[y/N]" - [[ "$default_answer" =~ ^[Yy]$ ]] && suffix="[Y/n]" - local yn - while true; do - read -r -p "$prompt $suffix: " yn || true - yn=${yn:-$default_answer} - case "$yn" in - [Yy]|[Yy][Ee][Ss]) echo "y"; return 0;; - [Nn]|[Nn][Oo]) echo "n"; return 0;; - "") [[ "$default_answer" =~ ^[Yy]$ ]] && echo "y" || echo "n"; return 0;; - esac - echo "Please answer y or n." 1>&2 - done + local prompt=$1 + local default_answer=${2:-n} + local suffix="[y/N]" + [[ "$default_answer" =~ ^[Yy]$ ]] && suffix="[Y/n]" + local yn + while true; do + read -r -p "$prompt $suffix: " yn || true + yn=${yn:-$default_answer} + case "$yn" in + [Yy] | [Yy][Ee][Ss]) + echo "y" + return 0 + ;; + [Nn] | [Nn][Oo]) + echo "n" + return 0 + ;; + "") + [[ "$default_answer" =~ ^[Yy]$ ]] && echo "y" || echo "n" + return 0 + ;; + esac + echo "Please answer y or n." 1>&2 + done } bool_to_default_yn() { - local v=${1-} - v=$(echo "$v" | tr '[:upper:]' '[:lower:]') - case "$v" in - true|1|yes|y) echo "y" ;; + local v=${1-} + v=$(echo "$v" | tr '[:upper:]' '[:lower:]') + case "$v" in + true | 1 | yes | y) echo "y" ;; *) echo "n" ;; - esac + esac } escape_for_single_quotes() { - # shellcheck disable=SC2001 - sed "s/'/'\\''/g" + # shellcheck disable=SC2001 + sed "s/'/'\\''/g" } write_exports_file() { - local file_path=$1 - shift - local -a lines=("$@") - { - echo "# Generated by configure-env.sh on $(date -u '+%Y-%m-%dT%H:%M:%SZ')" - echo "# shellcheck shell=bash" - echo "# Source this file to export Cypress variables for this repository" - echo "" - for line in "${lines[@]}"; do - echo "$line" - done - } > "$file_path" - echo "Wrote $file_path" + local file_path=$1 + shift + local -a lines=("$@") + { + echo "# Generated by configure-env.sh on $(date -u '+%Y-%m-%dT%H:%M:%SZ')" + echo "# shellcheck shell=bash" + echo "# Source this file to export Cypress variables for this repository" + echo "" + for line in "${lines[@]}"; do + echo "$line" + done + } >"$file_path" + echo "Wrote $file_path" } # Interactively pick a kubeconfig from ~/Downloads or manual entry. # Prints the chosen path to stdout; UI messages go to stderr. pick_kubeconfig_interactive() { - if [[ -d "$HOME/Downloads" ]]; then - local kubeconfig_files=() - while IFS= read -r file; do - kubeconfig_files+=("$file") - done < <(ls -t "$HOME/Downloads"/*kubeconfig* 2>/dev/null | head -10) - - if [[ ${#kubeconfig_files[@]} -gt 0 ]]; then - echo "" >&2 - echo "Available kubeconfig files in Downloads:" >&2 - local i - for i in "${!kubeconfig_files[@]}"; do - local file_size - file_size=$(du -h "${kubeconfig_files[$i]}" 2>/dev/null | cut -f1) - echo " $((i+1))) ${kubeconfig_files[$i]##*/} (${file_size:-unknown size})" >&2 - done - echo " $(( ${#kubeconfig_files[@]} + 1 ))) Enter custom path" >&2 - - local choice - while true; do - choice=$(ask "Choose kubeconfig (1-$(( ${#kubeconfig_files[@]} + 1 )))" "") - if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le $(( ${#kubeconfig_files[@]} + 1 )) ]]; then - break + if [[ -d "$HOME/Downloads" ]]; then + local kubeconfig_files=() + while IFS= read -r file; do + kubeconfig_files+=("$file") + done < <(ls -t "$HOME/Downloads"/*kubeconfig* 2>/dev/null | head -10) + + if [[ ${#kubeconfig_files[@]} -gt 0 ]]; then + echo "" >&2 + echo "Available kubeconfig files in Downloads:" >&2 + local i + for i in "${!kubeconfig_files[@]}"; do + local file_size + file_size=$(du -h "${kubeconfig_files[$i]}" 2>/dev/null | cut -f1) + echo " $((i + 1))) ${kubeconfig_files[$i]##*/} (${file_size:-unknown size})" >&2 + done + echo " $((${#kubeconfig_files[@]} + 1))) Enter custom path" >&2 + + local choice + while true; do + choice=$(ask "Choose kubeconfig (1-$((${#kubeconfig_files[@]} + 1)))" "") + if [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le $((${#kubeconfig_files[@]} + 1)) ]]; then + break + fi + echo "Please enter a number between 1 and $((${#kubeconfig_files[@]} + 1))." >&2 + done + + if [[ "$choice" -le ${#kubeconfig_files[@]} ]]; then + echo "${kubeconfig_files[$((choice - 1))]}" + return 0 + fi fi - echo "Please enter a number between 1 and $(( ${#kubeconfig_files[@]} + 1 ))." >&2 - done - - if [[ "$choice" -le ${#kubeconfig_files[@]} ]]; then - echo "${kubeconfig_files[$((choice-1))]}" - return 0 - fi fi - fi - ask_required "Path to kubeconfig" "" + ask_required "Path to kubeconfig" "" } print_current_config() { - echo "" - echo "Current Cypress configuration:" - - local print_var - print_var() { - local name=$1 - local value=${2-} - if [[ -z "${value:-}" ]]; then - echo " $name: [unset]" - else - echo " $name: $value" + echo "" + echo "Current Cypress configuration:" + + local print_var + print_var() { + local name=$1 + local value=${2-} + if [[ -z "${value:-}" ]]; then + echo " $name: [unset]" + else + echo " $name: $value" + fi + } + + local v + + echo "" + echo " -- Cluster Connection --" + v=${CYPRESS_KUBECONFIG_PATH-} + if [[ -n "${v:-}" && ! -f "$v" ]]; then + v+=" (file not found)" + fi + print_var "CYPRESS_KUBECONFIG_PATH" "$v" + print_var "CYPRESS_BASE_URL" "${CYPRESS_BASE_URL-}" + print_var "CYPRESS_LOGIN_IDP" "${CYPRESS_LOGIN_IDP-}" + v=${CYPRESS_LOGIN_USERS-} + if [[ -n "${v:-}" && "$v" == *:* ]]; then + v="${v%%:*}:********" fi - } - - local v - - echo "" - echo " -- Cluster Connection --" - v=${CYPRESS_KUBECONFIG_PATH-} - if [[ -n "${v:-}" && ! -f "$v" ]]; then - v+=" (file not found)" - fi - print_var "CYPRESS_KUBECONFIG_PATH" "$v" - print_var "CYPRESS_BASE_URL" "${CYPRESS_BASE_URL-}" - print_var "CYPRESS_LOGIN_IDP" "${CYPRESS_LOGIN_IDP-}" - v=${CYPRESS_LOGIN_USERS-} - if [[ -n "${v:-}" && "$v" == *:* ]]; then - v="${v%%:*}:********" - fi - print_var "CYPRESS_LOGIN_USERS" "$v" - - echo "" - echo " -- Installation Mode --" - print_var "CYPRESS_SKIP_ALL_INSTALL" "${CYPRESS_SKIP_ALL_INSTALL-}" - - echo "" - echo " -- COO --" - print_var "CYPRESS_SKIP_COO_INSTALL" "${CYPRESS_SKIP_COO_INSTALL-}" - print_var "CYPRESS_COO_NAMESPACE" "${CYPRESS_COO_NAMESPACE-}" - print_var "CYPRESS_COO_UI_INSTALL" "${CYPRESS_COO_UI_INSTALL-}" - print_var "CYPRESS_KONFLUX_COO_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}" - print_var "CYPRESS_CUSTOM_COO_BUNDLE_IMAGE" "${CYPRESS_CUSTOM_COO_BUNDLE_IMAGE-}" - print_var "CYPRESS_MP_IMAGE" "${CYPRESS_MP_IMAGE-}" - print_var "CYPRESS_MCP_CONSOLE_IMAGE" "${CYPRESS_MCP_CONSOLE_IMAGE-}" - print_var "CYPRESS_CHA_IMAGE" "${CYPRESS_CHA_IMAGE-}" - - echo "" - echo " -- KBV --" - print_var "CYPRESS_SKIP_KBV_INSTALL" "${CYPRESS_SKIP_KBV_INSTALL-}" - print_var "CYPRESS_KBV_UI_INSTALL" "${CYPRESS_KBV_UI_INSTALL-}" - print_var "CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE-}" - print_var "CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE" "${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE-}" - print_var "CYPRESS_FBC_STAGE_KBV_IMAGE" "${CYPRESS_FBC_STAGE_KBV_IMAGE-}" - - echo "" - echo " -- Runtime --" - print_var "CYPRESS_TIMEZONE" "${CYPRESS_TIMEZONE-}" - print_var "CYPRESS_MOCK_NEW_METRICS" "${CYPRESS_MOCK_NEW_METRICS-}" - print_var "CYPRESS_SESSION" "${CYPRESS_SESSION-}" - print_var "CYPRESS_DEBUG" "${CYPRESS_DEBUG-}" + print_var "CYPRESS_LOGIN_USERS" "$v" + + echo "" + echo " -- Installation Mode --" + print_var "CYPRESS_SKIP_ALL_INSTALL" "${CYPRESS_SKIP_ALL_INSTALL-}" + + echo "" + echo " -- COO --" + print_var "CYPRESS_SKIP_COO_INSTALL" "${CYPRESS_SKIP_COO_INSTALL-}" + print_var "CYPRESS_COO_NAMESPACE" "${CYPRESS_COO_NAMESPACE-}" + print_var "CYPRESS_COO_UI_INSTALL" "${CYPRESS_COO_UI_INSTALL-}" + print_var "CYPRESS_KONFLUX_COO_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}" + print_var "CYPRESS_CUSTOM_COO_BUNDLE_IMAGE" "${CYPRESS_CUSTOM_COO_BUNDLE_IMAGE-}" + print_var "CYPRESS_MP_IMAGE" "${CYPRESS_MP_IMAGE-}" + print_var "CYPRESS_MCP_CONSOLE_IMAGE" "${CYPRESS_MCP_CONSOLE_IMAGE-}" + print_var "CYPRESS_CHA_IMAGE" "${CYPRESS_CHA_IMAGE-}" + + echo "" + echo " -- CNV --" + print_var "CYPRESS_SKIP_CNV_INSTALL" "${CYPRESS_SKIP_CNV_INSTALL-}" + print_var "CYPRESS_CNV_UI_INSTALL" "${CYPRESS_CNV_UI_INSTALL-}" + print_var "CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE-}" + print_var "CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE" "${CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE-}" + print_var "CYPRESS_FBC_STAGE_CNV_IMAGE" "${CYPRESS_FBC_STAGE_CNV_IMAGE-}" + + echo "" + echo " -- Runtime --" + print_var "CYPRESS_TIMEZONE" "${CYPRESS_TIMEZONE-}" + print_var "CYPRESS_MOCK_NEW_METRICS" "${CYPRESS_MOCK_NEW_METRICS-}" + print_var "CYPRESS_SESSION" "${CYPRESS_SESSION-}" + print_var "CYPRESS_DEBUG" "${CYPRESS_DEBUG-}" } main() { - local mode_show=false - while [[ $# -gt 0 ]]; do - case "$1" in - --show|-s) mode_show=true; shift;; - --help|-h) print_usage; return 0;; - *) echo "Unknown option: $1" 1>&2; print_usage; return 1;; - esac - done - - if $mode_show; then - print_current_config - return 0 - fi - print_header - - # ── Initialise all variables from current environment ────────────── - local base_url="${CYPRESS_BASE_URL-}" - local login_idp="${CYPRESS_LOGIN_IDP-}" - local login_users="${CYPRESS_LOGIN_USERS-}" - local kubeconfig="" - local mp_image="${CYPRESS_MP_IMAGE-}" - local coo_namespace="${CYPRESS_COO_NAMESPACE:-openshift-cluster-observability-operator}" - local skip_coo_install="${CYPRESS_SKIP_COO_INSTALL:-false}" - local coo_ui_install="${CYPRESS_COO_UI_INSTALL:-false}" - local konflux_bundle="${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}" - local custom_coo_bundle="${CYPRESS_CUSTOM_COO_BUNDLE_IMAGE-}" - local mcp_console_image="${CYPRESS_MCP_CONSOLE_IMAGE-}" - local cha_image="${CYPRESS_CHA_IMAGE-}" - local timezone="${CYPRESS_TIMEZONE:-UTC}" - local mock_new_metrics="${CYPRESS_MOCK_NEW_METRICS:-false}" - local session="${CYPRESS_SESSION:-false}" - local debug="${CYPRESS_DEBUG:-false}" - local skip_all_install="${CYPRESS_SKIP_ALL_INSTALL:-false}" - local skip_kbv_install="${CYPRESS_SKIP_KBV_INSTALL:-false}" - local kbv_ui_install="${CYPRESS_KBV_UI_INSTALL:-false}" - local konflux_kbv_bundle="${CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE-}" - local custom_kbv_bundle="${CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE-}" - local fbc_stage_kbv_image="${CYPRESS_FBC_STAGE_KBV_IMAGE-}" - - # ── Section 1: Cluster Connection ───────────────────────────────── - section_header "Cluster Connection" - - # Kubeconfig — default chain: CYPRESS_KUBECONFIG_PATH → KUBECONFIG → ~/.kube/config - local kube_default="${CYPRESS_KUBECONFIG_PATH:-${KUBECONFIG:-}}" - if [[ -z "$kube_default" && -f "$HOME/.kube/config" ]]; then kube_default="$HOME/.kube/config"; fi - - if [[ -n "$kube_default" ]]; then - echo "Kubeconfig: $kube_default" - local change_kube - change_kube=$(ask_yes_no "Change kubeconfig?" "n") - if [[ "$change_kube" == "n" ]]; then - kubeconfig="$kube_default" - else - kubeconfig=$(pick_kubeconfig_interactive) - fi - else - kubeconfig=$(pick_kubeconfig_interactive) - fi - - if [[ ! -f "$kubeconfig" ]]; then - echo "Warning: file does not exist at $kubeconfig" 1>&2 - fi - - # Console base URL - while true; do - base_url=$(ask_required "Console base URL (e.g. https://console-openshift-console.apps.)" "$base_url") - if [[ "$base_url" =~ ^https?:// ]]; then - break + local mode_show=false + while [[ $# -gt 0 ]]; do + case "$1" in + --show | -s) + mode_show=true + shift + ;; + --help | -h) + print_usage + return 0 + ;; + *) + echo "Unknown option: $1" 1>&2 + print_usage + return 1 + ;; + esac + done + + if $mode_show; then + print_current_config + return 0 fi - echo "Must start with http:// or https://" 1>&2 - done - - # Login - echo "" - echo "Login method" - echo " 1) kubeadmin (kube:admin)" - echo " 2) Custom identity provider" - local login_choice_default="" - if [[ "$login_idp" == "kube:admin" ]]; then - login_choice_default="1" - elif [[ -n "$login_idp" ]]; then - login_choice_default="2" - fi - local login_choice - while true; do - login_choice=$(ask "Choose 1 or 2" "$login_choice_default") - case "$login_choice" in - 1|2) break;; - *) echo "Please enter 1 or 2." 1>&2;; - esac - done - - local login_user login_pass - if [[ "$login_choice" == "1" ]]; then - login_idp="kube:admin" - login_user="kubeadmin" - login_pass=$(ask_required "kubeadmin password" "${login_users##*:}") - else - login_idp=$(ask_required "Identity provider name" "${login_idp:-flexy-htpasswd-provider}") - login_user=$(ask_required "Username" "${login_users%%:*}") - login_pass=$(ask_required "Password" "${login_users##*:}") - fi - login_users="$login_user:$login_pass" - - # ── Section 2: Installation Mode ────────────────────────────────── - section_header "Installation Mode" - - local skip_all_ans - skip_all_ans=$(ask_yes_no "Skip ALL operator install/cleanup? (for pre-provisioned environments)" "$(bool_to_default_yn "$skip_all_install")") - skip_all_install="false" - if [[ "$skip_all_ans" == "y" ]]; then skip_all_install="true"; fi - - if [[ "$skip_all_install" == "false" ]]; then - - # ── Section 3a: COO Installation ──────────────────────────────── - section_header "COO (Cluster Observability Operator)" - - local skip_coo_ans - skip_coo_ans=$(ask_yes_no "Skip COO installation?" "$(bool_to_default_yn "$skip_coo_install")") - skip_coo_install="false" - if [[ "$skip_coo_ans" == "y" ]]; then skip_coo_install="true"; fi - - if [[ "$skip_coo_install" == "false" ]]; then - coo_namespace=$(ask "COO namespace" "$coo_namespace") - - local coo_ui_ans - coo_ui_ans=$(ask_yes_no "Install COO from redhat-operators catalog?" "$(bool_to_default_yn "$coo_ui_install")") - coo_ui_install="false" - if [[ "$coo_ui_ans" == "y" ]]; then coo_ui_install="true"; fi - - if [[ "$coo_ui_install" == "false" ]]; then - konflux_bundle=$(ask "Konflux COO bundle image" "$konflux_bundle") - custom_coo_bundle=$(ask "Custom COO bundle image" "$custom_coo_bundle") - fi - - mp_image=$(ask "Monitoring Plugin image (CYPRESS_MP_IMAGE)" "$mp_image") - mcp_console_image=$(ask "Monitoring Console Plugin image (CYPRESS_MCP_CONSOLE_IMAGE)" "$mcp_console_image") - cha_image=$(ask "Cluster Health Analyzer image (CYPRESS_CHA_IMAGE)" "$cha_image") + print_header + + # ── Initialise all variables from current environment ────────────── + local base_url="${CYPRESS_BASE_URL-}" + local login_idp="${CYPRESS_LOGIN_IDP-}" + local login_users="${CYPRESS_LOGIN_USERS-}" + local kubeconfig="" + local mp_image="${CYPRESS_MP_IMAGE-}" + local coo_namespace="${CYPRESS_COO_NAMESPACE:-openshift-cluster-observability-operator}" + local skip_coo_install="${CYPRESS_SKIP_COO_INSTALL:-false}" + local coo_ui_install="${CYPRESS_COO_UI_INSTALL:-false}" + local konflux_bundle="${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}" + local custom_coo_bundle="${CYPRESS_CUSTOM_COO_BUNDLE_IMAGE-}" + local mcp_console_image="${CYPRESS_MCP_CONSOLE_IMAGE-}" + local cha_image="${CYPRESS_CHA_IMAGE-}" + local timezone="${CYPRESS_TIMEZONE:-UTC}" + local mock_new_metrics="${CYPRESS_MOCK_NEW_METRICS:-false}" + local session="${CYPRESS_SESSION:-false}" + local debug="${CYPRESS_DEBUG:-false}" + local skip_all_install="${CYPRESS_SKIP_ALL_INSTALL:-false}" + local skip_cnv_install="${CYPRESS_SKIP_CNV_INSTALL:-false}" + local cnv_ui_install="${CYPRESS_CNV_UI_INSTALL:-false}" + local konflux_cnv_bundle="${CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE-}" + local custom_cnv_bundle="${CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE-}" + local fbc_stage_cnv_image="${CYPRESS_FBC_STAGE_CNV_IMAGE-}" + + # ── Section 1: Cluster Connection ───────────────────────────────── + section_header "Cluster Connection" + + # Kubeconfig — default chain: CYPRESS_KUBECONFIG_PATH → KUBECONFIG → ~/.kube/config + local kube_default="${CYPRESS_KUBECONFIG_PATH:-${KUBECONFIG:-}}" + if [[ -z "$kube_default" && -f "$HOME/.kube/config" ]]; then kube_default="$HOME/.kube/config"; fi + + if [[ -n "$kube_default" ]]; then + echo "Kubeconfig: $kube_default" + local change_kube + change_kube=$(ask_yes_no "Change kubeconfig?" "n") + if [[ "$change_kube" == "n" ]]; then + kubeconfig="$kube_default" + else + kubeconfig=$(pick_kubeconfig_interactive) + fi + else + kubeconfig=$(pick_kubeconfig_interactive) fi - # ── Section 3b: KBV Installation ──────────────────────────────── - section_header "KBV (OpenShift Virtualization)" - - local skip_kbv_ans - skip_kbv_ans=$(ask_yes_no "Skip OpenShift Virtualization installation?" "$(bool_to_default_yn "$skip_kbv_install")") - skip_kbv_install="false" - if [[ "$skip_kbv_ans" == "y" ]]; then skip_kbv_install="true"; fi - - if [[ "$skip_kbv_install" == "false" ]]; then - local kbv_ui_ans - kbv_ui_ans=$(ask_yes_no "Install KBV from redhat-operators catalog?" "$(bool_to_default_yn "$kbv_ui_install")") - kbv_ui_install="false" - if [[ "$kbv_ui_ans" == "y" ]]; then kbv_ui_install="true"; fi - - if [[ "$kbv_ui_install" == "false" ]]; then - konflux_kbv_bundle=$(ask "Konflux KBV bundle image" "$konflux_kbv_bundle") - custom_kbv_bundle=$(ask "Custom KBV bundle image" "$custom_kbv_bundle") - fbc_stage_kbv_image=$(ask "KBV FBC image" "$fbc_stage_kbv_image") - fi + if [[ ! -f "$kubeconfig" ]]; then + echo "Warning: file does not exist at $kubeconfig" 1>&2 fi - fi - - # ── Section 4: Runtime Settings ─────────────────────────────────── - section_header "Runtime Settings" - - timezone=$(ask "Cluster timezone" "$timezone") - - local mock_ans - mock_ans=$(ask_yes_no "Transform old metric names to new format in mocks?" "$(bool_to_default_yn "$mock_new_metrics")") - mock_new_metrics="false" - if [[ "$mock_ans" == "y" ]]; then mock_new_metrics="true"; fi - - local session_ans - session_ans=$(ask_yes_no "Enable session management for faster test execution?" "$(bool_to_default_yn "$session")") - session="false" - if [[ "$session_ans" == "y" ]]; then session="true"; fi - - local debug_ans - debug_ans=$(ask_yes_no "Enable debug mode?" "$(bool_to_default_yn "$debug")") - debug="false" - if [[ "$debug_ans" == "y" ]]; then debug="true"; fi - - # ── Build export lines ──────────────────────────────────────────── - local -a export_lines - - add_export() { - export_lines+=("export $1='$(printf %s "$2" | escape_for_single_quotes)'") - } - add_export_if_set() { - if [[ -n "$2" ]]; then add_export "$1" "$2"; fi - } - - add_export CYPRESS_BASE_URL "$base_url" - add_export CYPRESS_LOGIN_IDP "$login_idp" - add_export CYPRESS_LOGIN_USERS "$login_users" - add_export CYPRESS_KUBECONFIG_PATH "$kubeconfig" - add_export CYPRESS_SKIP_ALL_INSTALL "$skip_all_install" - add_export CYPRESS_SKIP_COO_INSTALL "$skip_coo_install" - add_export CYPRESS_COO_UI_INSTALL "$coo_ui_install" - add_export_if_set CYPRESS_COO_NAMESPACE "$coo_namespace" - add_export_if_set CYPRESS_MP_IMAGE "$mp_image" - add_export_if_set CYPRESS_KONFLUX_COO_BUNDLE_IMAGE "$konflux_bundle" - add_export_if_set CYPRESS_CUSTOM_COO_BUNDLE_IMAGE "$custom_coo_bundle" - add_export_if_set CYPRESS_MCP_CONSOLE_IMAGE "$mcp_console_image" - add_export_if_set CYPRESS_CHA_IMAGE "$cha_image" - add_export CYPRESS_SKIP_KBV_INSTALL "$skip_kbv_install" - add_export CYPRESS_KBV_UI_INSTALL "$kbv_ui_install" - add_export_if_set CYPRESS_KONFLUX_KBV_BUNDLE_IMAGE "$konflux_kbv_bundle" - add_export_if_set CYPRESS_CUSTOM_KBV_BUNDLE_IMAGE "$custom_kbv_bundle" - add_export_if_set CYPRESS_FBC_STAGE_KBV_IMAGE "$fbc_stage_kbv_image" - add_export_if_set CYPRESS_TIMEZONE "$timezone" - add_export CYPRESS_MOCK_NEW_METRICS "$mock_new_metrics" - add_export CYPRESS_SESSION "$session" - add_export CYPRESS_DEBUG "$debug" - - # ── Output ──────────────────────────────────────────────────────── - echo "" - if [[ -n "${_CONFIGURE_ENV_AUTO_SOURCE:-}" ]]; then - write_exports_file "$OUTPUT_FILE_DEFAULT" "${export_lines[@]}" - elif is_sourced; then - for line in "${export_lines[@]}"; do - eval "$line" + + # Console base URL + while true; do + base_url=$(ask_required "Console base URL (e.g. https://console-openshift-console.apps.)" "$base_url") + if [[ "$base_url" =~ ^https?:// ]]; then + break + fi + echo "Must start with http:// or https://" 1>&2 done - echo "Exported variables into current shell." - else - local output_file - output_file=$(ask "Write exports to file" "$OUTPUT_FILE_DEFAULT") - write_exports_file "$output_file" "${export_lines[@]}" + + # Login echo "" - echo "========================================" - echo "IMPORTANT: Variables are NOT yet active." - echo "Run this to apply them to your shell:" + echo "Login method" + echo " 1) kubeadmin (kube:admin)" + echo " 2) Custom identity provider" + local login_choice_default="" + if [[ "$login_idp" == "kube:admin" ]]; then + login_choice_default="1" + elif [[ -n "$login_idp" ]]; then + login_choice_default="2" + fi + local login_choice + while true; do + login_choice=$(ask "Choose 1 or 2" "$login_choice_default") + case "$login_choice" in + 1 | 2) break ;; + *) echo "Please enter 1 or 2." 1>&2 ;; + esac + done + + local login_user login_pass + if [[ "$login_choice" == "1" ]]; then + login_idp="kube:admin" + login_user="kubeadmin" + login_pass=$(ask_required "kubeadmin password" "${login_users##*:}") + else + login_idp=$(ask_required "Identity provider name" "${login_idp:-flexy-htpasswd-provider}") + login_user=$(ask_required "Username" "${login_users%%:*}") + login_pass=$(ask_required "Password" "${login_users##*:}") + fi + login_users="$login_user:$login_pass" + + # ── Section 2: Installation Mode ────────────────────────────────── + section_header "Installation Mode" + + local skip_all_ans + skip_all_ans=$(ask_yes_no "Skip ALL operator install/cleanup? (for pre-provisioned environments)" "$(bool_to_default_yn "$skip_all_install")") + skip_all_install="false" + if [[ "$skip_all_ans" == "y" ]]; then skip_all_install="true"; fi + + if [[ "$skip_all_install" == "false" ]]; then + + # ── Section 3a: COO Installation ──────────────────────────────── + section_header "COO (Cluster Observability Operator)" + + local skip_coo_ans + skip_coo_ans=$(ask_yes_no "Skip COO installation?" "$(bool_to_default_yn "$skip_coo_install")") + skip_coo_install="false" + if [[ "$skip_coo_ans" == "y" ]]; then skip_coo_install="true"; fi + + if [[ "$skip_coo_install" == "false" ]]; then + coo_namespace=$(ask "COO namespace" "$coo_namespace") + + local coo_ui_ans + coo_ui_ans=$(ask_yes_no "Install COO from redhat-operators catalog?" "$(bool_to_default_yn "$coo_ui_install")") + coo_ui_install="false" + if [[ "$coo_ui_ans" == "y" ]]; then coo_ui_install="true"; fi + + if [[ "$coo_ui_install" == "false" ]]; then + konflux_bundle=$(ask "Konflux COO bundle image" "$konflux_bundle") + custom_coo_bundle=$(ask "Custom COO bundle image" "$custom_coo_bundle") + fi + + mp_image=$(ask "Monitoring Plugin image (CYPRESS_MP_IMAGE)" "$mp_image") + mcp_console_image=$(ask "Monitoring Console Plugin image (CYPRESS_MCP_CONSOLE_IMAGE)" "$mcp_console_image") + cha_image=$(ask "Cluster Health Analyzer image (CYPRESS_CHA_IMAGE)" "$cha_image") + fi + + # ── Section 3b: CNV Installation ──────────────────────────────── + section_header "CNV (OpenShift Virtualization)" + + local skip_cnv_ans + skip_cnv_ans=$(ask_yes_no "Skip OpenShift Virtualization installation?" "$(bool_to_default_yn "$skip_cnv_install")") + skip_cnv_install="false" + if [[ "$skip_cnv_ans" == "y" ]]; then skip_cnv_install="true"; fi + + if [[ "$skip_cnv_install" == "false" ]]; then + local cnv_ui_ans + cnv_ui_ans=$(ask_yes_no "Install CNV from redhat-operators catalog?" "$(bool_to_default_yn "$cnv_ui_install")") + cnv_ui_install="false" + if [[ "$cnv_ui_ans" == "y" ]]; then cnv_ui_install="true"; fi + + if [[ "$cnv_ui_install" == "false" ]]; then + konflux_cnv_bundle=$(ask "Konflux CNV bundle image" "$konflux_cnv_bundle") + custom_cnv_bundle=$(ask "Custom CNV bundle image" "$custom_cnv_bundle") + fbc_stage_cnv_image=$(ask "CNV FBC image" "$fbc_stage_cnv_image") + fi + fi + fi + + # ── Section 4: Runtime Settings ─────────────────────────────────── + section_header "Runtime Settings" + + timezone=$(ask "Cluster timezone" "$timezone") + + local mock_ans + mock_ans=$(ask_yes_no "Transform old metric names to new format in mocks?" "$(bool_to_default_yn "$mock_new_metrics")") + mock_new_metrics="false" + if [[ "$mock_ans" == "y" ]]; then mock_new_metrics="true"; fi + + local session_ans + session_ans=$(ask_yes_no "Enable session management for faster test execution?" "$(bool_to_default_yn "$session")") + session="false" + if [[ "$session_ans" == "y" ]]; then session="true"; fi + + local debug_ans + debug_ans=$(ask_yes_no "Enable debug mode?" "$(bool_to_default_yn "$debug")") + debug="false" + if [[ "$debug_ans" == "y" ]]; then debug="true"; fi + + # ── Build export lines ──────────────────────────────────────────── + local -a export_lines + + add_export() { + export_lines+=("export $1='$(printf %s "$2" | escape_for_single_quotes)'") + } + add_export_if_set() { + if [[ -n "$2" ]]; then add_export "$1" "$2"; fi + } + + add_export CYPRESS_BASE_URL "$base_url" + add_export CYPRESS_LOGIN_IDP "$login_idp" + add_export CYPRESS_LOGIN_USERS "$login_users" + add_export CYPRESS_KUBECONFIG_PATH "$kubeconfig" + add_export CYPRESS_SKIP_ALL_INSTALL "$skip_all_install" + add_export CYPRESS_SKIP_COO_INSTALL "$skip_coo_install" + add_export CYPRESS_COO_UI_INSTALL "$coo_ui_install" + add_export_if_set CYPRESS_COO_NAMESPACE "$coo_namespace" + add_export_if_set CYPRESS_MP_IMAGE "$mp_image" + add_export_if_set CYPRESS_KONFLUX_COO_BUNDLE_IMAGE "$konflux_bundle" + add_export_if_set CYPRESS_CUSTOM_COO_BUNDLE_IMAGE "$custom_coo_bundle" + add_export_if_set CYPRESS_MCP_CONSOLE_IMAGE "$mcp_console_image" + add_export_if_set CYPRESS_CHA_IMAGE "$cha_image" + add_export CYPRESS_SKIP_CNV_INSTALL "$skip_cnv_install" + add_export CYPRESS_CNV_UI_INSTALL "$cnv_ui_install" + add_export_if_set CYPRESS_KONFLUX_CNV_BUNDLE_IMAGE "$konflux_cnv_bundle" + add_export_if_set CYPRESS_CUSTOM_CNV_BUNDLE_IMAGE "$custom_cnv_bundle" + add_export_if_set CYPRESS_FBC_STAGE_CNV_IMAGE "$fbc_stage_cnv_image" + add_export_if_set CYPRESS_TIMEZONE "$timezone" + add_export CYPRESS_MOCK_NEW_METRICS "$mock_new_metrics" + add_export CYPRESS_SESSION "$session" + add_export CYPRESS_DEBUG "$debug" + + # ── Output ──────────────────────────────────────────────────────── echo "" - echo " source \"$output_file\"" - echo "========================================" - fi + if [[ -n "${_CONFIGURE_ENV_AUTO_SOURCE:-}" ]]; then + write_exports_file "$OUTPUT_FILE_DEFAULT" "${export_lines[@]}" + elif is_sourced; then + for line in "${export_lines[@]}"; do + eval "$line" + done + echo "Exported variables into current shell." + else + local output_file + output_file=$(ask "Write exports to file" "$OUTPUT_FILE_DEFAULT") + write_exports_file "$output_file" "${export_lines[@]}" + echo "" + echo "========================================" + echo "IMPORTANT: Variables are NOT yet active." + echo "Run this to apply them to your shell:" + echo "" + echo " source \"$output_file\"" + echo "========================================" + fi - echo "" - echo "Configured values:" - for line in "${export_lines[@]}"; do - echo " ${line#export }" - done + echo "" + echo "Configured values:" + for line in "${export_lines[@]}"; do + echo " ${line#export }" + done } main "$@" diff --git a/web/cypress/e2e/alerts/alerts_ivt.cy.ts b/web/cypress/e2e/alerts/alerts_ivt.cy.ts index 3027e6a8c..1fc33f73c 100644 --- a/web/cypress/e2e/alerts/alerts_ivt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_ivt.cy.ts @@ -1,6 +1,7 @@ import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + HYPERCONVERGED_CLUSTER_OPERATOR, } from '../../support/operators'; import { alerts } from '../../fixtures/monitoring/alert'; import { runAllRegressionAlertsTests } from '../../support/monitoring/01.reg_alerts.cy'; @@ -8,21 +9,6 @@ import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; -// Set constants for the operators that need to be installed for tests. - -const KBV = { - namespace: 'openshift-cnv', - packageName: 'kubevirt-hyperconverged', - config: { - kind: 'HyperConverged', - name: 'kubevirt-hyperconverged', - }, - crd: { - kubevirt: 'kubevirts.kubevirt.io', - hyperconverged: 'hyperconvergeds.hco.kubevirt.io', - }, -}; - describe( 'Regression: Monitoring - Alerts (Virtualization)', { tags: ['@alerting', '@slow'] }, @@ -30,7 +16,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts index cdda0a8de..eaa663555 100644 --- a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts @@ -7,28 +7,14 @@ import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + HYPERCONVERGED_CLUSTER_OPERATOR, } from '../../support/operators'; -// Set constants for the operators that need to be installed for tests. - -const KBV = { - namespace: 'openshift-cnv', - packageName: 'kubevirt-hyperconverged', - config: { - kind: 'HyperConverged', - name: 'kubevirt-hyperconverged', - }, - crd: { - kubevirt: 'kubevirts.kubevirt.io', - hyperconverged: 'hyperconvergeds.hco.kubevirt.io', - }, -}; - describe('IVT: Monitoring + Virtualization', { tags: ['@metrics', '@alerting', '@slow'] }, () => { before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts index 8cb275ee6..88c9640df 100644 --- a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts +++ b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts @@ -1,6 +1,7 @@ import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + HYPERCONVERGED_CLUSTER_OPERATOR, } from '../../support/operators'; import { runAllRegressionLegacyDashboardsTests } from '../../support/monitoring/03.reg_legacy_dashboards.cy'; import { runAllRegressionLegacyDashboardsTestsNamespace } from '../../support/monitoring/06.reg_legacy_dashboards_namespace.cy'; @@ -8,20 +9,6 @@ import { commonPages } from '../../views/common'; import { nav } from '../../views/nav'; import { guidedTour } from '../../views/tour'; -// Set constants for the operators that need to be installed for tests. -const KBV = { - namespace: 'openshift-cnv', - packageName: 'kubevirt-hyperconverged', - config: { - kind: 'HyperConverged', - name: 'kubevirt-hyperconverged', - }, - crd: { - kubevirt: 'kubevirts.kubevirt.io', - hyperconverged: 'hyperconvergeds.hco.kubevirt.io', - }, -}; - describe( 'Regression: Monitoring - Legacy Dashboards (Virtualization)', { tags: ['@legacy-dashboards', '@slow'] }, @@ -29,7 +16,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts index 700c78cad..e4199512c 100644 --- a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts @@ -9,22 +9,9 @@ import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + HYPERCONVERGED_CLUSTER_OPERATOR, } from '../../support/operators'; -// Set constants for the operators that need to be installed for tests. -const KBV = { - namespace: 'openshift-cnv', - packageName: 'kubevirt-hyperconverged', - config: { - kind: 'HyperConverged', - name: 'kubevirt-hyperconverged', - }, - crd: { - kubevirt: 'kubevirts.kubevirt.io', - hyperconverged: 'hyperconvergeds.hco.kubevirt.io', - }, -}; - describe( 'Regression: Monitoring - Metrics (Virtualization)', { tags: ['@metrics', '@slow'] }, @@ -32,7 +19,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization'); guidedTour.closeKubevirtTour(); @@ -84,7 +71,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts index a32d0db3e..d758ad1dd 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts @@ -6,21 +6,9 @@ import { commonPages } from '../../views/common'; import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + HYPERCONVERGED_CLUSTER_OPERATOR, } from '../../support/operators'; -const KBV = { - namespace: 'openshift-cnv', - packageName: 'kubevirt-hyperconverged', - config: { - kind: 'HyperConverged', - name: 'kubevirt-hyperconverged', - }, - crd: { - kubevirt: 'kubevirts.kubevirt.io', - hyperconverged: 'hyperconvergeds.hco.kubevirt.io', - }, -}; - describe( 'IVT: COO - Dashboards (Perses) - Virtualization perspective', { tags: ['@perses-dashboards', '@slow'] }, @@ -29,7 +17,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(KBV); + cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/support/commands/auth-commands.ts b/web/cypress/support/commands/auth-commands.ts index 855375527..6b35cce26 100644 --- a/web/cypress/support/commands/auth-commands.ts +++ b/web/cypress/support/commands/auth-commands.ts @@ -161,14 +161,14 @@ export const operatorAuthUtils = { return [...baseKey, ...envVars.map((v) => v || '')]; }, - generateKBVSessionKey(KBV: { namespace: string; packageName: string }): string[] { + generateKNVSessionKey(CNV: { namespace: string; packageName: string }): string[] { const baseKey = [ Cypress.env('LOGIN_IDP'), Cypress.env('LOGIN_USERNAME'), - KBV.namespace, - KBV.packageName, + CNV.namespace, + CNV.packageName, ]; - const envVars = [Cypress.env('SKIP_KBV_INSTALL'), Cypress.env('KBV_UI_INSTALL')]; + const envVars = [Cypress.env('SKIP_CNV_INSTALL'), Cypress.env('CNV_UI_INSTALL')]; return [...baseKey, ...envVars.map((v) => v || '')]; }, diff --git a/web/cypress/support/commands/virtualization-commands.ts b/web/cypress/support/commands/virtualization-commands.ts index 907463eff..93b16f29e 100644 --- a/web/cypress/support/commands/virtualization-commands.ts +++ b/web/cypress/support/commands/virtualization-commands.ts @@ -12,8 +12,8 @@ declare global { interface Chainable { adminCLI(command: string, options?); executeAndDelete(command: string); - beforeBlockVirtualization(KBV: { namespace: string; packageName: string }); - cleanupKBV(KBV: { namespace: string; packageName: string }); + beforeBlockVirtualization(CNV: { namespace: string; packageName: string }); + cleanupCNV(CNV: { namespace: string; packageName: string }); } } } @@ -24,57 +24,57 @@ const installTimeoutMilliseconds = Cypress.config('installTimeoutMilliseconds') const useSession = Cypress.env('SESSION'); const virtualizationUtils = { - installVirtualization(KBV: { namespace: string; packageName: string }): void { - if (Cypress.env('SKIP_KBV_INSTALL')) { - cy.log('SKIP_KBV_INSTALL is set. Skipping Openshift Virtualization installation.'); - } else if (Cypress.env('KBV_UI_INSTALL')) { + installVirtualization(CNV: { namespace: string; packageName: string }): void { + if (Cypress.env('SKIP_CNV_INSTALL')) { + cy.log('SKIP_CNV_INSTALL is set. Skipping Openshift Virtualization installation.'); + } else if (Cypress.env('CNV_UI_INSTALL')) { cy.log( - 'KBV_UI_INSTALL is set. Kubevirt will be installed from redhat-operators catalog source', + 'CNV_UI_INSTALL is set. Kubevirt will be installed from redhat-operators catalog source', ); cy.log('Install Openshift Virtualization'); - operatorHubPage.installOperator(KBV.packageName, 'redhat-operators'); + operatorHubPage.installOperator(CNV.packageName, 'redhat-operators'); cy.get('.co-clusterserviceversion-install__heading', { timeout: installTimeoutMilliseconds, }).should('include.text', 'Create initialization resource'); - } else if (Cypress.env('KONFLUX_KBV_BUNDLE_IMAGE')) { + } else if (Cypress.env('KONFLUX_CNV_BUNDLE_IMAGE')) { cy.log( - 'KONFLUX_KBV_BUNDLE_IMAGE is set. Openshift Virtualization operator will be installed from Konflux bundle.', + 'KONFLUX_CNV_BUNDLE_IMAGE is set. Openshift Virtualization operator will be installed from Konflux bundle.', ); cy.log('Install Openshift Virtualization'); cy.exec( - `oc create namespace ${KBV.namespace} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, + `oc create namespace ${CNV.namespace} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); cy.exec( - `operator-sdk run bundle --timeout=10m --namespace ${KBV.namespace} ${Cypress.env( - 'KONFLUX_KBV_BUNDLE_IMAGE', + `operator-sdk run bundle --timeout=10m --namespace ${CNV.namespace} ${Cypress.env( + 'KONFLUX_CNV_BUNDLE_IMAGE', )} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}" --verbose `, { timeout: installTimeoutMilliseconds }, ); - } else if (Cypress.env('CUSTOM_KBV_BUNDLE_IMAGE')) { + } else if (Cypress.env('CUSTOM_CNV_BUNDLE_IMAGE')) { cy.log( - 'CUSTOM_KBV_BUNDLE_IMAGE is set. Openshift Virtualization operator will be installed from custom built bundle.', + 'CUSTOM_CNV_BUNDLE_IMAGE is set. Openshift Virtualization operator will be installed from custom built bundle.', ); cy.log('Install Openshift Virtualization'); cy.exec( - `oc create namespace ${KBV.namespace} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, + `oc create namespace ${CNV.namespace} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); cy.exec( - `operator-sdk run bundle --timeout=10m --namespace ${KBV.namespace} ${Cypress.env( - 'CUSTOM_KBV_BUNDLE_IMAGE', + `operator-sdk run bundle --timeout=10m --namespace ${CNV.namespace} ${Cypress.env( + 'CUSTOM_CNV_BUNDLE_IMAGE', )} --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}" --verbose `, { timeout: installTimeoutMilliseconds }, ); - } else if (Cypress.env('FBC_STAGE_KBV_IMAGE')) { + } else if (Cypress.env('FBC_STAGE_CNV_IMAGE')) { cy.log( - 'FBC_STAGE_KBV_IMAGE is set. Openshift Virtualization operator will be installed from FBC image.', + 'FBC_STAGE_CNV_IMAGE is set. Openshift Virtualization operator will be installed from FBC image.', ); cy.log('Install Openshift Virtualization'); cy.exec('./cypress/fixtures/virtualization/virtualization_stage.sh', { env: { - FBC_STAGE_KBV_IMAGE: Cypress.env('FBC_STAGE_KBV_IMAGE'), + FBC_STAGE_CNV_IMAGE: Cypress.env('FBC_STAGE_CNV_IMAGE'), KUBECONFIG: Cypress.env('KUBECONFIG_PATH'), }, timeout: installTimeoutMilliseconds, @@ -86,22 +86,22 @@ const virtualizationUtils = { } }, - waitForVirtualizationReady(KBV: { namespace: string }): void { + waitForVirtualizationReady(CNV: { namespace: string }): void { cy.log('Check Openshift Virtualization status'); cy.exec(`oc get csv -n openshift-cnv | grep kubevirt | awk '{print $1}'`) .its('stdout') // Get the captured output string .then((operatorName) => { // Trim any extra whitespace (newline, etc.) - const KBV_OPERATOR_NAME = operatorName.trim(); + const CNV_OPERATOR_NAME = operatorName.trim(); - cy.log(`Successfully retrieved Operator Name: ${KBV_OPERATOR_NAME}`); + cy.log(`Successfully retrieved Operator Name: ${CNV_OPERATOR_NAME}`); // Now, run your actual oc wait command using the captured variable cy.exec( `sleep 15 && oc wait ` + `--for=jsonpath='{.status.phase}'=Succeeded ` + - `ClusterServiceVersion/${KBV_OPERATOR_NAME} ` + - `-n ${KBV.namespace} ` + + `ClusterServiceVersion/${CNV_OPERATOR_NAME} ` + + `-n ${CNV.namespace} ` + `--timeout=300s --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { timeout: readyTimeoutMilliseconds, // Set a long timeout for the 'oc wait' command @@ -114,7 +114,7 @@ const virtualizationUtils = { nav.sidenav.clickNavLink([section, 'Installed Operators']); }); - cy.changeNamespace(KBV.namespace); + cy.changeNamespace(CNV.namespace); cy.byTestID('name-filter-input').should('be.visible').type('Openshift Virtualization{enter}'); cy.get('[data-test="status-text"]', { timeout: installTimeoutMilliseconds }) @@ -122,20 +122,20 @@ const virtualizationUtils = { .should('contain.text', 'Succeeded', { timeout: installTimeoutMilliseconds }); }, - setupHyperconverged(KBV: { namespace: string }): void { - if (Cypress.env('SKIP_KBV_INSTALL')) { + setupHyperconverged(CNV: { namespace: string }): void { + if (Cypress.env('SKIP_CNV_INSTALL')) { cy.log('Skip Hyperconverged instance creation.'); - } else if (Cypress.env('KBV_UI_INSTALL')) { + } else if (Cypress.env('CNV_UI_INSTALL')) { cy.log('Create Hyperconverged instance.'); cy.exec(`oc get csv -n openshift-cnv | grep kubevirt | awk '{print $1}'`) .its('stdout') // Get the captured output string .then((operatorName) => { // Trim any extra whitespace (newline, etc.) - const KBV_OPERATOR_NAME = operatorName.trim(); - cy.log(`Successfully retrieved Operator Name: ${KBV_OPERATOR_NAME}`); + const CNV_OPERATOR_NAME = operatorName.trim(); + cy.log(`Successfully retrieved Operator Name: ${CNV_OPERATOR_NAME}`); cy.visit( `k8s/ns/openshift-cnv/operators.coreos.com~v1alpha1~` + - `ClusterServiceVersion/${KBV_OPERATOR_NAME}`, + `ClusterServiceVersion/${CNV_OPERATOR_NAME}`, ); cy.byOUIAID('OUIA-Generated-Button-primary') .contains('Create HyperConverged') @@ -154,7 +154,7 @@ const virtualizationUtils = { ); cy.exec( `sleep 15 && oc wait --for=condition=Available --selector=app=kubevirt-hyperconverged -n ${ - KBV.namespace + CNV.namespace } --timeout=60s --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, { timeout: readyTimeoutMilliseconds, @@ -162,7 +162,7 @@ const virtualizationUtils = { }, ).then((result) => { expect(result.code).to.eq(0); - cy.log(`Hyperconverged is now running in namespace: ${KBV.namespace}`); + cy.log(`Hyperconverged is now running in namespace: ${CNV.namespace}`); }); } @@ -170,18 +170,18 @@ const virtualizationUtils = { cy.byLegacyTestID('perspective-switcher-toggle').should('be.visible'); }, - cleanup(KBV: { + cleanup(CNV: { namespace: string; config?: { kind: string; name: string }; crd?: { kubevirt: string; hyperconverged: string }; }): void { - const config = KBV.config || { kind: 'HyperConverged', name: 'kubevirt-hyperconverged' }; + const config = CNV.config || { kind: 'HyperConverged', name: 'kubevirt-hyperconverged' }; cy.adminCLI( `oc adm policy add-cluster-role-to-user cluster-admin ${Cypress.env('LOGIN_USERNAME')}`, ); - if (Cypress.env('SKIP_KBV_INSTALL')) { + if (Cypress.env('SKIP_CNV_INSTALL')) { cy.log('Maintain Openshift Virtualization'); } else { //https://docs.redhat.com/en/documentation/openshift_container_platform/4.19/html/virtualization/installing#virt-deleting-virt-cli_uninstalling-virt @@ -189,7 +189,7 @@ const virtualizationUtils = { cy.log('Delete Hyperconverged instance.'); cy.executeAndDelete( `oc patch hyperconverged.hco.kubevirt.io/kubevirt-hyperconverged -n ${ - KBV.namespace + CNV.namespace } -p '{"metadata":{"finalizers":[]}}' --type=merge --kubeconfig ${Cypress.env( 'KUBECONFIG_PATH', )}`, @@ -197,7 +197,7 @@ const virtualizationUtils = { cy.executeAndDelete( `oc patch kubevirt.kubevirt.io/kubevirt -n ${ - KBV.namespace + CNV.namespace } --type=merge -p '{"metadata":{"finalizers":[]}}' --kubeconfig ${Cypress.env( 'KUBECONFIG_PATH', )}`, @@ -205,20 +205,20 @@ const virtualizationUtils = { cy.executeAndDelete( `oc delete HyperConverged kubevirt-hyperconverged -n ${ - KBV.namespace + CNV.namespace } --ignore-not-found --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); cy.log('Remove Openshift Virtualization subscription'); cy.executeAndDelete( `oc delete subscription ${config.name} -n ${ - KBV.namespace + CNV.namespace } --ignore-not-found --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); cy.log('Remove Openshift Virtualization CSV'); cy.executeAndDelete( - `oc delete csv -n ${KBV.namespace} ` + + `oc delete csv -n ${CNV.namespace} ` + `-l operators.coreos.com/kubevirt-hyperconverged.openshift-cnv ` + `--ignore-not-found --kubeconfig "${Cypress.env('KUBECONFIG_PATH')}"`, ); @@ -226,16 +226,16 @@ const virtualizationUtils = { cy.log('Remove Openshift Virtualization namespace'); const kubeconfig = Cypress.env('KUBECONFIG_PATH'); cy.exec( - `oc delete namespace ${KBV.namespace} --ignore-not-found ` + + `oc delete namespace ${CNV.namespace} --ignore-not-found ` + `--timeout=60s --kubeconfig ${kubeconfig}`, { failOnNonZeroExit: false, timeout: 90000 }, ).then((result) => { if (result.code !== 0 && result.stderr?.includes('timed out')) { cy.log('Namespace stuck in Terminating, removing finalizers'); cy.exec( - `oc get namespace ${KBV.namespace} -o json --kubeconfig ${kubeconfig}` + + `oc get namespace ${CNV.namespace} -o json --kubeconfig ${kubeconfig}` + ` | jq '.spec.finalizers = []'` + - ` | oc replace --raw "/api/v1/namespaces/${KBV.namespace}/finalize" -f - ` + + ` | oc replace --raw "/api/v1/namespaces/${CNV.namespace}/finalize" -f - ` + `--kubeconfig ${kubeconfig}`, { failOnNonZeroExit: false }, ); @@ -262,20 +262,20 @@ const virtualizationUtils = { Cypress.Commands.add( 'beforeBlockVirtualization', - (KBV: { namespace: string; packageName: string }) => { + (CNV: { namespace: string; packageName: string }) => { if (useSession) { - const sessionKey = operatorAuthUtils.generateKBVSessionKey(KBV); + const sessionKey = operatorAuthUtils.generateKNVSessionKey(CNV); cy.session( sessionKey, () => { cy.log('Before block Virtualization (session)'); - cy.cleanupKBV(KBV); + cy.cleanupCNV(CNV); operatorAuthUtils.loginAndAuthNoSession(); - virtualizationUtils.installVirtualization(KBV); - virtualizationUtils.waitForVirtualizationReady(KBV); - virtualizationUtils.setupHyperconverged(KBV); + virtualizationUtils.installVirtualization(CNV); + virtualizationUtils.waitForVirtualizationReady(CNV); + virtualizationUtils.setupHyperconverged(CNV); cy.log('Before block Virtualization (session) completed'); }, { @@ -291,19 +291,19 @@ Cypress.Commands.add( } else { cy.log('Before block Virtualization (no session)'); - cy.cleanupKBV(KBV); + cy.cleanupCNV(CNV); operatorAuthUtils.loginAndAuth(); - virtualizationUtils.installVirtualization(KBV); - virtualizationUtils.waitForVirtualizationReady(KBV); - virtualizationUtils.setupHyperconverged(KBV); + virtualizationUtils.installVirtualization(CNV); + virtualizationUtils.waitForVirtualizationReady(CNV); + virtualizationUtils.setupHyperconverged(CNV); cy.log('Before block Virtualization (no session) completed'); } }, ); -Cypress.Commands.add('cleanupKBV', (KBV: { namespace: string; packageName: string }) => { +Cypress.Commands.add('cleanupCNV', (CNV: { namespace: string; packageName: string }) => { cy.log('Cleanup Virtualization (no session)'); - virtualizationUtils.cleanup(KBV); + virtualizationUtils.cleanup(CNV); cy.log('Cleanup Virtualization (no session) completed'); }); diff --git a/web/cypress/support/operators.ts b/web/cypress/support/operators.ts index 8acbb330b..8f0952a0e 100644 --- a/web/cypress/support/operators.ts +++ b/web/cypress/support/operators.ts @@ -12,3 +12,16 @@ export const CLUSTER_OBSERVABILITY_OPERATOR = { name: 'monitoring', }, }; + +export const HYPERCONVERGED_CLUSTER_OPERATOR = { + namespace: 'openshift-cnv', + packageName: 'kubevirt-hyperconverged', + config: { + kind: 'HyperConverged', + name: 'kubevirt-hyperconverged', + }, + crd: { + kubevirt: 'kubevirts.kubevirt.io', + hyperconverged: 'hyperconvergeds.hco.kubevirt.io', + }, +}; From 455654a297a94fe8fe45fc693b3faf11a57128c5 Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 12 Aug 2026 10:29:18 -0400 Subject: [PATCH 5/5] refactor: finalize other operator names --- web/cypress/e2e/alerts/alerts_ivt.cy.ts | 4 +- .../alerts/alerts_virtualization_bvt.cy.ts | 4 +- ...dashboards_virtualization_regression.cy.ts | 4 +- .../metrics/metrics_virtualization_ivt.cy.ts | 6 +-- .../perses_dashboards_datasources.cy.ts | 46 +++++-------------- ...perses_dashboards_virtualization_ivt.cy.ts | 4 +- web/cypress/support/operators.ts | 26 ++++++++++- 7 files changed, 48 insertions(+), 46 deletions(-) diff --git a/web/cypress/e2e/alerts/alerts_ivt.cy.ts b/web/cypress/e2e/alerts/alerts_ivt.cy.ts index 1fc33f73c..d7ad14645 100644 --- a/web/cypress/e2e/alerts/alerts_ivt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_ivt.cy.ts @@ -1,7 +1,7 @@ import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, - HYPERCONVERGED_CLUSTER_OPERATOR, + KUBEVIRT_HYPERCONVERGED_OPERATOR, } from '../../support/operators'; import { alerts } from '../../fixtures/monitoring/alert'; import { runAllRegressionAlertsTests } from '../../support/monitoring/01.reg_alerts.cy'; @@ -16,7 +16,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts index eaa663555..244d31cb7 100644 --- a/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts +++ b/web/cypress/e2e/alerts/alerts_virtualization_bvt.cy.ts @@ -7,14 +7,14 @@ import { troubleshootingPanelPage } from 'cypress/views/troubleshooting-panel'; import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, - HYPERCONVERGED_CLUSTER_OPERATOR, + KUBEVIRT_HYPERCONVERGED_OPERATOR, } from '../../support/operators'; describe('IVT: Monitoring + Virtualization', { tags: ['@metrics', '@alerting', '@slow'] }, () => { before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts index 88c9640df..35aef342d 100644 --- a/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts +++ b/web/cypress/e2e/legacy-dashboards/legacy_dashboards_virtualization_regression.cy.ts @@ -1,7 +1,7 @@ import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, - HYPERCONVERGED_CLUSTER_OPERATOR, + KUBEVIRT_HYPERCONVERGED_OPERATOR, } from '../../support/operators'; import { runAllRegressionLegacyDashboardsTests } from '../../support/monitoring/03.reg_legacy_dashboards.cy'; import { runAllRegressionLegacyDashboardsTestsNamespace } from '../../support/monitoring/06.reg_legacy_dashboards_namespace.cy'; @@ -16,7 +16,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts index e4199512c..5ab742116 100644 --- a/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/metrics/metrics_virtualization_ivt.cy.ts @@ -9,7 +9,7 @@ import { runAllRegressionMetricsTestsNamespace2 } from '../../support/monitoring import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, - HYPERCONVERGED_CLUSTER_OPERATOR, + KUBEVIRT_HYPERCONVERGED_OPERATOR, } from '../../support/operators'; describe( @@ -19,7 +19,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization'); guidedTour.closeKubevirtTour(); @@ -71,7 +71,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts index fcf55752c..e8a6724e4 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_datasources.cy.ts @@ -1,48 +1,26 @@ import { + CLUSTER_LOGGING_OPERATOR, CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, + LOKI_OPERATOR, + OPENTELEMETRY_OPERATOR, + TEMPO_OPERATOR, } from '../../support/operators'; import { runCOOCreateImportPersesTests } from '../../support/perses/05.coo_create_import_perses_admin.cy'; import { nav } from '../../views/nav'; -// Set constants for the operators that need to be installed for tests. - -const OTEL = { - namespace: 'openshift-opentelemetry-operator', - packageName: 'opentelemetry-product', - operatorName: 'Red Hat build of OpenTelemetry', -}; - -const TEMPO = { - namespace: 'openshift-tempo-operator', - packageName: 'tempo-product', - operatorName: 'Tempo Operator', -}; - -const LOKI = { - namespace: 'openshift-operators-redhat', - packageName: 'loki-operator', - operatorName: 'Loki Operator', -}; - -const CLO = { - namespace: 'openshift-logging', - packageName: 'cluster-logging', - operatorName: 'Logging Operator', -}; - describe( 'COO - Dashboards (Perses) - Perses Global Datasources with Tempo and Loki', { tags: ['@perses-dashboards', '@xfail'] }, () => { before(() => { - cy.beforeBlockTempo(TEMPO); - cy.beforeBlockOtel(OTEL); + cy.beforeBlockTempo(TEMPO_OPERATOR); + cy.beforeBlockOtel(OPENTELEMETRY_OPERATOR); cy.configureBase(); cy.configureTracingApps(); - cy.beforeBlockLoki(LOKI); - cy.beforeBlockLogging(CLO); + cy.beforeBlockLoki(LOKI_OPERATOR); + cy.beforeBlockLogging(CLUSTER_LOGGING_OPERATOR); cy.configureLoggingLoki(); cy.cleanupDistributeTracingUIPlugin(); @@ -79,12 +57,12 @@ describe( troubleshootingPanel: false, }); cy.cleanupLoggingLoki(); - cy.cleanupLogging(CLO); - cy.cleanupLoki(LOKI); + cy.cleanupLogging(CLUSTER_LOGGING_OPERATOR); + cy.cleanupLoki(LOKI_OPERATOR); cy.cleanupTracingApps(); cy.cleanupBase(); - cy.cleanupOtel(OTEL); - cy.cleanupTempo(TEMPO); + cy.cleanupOtel(OPENTELEMETRY_OPERATOR); + cy.cleanupTempo(TEMPO_OPERATOR); }); runCOOCreateImportPersesTests({ diff --git a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts index d758ad1dd..85f0b93ad 100644 --- a/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts +++ b/web/cypress/e2e/perses-dashboards/perses_dashboards_virtualization_ivt.cy.ts @@ -6,7 +6,7 @@ import { commonPages } from '../../views/common'; import { CLUSTER_MONITORING_OPERATOR, CLUSTER_OBSERVABILITY_OPERATOR, - HYPERCONVERGED_CLUSTER_OPERATOR, + KUBEVIRT_HYPERCONVERGED_OPERATOR, } from '../../support/operators'; describe( @@ -17,7 +17,7 @@ describe( before(() => { cy.beforeBlockCOO(CLUSTER_OBSERVABILITY_OPERATOR, CLUSTER_MONITORING_OPERATOR); cy.log('Installation: COO and setting up Monitoring Plugin'); - cy.beforeBlockVirtualization(HYPERCONVERGED_CLUSTER_OPERATOR); + cy.beforeBlockVirtualization(KUBEVIRT_HYPERCONVERGED_OPERATOR); cy.log('Virtualization perspective - Observe Menu and verify all submenus'); cy.switchPerspective('Virtualization', 'Fleet virtualization'); guidedTour.closeKubevirtTour(); diff --git a/web/cypress/support/operators.ts b/web/cypress/support/operators.ts index 8f0952a0e..6cac59a45 100644 --- a/web/cypress/support/operators.ts +++ b/web/cypress/support/operators.ts @@ -13,7 +13,7 @@ export const CLUSTER_OBSERVABILITY_OPERATOR = { }, }; -export const HYPERCONVERGED_CLUSTER_OPERATOR = { +export const KUBEVIRT_HYPERCONVERGED_OPERATOR = { namespace: 'openshift-cnv', packageName: 'kubevirt-hyperconverged', config: { @@ -25,3 +25,27 @@ export const HYPERCONVERGED_CLUSTER_OPERATOR = { hyperconverged: 'hyperconvergeds.hco.kubevirt.io', }, }; + +export const OPENTELEMETRY_OPERATOR = { + namespace: 'openshift-opentelemetry-operator', + packageName: 'opentelemetry-product', + operatorName: 'Red Hat build of OpenTelemetry', +}; + +export const TEMPO_OPERATOR = { + namespace: 'openshift-tempo-operator', + packageName: 'tempo-product', + operatorName: 'Tempo Operator', +}; + +export const LOKI_OPERATOR = { + namespace: 'openshift-operators-redhat', + packageName: 'loki-operator', + operatorName: 'Loki Operator', +}; + +export const CLUSTER_LOGGING_OPERATOR = { + namespace: 'openshift-logging', + packageName: 'cluster-logging', + operatorName: 'Logging Operator', +};