Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c515d57
fix(e2e): consolidate SHOWCASE_RUNTIME_DB into SHOWCASE_RUNTIME project
zdrapela Jun 17, 2026
8c1f42e
refactor(e2e): extract shared utilities and eliminate duplication
zdrapela Jun 23, 2026
8ed0e17
fix(e2e): address review findings
zdrapela Jun 23, 2026
fb24da4
refactor(e2e): unify KubeClient with rhdh-deployment.ts patterns
zdrapela Jun 23, 2026
ee1f089
refactor(e2e): standardize on js-yaml, drop yaml package
zdrapela Jun 23, 2026
5aa57ae
refactor(e2e): adopt shared helpers and fix createConfigMap typo
zdrapela Jun 23, 2026
5e18454
refactor(e2e): extract shared utilities from runtime-*.ts
zdrapela Jun 23, 2026
b6e8d77
fix(e2e): address review findings in runtime test refactor
zdrapela Jun 24, 2026
0a11751
fix(e2e): extract API version constant and clarify assumptions
zdrapela Jun 24, 2026
c71781e
fix(e2e): call ensureRuntimeDeployed in every runtime spec
zdrapela Jun 24, 2026
8545c54
fix(e2e): drop stale K8S_CLUSTER_URL/TOKEN from header comment
zdrapela Jun 24, 2026
b93f5a2
refactor(e2e): use ImageRef for main container image
zdrapela Jun 24, 2026
f5f7d6a
refactor(e2e): extract BACKSTAGE_BACKEND_CONTAINER constant
zdrapela Jun 24, 2026
36873e1
refactor(e2e): extract buildImageRef helper for separator detection
zdrapela Jun 24, 2026
fb2e489
refactor(e2e): extract shared POSTGRES_ENV_KEYS constant
zdrapela Jun 24, 2026
483acea
refactor(e2e): move schema-mode config to schema-mode-db.ts
zdrapela Jun 24, 2026
8888310
refactor(e2e): remove updateConfigMapTitle, use patchAppConfig directly
zdrapela Jun 24, 2026
82bf135
fix(e2e): fix naming convention lint error for private constant
zdrapela Jun 24, 2026
80d4072
fix(e2e): don't inject POSTGRES_DB env var in external DB tests
zdrapela Jun 24, 2026
929b8b0
fix(e2e): adapt new KubeClient methods to modular kube-client structure
zdrapela Jun 25, 2026
355d661
fix(e2e): fix inverted pod failure detection for transient container …
zdrapela Jun 25, 2026
ac701b4
fix(e2e): fix runtime test timeouts caused by WebSocket teardown hang
zdrapela Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 10 additions & 28 deletions .ci/pipelines/jobs/ocp-nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,17 @@ run_standard_deployment_tests() {
}

