From 4dc9c9f2f447b22b63fe19e72ca39bb600543634 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Thu, 30 Jan 2025 22:13:22 +0100 Subject: [PATCH] rename vars --- scripts/pit/its/test-utils.js | 1 + scripts/pit/lib/lib-ccenter.sh | 18 +++++++++--------- scripts/pit/lib/lib-k8s-kind.sh | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/pit/its/test-utils.js b/scripts/pit/its/test-utils.js index a4ac0ea..9b1fa4d 100644 --- a/scripts/pit/its/test-utils.js +++ b/scripts/pit/its/test-utils.js @@ -65,6 +65,7 @@ async function createPage(headless, ignoreHTTPSErrors) { const browser = await chromium.launch({ headless: headless, chromiumSandbox: false, + slowMo: 500, args: ['--window-position=0,0'] }); const context = await browser.newContext({ignoreHTTPSErrors: ignoreHTTPSErrors, viewport: { width: 1792, height: 970 } }); diff --git a/scripts/pit/lib/lib-ccenter.sh b/scripts/pit/lib/lib-ccenter.sh index 032708b..6c167b1 100644 --- a/scripts/pit/lib/lib-ccenter.sh +++ b/scripts/pit/lib/lib-ccenter.sh @@ -14,8 +14,7 @@ CC_TLS_K=cc-control-login-tls ## Ingress names CC_ING_A=control-center CC_ING_K=control-center-keycloak-ingress -## K8s cluster and namespace -CC_CLUSTER=cc-cluster +# Namespace used for CC CC_NS=control-center ## UI tests to run after the control-center is installed @@ -160,7 +159,7 @@ runPwTests() { } setClusterContext() { - [ "$1" = "$CC_CLUSTER" ] && current=kind-$1 || current=$1 + [ "$1" = "$KIND_CLUSTER" ] && current=kind-$1 || current=$1 ns=$2 H=`kubectl config get-contexts | tr '*' ' ' | awk '{print $1}' | egrep "^$current$"` [ -z "$H" ] && log "Cluster $current not found in kubectl contexts" && return 1 @@ -173,13 +172,13 @@ setClusterContext() { ## Main method for running control center runControlCenter() { - CLUSTER=${CLUSTER:-$CC_CLUSTER} + CLUSTER=${CLUSTER:-$KIND_CLUSTER} checkCommands docker kubectl helm unzip || return 1 checkDockerRunning || return 1 ## Start a new kind cluster if needed - [ "$CLUSTER" != "$CC_CLUSTER" ] || createKindCluster $CC_CLUSTER $CC_NS || return 1 + [ "$CLUSTER" != "$KIND_CLUSTER" ] || createKindCluster $CLUSTER $CC_NS || return 1 ## Set the context to the cluster setClusterContext "$CLUSTER" "$CC_NS" || return 1 @@ -204,10 +203,11 @@ runControlCenter() { ## Run Playwright tests for the control-center runPwTests || return 1 - if [ -z "$TEST" -a -z "$KEEPCC" ]; then - stopForwardIngress || return 1 - [ "$CLUSTER" != "$CC_CLUSTER" ] || deleteKindCluster $CC_CLUSTER || return 1 - fi + stopForwardIngress || return 1 + + ## Delete the KinD cluster if it was created in this test + [ -n "$TEST" -o -n "$KEEPCC" -o "$CLUSTER" != "$KIND_CLUSTER" ] || deleteKindCluster "$CLUSTER" || return 1 + return 0 } diff --git a/scripts/pit/lib/lib-k8s-kind.sh b/scripts/pit/lib/lib-k8s-kind.sh index 00ca834..1be3f1e 100644 --- a/scripts/pit/lib/lib-k8s-kind.sh +++ b/scripts/pit/lib/lib-k8s-kind.sh @@ -1,5 +1,8 @@ . `dirname $0`/lib/lib-utils.sh +## Kind cluster to use if not provided +KIND_CLUSTER=cc-cluster + ## Check that the command has SUID bit set # $1: command hasSUID() {