Skip to content

Commit 5cdc38c

Browse files
Merge pull request #633 from DavidRajnoha/cypress-configurable-namespace-and-idempotent-cleanups
OBSINTA-858: configurable Cypress COO namespace and idempotent cleanup
2 parents 8b54c68 + ef3aaa6 commit 5cdc38c

19 files changed

Lines changed: 2368 additions & 2254 deletions

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default defineConfig({
2323
LOGIN_PASSWORD: process.env.CYPRESS_LOGIN_USERS.split(',')[0].split(':')[1],
2424
TIMEZONE: process.env.CYPRESS_TIMEZONE || 'UTC',
2525
MOCK_NEW_METRICS: process.env.CYPRESS_MOCK_NEW_METRICS || 'false',
26+
COO_NAMESPACE: process.env.CYPRESS_COO_NAMESPACE || 'openshift-cluster-observability-operator',
2627
typeDelay: 200,
2728
},
2829
fixturesFolder: 'cypress/fixtures',

web/cypress/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,14 @@ export CYPRESS_KUBECONFIG_PATH=~/Downloads/kubeconfig
173173
export CYPRESS_SKIP_ALL_INSTALL=true
174174
```
175175

176-
### Example 5: Debug Mode
176+
### Example 5: Configurable COO Namespace
177+
178+
Set the following var to specify the Cluster Observability Operator namespace. Defaults to `openshift-cluster-observability-operator` if not set. This is useful when testing with different namespace configurations (e.g., using `coo` instead of the default).
179+
```bash
180+
export CYPRESS_COO_NAMESPACE=openshift-cluster-observability-operator
181+
```
182+
183+
### Example 6: Debug Mode
177184

178185
```bash
179186
# Required variables + debug

web/cypress/configure-env.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ print_current_config() {
169169

170170
# Optional vars
171171
print_var "CYPRESS_MP_IMAGE" "${CYPRESS_MP_IMAGE-}"
172+
print_var "CYPRESS_COO_NAMESPACE" "${CYPRESS_COO_NAMESPACE-}"
172173
print_var "CYPRESS_SKIP_COO_INSTALL" "${CYPRESS_SKIP_COO_INSTALL-}"
173174
print_var "CYPRESS_COO_UI_INSTALL" "${CYPRESS_COO_UI_INSTALL-}"
174175
print_var "CYPRESS_KONFLUX_COO_BUNDLE_IMAGE" "${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}"
@@ -219,6 +220,7 @@ main() {
219220
local def_login_users=${CYPRESS_LOGIN_USERS-}
220221
local def_kubeconfig=${CYPRESS_KUBECONFIG_PATH-${KUBECONFIG-}}
221222
local def_mp_image=${CYPRESS_MP_IMAGE-}
223+
local def_coo_namespace=${CYPRESS_COO_NAMESPACE-}
222224
local def_skip_coo=${CYPRESS_SKIP_COO_INSTALL-}
223225
local def_coo_ui_install=${CYPRESS_COO_UI_INSTALL-}
224226
local def_konflux_bundle=${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}
@@ -402,6 +404,9 @@ main() {
402404
local mp_image
403405
mp_image=$(ask "Custom Monitoring Plugin image (CYPRESS_MP_IMAGE)" "$def_mp_image")
404406

407+
local coo_namespace
408+
coo_namespace=$(ask "Cluster Observability Operator namespace (CYPRESS_COO_NAMESPACE)" "${def_coo_namespace:-openshift-cluster-observability-operator}")
409+
405410
local skip_coo_install_ans
406411
skip_coo_install_ans=$(ask_yes_no "Skip Cluster Observability installation? (sets CYPRESS_SKIP_COO_INSTALL)" "$(bool_to_default_yn "$def_skip_coo")")
407412
local skip_coo_install="false"
@@ -473,6 +478,9 @@ main() {
473478
if [[ -n "$mp_image" ]]; then
474479
export_lines+=("export CYPRESS_MP_IMAGE='$(printf %s "$mp_image" | escape_for_single_quotes)'" )
475480
fi
481+
if [[ -n "$coo_namespace" ]]; then
482+
export_lines+=("export CYPRESS_COO_NAMESPACE='$(printf %s "$coo_namespace" | escape_for_single_quotes)'" )
483+
fi
476484
export_lines+=("export CYPRESS_SKIP_COO_INSTALL='$(printf %s "$skip_coo_install" | escape_for_single_quotes)'" )
477485
export_lines+=("export CYPRESS_COO_UI_INSTALL='$(printf %s "$coo_ui_install" | escape_for_single_quotes)'" )
478486
if [[ -n "$konflux_bundle" ]]; then
@@ -531,6 +539,7 @@ main() {
531539
echo " CYPRESS_LOGIN_USERS=${CYPRESS_LOGIN_USERS:-$login_users}"
532540
echo " CYPRESS_KUBECONFIG_PATH=${CYPRESS_KUBECONFIG_PATH:-$kubeconfig}"
533541
[[ -n "${CYPRESS_MP_IMAGE-}$mp_image" ]] && echo " CYPRESS_MP_IMAGE=${CYPRESS_MP_IMAGE:-$mp_image}"
542+
[[ -n "${CYPRESS_COO_NAMESPACE-}$coo_namespace" ]] && echo " CYPRESS_COO_NAMESPACE=${CYPRESS_COO_NAMESPACE:-$coo_namespace}"
534543
echo " CYPRESS_SKIP_COO_INSTALL=${CYPRESS_SKIP_COO_INSTALL:-$skip_coo_install}"
535544
echo " CYPRESS_COO_UI_INSTALL=${CYPRESS_COO_UI_INSTALL:-$coo_ui_install}"
536545
[[ -n "${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE-}$konflux_bundle" ]] && echo " CYPRESS_KONFLUX_COO_BUNDLE_IMAGE=${CYPRESS_KONFLUX_COO_BUNDLE_IMAGE:-$konflux_bundle}"

web/cypress/e2e/coo/01.coo_bvt.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { nav } from '../../views/nav';
44

55
// Set constants for the operators that need to be installed for tests.
66
const MCP = {
7-
namespace: 'openshift-cluster-observability-operator',
7+
namespace: Cypress.env('COO_NAMESPACE'),
88
packageName: 'cluster-observability-operator',
99
operatorName: 'Cluster Observability Operator',
1010
config: {

web/cypress/e2e/incidents/00.coo_incidents_e2e.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { incidentsPage } from '../../views/incidents-page';
77

88
// Set constants for the operators that need to be installed for tests.
99
const MCP = {
10-
namespace: 'openshift-cluster-observability-operator',
10+
namespace: Cypress.env('COO_NAMESPACE'),
1111
packageName: 'cluster-observability-operator',
1212
operatorName: 'Cluster Observability Operator',
1313
config: {
@@ -17,7 +17,7 @@ const MCP = {
1717
};
1818

1919
const MP = {
20-
namespace: 'openshift-monitoring',
20+
namespace: Cypress.env('COO_NAMESPACE'),
2121
operatorName: 'Cluster Monitoring Operator',
2222
};
2323

web/cypress/e2e/incidents/01.incidents.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { commonPages } from '../../views/common';
1212
import { incidentsPage } from '../../views/incidents-page';
1313

1414
const MCP = {
15-
namespace: 'openshift-cluster-observability-operator',
15+
namespace: Cypress.env('COO_NAMESPACE'),
1616
packageName: 'cluster-observability-operator',
1717
operatorName: 'Cluster Observability Operator',
1818
config: {
@@ -22,7 +22,7 @@ const MCP = {
2222
};
2323

2424
const MP = {
25-
namespace: 'openshift-monitoring',
25+
namespace: Cypress.env('COO_NAMESPACE'),
2626
operatorName: 'Cluster Monitoring Operator',
2727
};
2828

web/cypress/e2e/incidents/02.incidents-mocking-example.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { incidentsPage } from '../../views/incidents-page';
1212
import { IncidentDefinition } from '../../support/incidents_prometheus_query_mocks';
1313

1414
const MCP = {
15-
namespace: 'openshift-cluster-observability-operator',
15+
namespace: Cypress.env('COO_NAMESPACE'),
1616
packageName: 'cluster-observability-operator',
1717
operatorName: 'Cluster Observability Operator',
1818
config: {
@@ -22,7 +22,7 @@ const MCP = {
2222
};
2323

2424
const MP = {
25-
namespace: 'openshift-monitoring',
25+
namespace: Cypress.env('COO_NAMESPACE'),
2626
operatorName: 'Cluster Monitoring Operator',
2727
};
2828

web/cypress/e2e/incidents/regression/01.reg_filtering.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Verifies: OU-727
1111
import { incidentsPage } from '../../../views/incidents-page';
1212

1313
const MCP = {
14-
namespace: 'openshift-cluster-observability-operator',
14+
namespace: Cypress.env('COO_NAMESPACE'),
1515
packageName: 'cluster-observability-operator',
1616
operatorName: 'Cluster Observability Operator',
1717
config: {
@@ -21,7 +21,7 @@ const MCP = {
2121
};
2222

2323
const MP = {
24-
namespace: 'openshift-monitoring',
24+
namespace: Cypress.env('COO_NAMESPACE'),
2525
operatorName: 'Cluster Monitoring Operator',
2626
};
2727

web/cypress/e2e/incidents/regression/02.reg_ui_charts_comprehensive.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function verifyIncidentBarIsVisible(index: number, context: string) {
7070
verifyIncidentBarHasVisiblePaths(index, context);
7171
}
7272
const MCP = {
73-
namespace: 'openshift-cluster-observability-operator',
73+
namespace: Cypress.env('COO_NAMESPACE'),
7474
packageName: 'cluster-observability-operator',
7575
operatorName: 'Cluster Observability Operator',
7676
config: {
@@ -80,7 +80,7 @@ const MCP = {
8080
};
8181

8282
const MP = {
83-
namespace: 'openshift-monitoring',
83+
namespace: Cypress.env('COO_NAMESPACE'),
8484
operatorName: 'Cluster Monitoring Operator',
8585
};
8686

0 commit comments

Comments
 (0)