run_runtime_config_change_tests() {
# Deploy `showcase-runtime` to run tests that require configuration changes at runtime

# Create the namespace first (this will delete/recreate it)
namespace::configure "${NAME_SPACE_RUNTIME}"

# Configure external PostgreSQL credentials and certificates for runtime namespace
# This creates postgres-crt and postgres-cred secrets needed by values-showcase-postgres.yaml
# IMPORTANT: Must be called AFTER namespace is created but BEFORE helm install
configure_external_postgres_db "${NAME_SPACE_RUNTIME}"

# Deploy RHDH with Helm (skip namespace creation since we already did it)
helm::uninstall "${NAME_SPACE_RUNTIME}" "${RELEASE_NAME}"
oc apply -f "$DIR/resources/postgres-db/dynamic-plugins-root-PVC.yaml" -n "${NAME_SPACE_RUNTIME}"
# shellcheck disable=SC2046
helm upgrade -i "${RELEASE_NAME}" -n "${NAME_SPACE_RUNTIME}" \
"${HELM_CHART_URL}" --version "${CHART_VERSION}" \
-f "$DIR/resources/postgres-db/values-showcase-postgres.yaml" \
--set global.clusterRouterBase="${K8S_CLUSTER_ROUTER_BASE}" \
$(helm::get_image_params)

# Configure schema-mode environment (opt-in: tests skip if env not configured)
if configure_schema_mode_runtime_env "${NAME_SPACE_RUNTIME}" "${RELEASE_NAME}" helm; then
log::info "Schema-mode environment configured successfully; schema-mode tests will run"
else
log::warn "Schema-mode environment not configured; schema-mode tests will skip (this is expected if PostgreSQL is not available)"
fi

# Runtime tests handle their own deployment via TypeScript (runtime-deploy.ts).
# The first test file (config-map.spec.ts) calls ensureRuntimeDeployed() which:
# - Creates the namespace
# - Deploys RHDH with Helm + internal PostgreSQL sub-chart
# - Configures schema-mode env vars for port-forwarding
# Subsequent test files reuse the existing deployment (workers: 1).
#
# The CI wrapper only needs to set environment variables and invoke Playwright.

export INSTALL_METHOD="helm"
local runtime_url="https://${RELEASE_NAME}-developer-hub-${NAME_SPACE_RUNTIME}.${K8S_CLUSTER_ROUTER_BASE}"
# Run tests - allow failures since schema-mode tests are opt-in
testing::run_tests "${RELEASE_NAME}" "${NAME_SPACE_RUNTIME}" "${PW_PROJECT_SHOWCASE_RUNTIME}" "${runtime_url}" || true
}

Expand Down
49 changes: 8 additions & 41 deletions .ci/pipelines/jobs/ocp-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,48 +68,15 @@ initiate_operator_deployments_osd_gcp() {
}

run_operator_runtime_config_change_tests() {
# Deploy `showcase-runtime` to run tests that require configuration changes at runtime.
# Uses enableLocalDb=false with external Crunchy PostgreSQL for both runtime and schema-mode tests.
namespace::configure "${NAME_SPACE_RUNTIME}"

# Runtime tests handle their own deployment via TypeScript (runtime-deploy.ts).
# The first test file (config-map.spec.ts) calls ensureRuntimeDeployed() which:
# - Creates the namespace
# - Deploys RHDH via the operator with internal PostgreSQL
# - Configures schema-mode env vars for port-forwarding
# Subsequent test files reuse the existing deployment (workers: 1).
#
# INSTALL_METHOD=operator is already exported in handle_ocp_operator().
local runtime_url="https://backstage-${RELEASE_NAME}-${NAME_SPACE_RUNTIME}.${K8S_CLUSTER_ROUTER_BASE}"
local postgres_ready
postgres_ready=false

# Set up real external PostgreSQL (Crunchy) instead of placeholder secrets.
# Creates postgres-cred and postgres-crt secrets in NAME_SPACE_RUNTIME.
# IMPORTANT: Must be called AFTER namespace is created but BEFORE operator deployment.
namespace::configure "${NAME_SPACE_POSTGRES_DB}"
if configure_external_postgres_db "${NAME_SPACE_RUNTIME}"; then
postgres_ready=true
# Add RHDH_RUNTIME_URL to postgres-cred (rds-app-config.yaml references it for baseUrl).
# configure_external_postgres_db creates postgres-cred with POSTGRES_* keys only.
local runtime_url_b64
runtime_url_b64=$(common::base64_encode "${runtime_url}")
oc patch secret postgres-cred -n "${NAME_SPACE_RUNTIME}" \
--type=json \
-p "[{\"op\":\"add\",\"path\":\"/data/RHDH_RUNTIME_URL\",\"value\":\"${runtime_url_b64}\"}]"
else
log::warn "External PostgreSQL setup failed; falling back to placeholder secrets (schema-mode tests will skip)"
create_postgres_cred_secret "${NAME_SPACE_RUNTIME}" "tmp" "tmp" "RHDH_RUNTIME_URL=${runtime_url}"
oc apply -f "$DIR/resources/postgres-db/postgres-crt.yaml" -n "${NAME_SPACE_RUNTIME}"
fi

config::create_app_config_map "$DIR/resources/postgres-db/rds-app-config.yaml" "${NAME_SPACE_RUNTIME}"
config::create_dynamic_plugins_config "${DIR}/resources/postgres-db/values-showcase-postgres.yaml" "/tmp/configmap-dynamic-plugins-runtime.yaml"
oc apply -f /tmp/configmap-dynamic-plugins-runtime.yaml -n "${NAME_SPACE_RUNTIME}"
deploy_rhdh_operator "${NAME_SPACE_RUNTIME}" "${DIR}/resources/rhdh-operator/rhdh-start-runtime.yaml" "true"

# Configure schema-mode environment variables (opt-in: tests skip if not configured).
# Only attempt if external PostgreSQL was set up successfully.
if [[ "${postgres_ready}" == "true" ]]; then
if configure_schema_mode_runtime_env "${NAME_SPACE_RUNTIME}" "${RELEASE_NAME}" operator; then
log::info "Schema-mode environment configured successfully; schema-mode tests will run"
else
log::warn "Schema-mode environment not configured; schema-mode tests will skip (this is expected if PostgreSQL is not available)"
fi
fi

testing::run_tests "${RELEASE_NAME}" "${NAME_SPACE_RUNTIME}" "${PW_PROJECT_SHOWCASE_RUNTIME}" "${runtime_url}" || true
}

Expand Down
11 changes: 9 additions & 2 deletions .ci/pipelines/lib/schema-mode-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ configure_schema_mode_runtime_env() {
local forward_via_pod=0
local rhdh_psql_svc_name="redhat-developer-hub-postgresql"

local -a helm_svc_candidates=(
# Service candidates: Helm sub-chart pattern first, then operator pattern
local -a svc_candidates=(
"${release_name}-postgresql"
"${rhdh_psql_svc_name}"
"backstage-psql-${release_name}"
)
local hsvc
for hsvc in "${helm_svc_candidates[@]}"; do
for hsvc in "${svc_candidates[@]}"; do
if oc get svc "${hsvc}" -n "${runtime_namespace}" &> /dev/null; then
postgres_service="${hsvc}"
forward_namespace="${runtime_namespace}"
Expand All @@ -38,9 +40,11 @@ configure_schema_mode_runtime_env() {
done

if [[ -n "${postgres_service}" ]]; then
# Secret candidates: Helm pattern first, then operator pattern
local -a secret_candidates=(
"${release_name}-postgresql"
"${rhdh_psql_svc_name}"
"backstage-psql-secret-${release_name}"
"postgres-cred"
)
local sec
Expand All @@ -49,6 +53,9 @@ configure_schema_mode_runtime_env() {
continue
fi
admin_password=$(oc get secret "${sec}" -n "${runtime_namespace}" -o jsonpath='{.data.postgres-password}' 2> /dev/null | base64 -d || true)
if [[ -z "${admin_password}" ]]; then
admin_password=$(oc get secret "${sec}" -n "${runtime_namespace}" -o jsonpath='{.data.POSTGRESQL_ADMIN_PASSWORD}' 2> /dev/null | base64 -d || true)
fi
if [[ -z "${admin_password}" ]]; then
admin_password=$(oc get secret "${sec}" -n "${runtime_namespace}" -o jsonpath='{.data.POSTGRES_PASSWORD}' 2> /dev/null | base64 -d || true)
fi
Expand Down
24 changes: 0 additions & 24 deletions .ci/pipelines/resources/postgres-db/rds-app-config.yaml

This file was deleted.

90 changes: 0 additions & 90 deletions .ci/pipelines/resources/postgres-db/values-showcase-postgres.yaml

This file was deleted.

51 changes: 0 additions & 51 deletions .ci/pipelines/resources/rhdh-operator/rhdh-start-runtime.yaml

This file was deleted.

20 changes: 2 additions & 18 deletions .ci/pipelines/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ configure_external_postgres_db() {
fi

# Create postgres-crt secret for Backstage deployment (Helm/Operator)
# This secret is referenced by rhdh-start-runtime.yaml and values-showcase-postgres.yaml
# This secret is referenced by RBAC deployment values and operator CRs
if ! oc create secret generic postgres-crt \
--from-file=postgres-crt.pem=postgres-ca \
--dry-run=client -o yaml | oc apply -f - --namespace="${project}"; then
Expand Down Expand Up @@ -433,7 +433,7 @@ cluster_setup_k8s_helm() {
# Functions: base_deployment, rbac_deployment, initiate_deployments,
# base_deployment_osd_gcp, rbac_deployment_osd_gcp, initiate_deployments_osd_gcp,
# initiate_upgrade_base_deployments, initiate_upgrade_deployments,
# initiate_runtime_deployment, initiate_sanity_plugin_checks_deployment,
# initiate_sanity_plugin_checks_deployment,
# apply_yaml_files, deploy_test_backstage_customization_provider,
# deploy_redis_cache, configure_external_postgres_db
# ==============================================================================
Expand Down Expand Up @@ -650,22 +650,6 @@ initiate_upgrade_deployments() {
save_all_pod_logs "$namespace"
}

initiate_runtime_deployment() {
local release_name=$1
local namespace=$2
namespace::configure "${namespace}"
helm::uninstall "${namespace}" "${release_name}"

oc apply -f "$DIR/resources/postgres-db/dynamic-plugins-root-PVC.yaml" -n "${namespace}"

# shellcheck disable=SC2046
helm upgrade -i "${release_name}" -n "${namespace}" \
"${HELM_CHART_URL}" --version "${CHART_VERSION}" \
-f "$DIR/resources/postgres-db/values-showcase-postgres.yaml" \
--set global.clusterRouterBase="${K8S_CLUSTER_ROUTER_BASE}" \
$(helm::get_image_params)
}

initiate_sanity_plugin_checks_deployment() {
local release_name=$1
local name_space_sanity_plugins_check=$2
Expand Down
4 changes: 1 addition & 3 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"showcase-rbac-k8s": "playwright test --project=showcase-rbac-k8s",
"showcase-operator": "playwright test --project=showcase-operator",
"showcase-operator-rbac": "playwright test --project=showcase-operator-rbac",
"showcase-runtime-db": "playwright test --project=showcase-runtime-db",
"showcase-runtime": "playwright test --project=showcase-runtime",
"showcase-upgrade": "playwright test --project=showcase-upgrade",
"showcase-auth-providers": "playwright test --project=showcase-auth-providers",
Expand Down Expand Up @@ -40,8 +39,7 @@
"octokit": "4.1.4",
"pg": "8.22.0",
"uuid": "14.0.0",
"winston": "3.14.2",
"yaml": "2.9.0"
"winston": "3.14.2"
},
"devDependencies": {
"@axe-core/playwright": "4.11.3",
Expand Down
16 changes: 7 additions & 9 deletions e2e-tests/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,19 @@ export default defineConfig({
dependencies: [PW_PROJECT.SMOKE_TEST],
testMatch: ["**/playwright/e2e/**/*-rbac.spec.ts"],
},
{
name: PW_PROJECT.SHOWCASE_RUNTIME_DB,
workers: 1,
testMatch: [
"**/playwright/e2e/external-database/verify-tls-config-with-external-rds.spec.ts",
"**/playwright/e2e/external-database/verify-tls-config-with-external-azure-db.spec.ts",
],
},
{
name: PW_PROJECT.SHOWCASE_RUNTIME,
workers: 1,
dependencies: [PW_PROJECT.SHOWCASE_RUNTIME_DB],
// Runtime tests restart the RHDH deployment (ConfigMap changes,
// external DB reconfiguration, schema-mode setup). Each restart
// takes ~60-90 s on a typical cluster, so the default 90 s global
// timeout is insufficient. 10 minutes gives comfortable headroom.
timeout: 10 * 60 * 1000,
testMatch: [
"**/playwright/e2e/configuration-test/config-map.spec.ts",
"**/playwright/e2e/plugin-division-mode-schema/verify-schema-mode.spec.ts",
"**/playwright/e2e/external-database/verify-tls-config-with-external-rds.spec.ts",
"**/playwright/e2e/external-database/verify-tls-config-with-external-azure-db.spec.ts",
],
},

Expand Down
Loading
Loading