Skip to content

Commit

Permalink
set cluster context, and check https in installed apps
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Jan 30, 2025
1 parent fefaac5 commit 5cb9080
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions scripts/pit/its/cc-identity-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady

log(`Checking that ${app} installed in ${url} is running ...\n`);
// When app is not running, localization cannot be enabled
let pageApp = await createPage(arg.headless, true);
let pageApp = await createPage(arg.headless, arg.ignoreHTTPSErrors);
await waitForServerReady(pageApp, url);
await takeScreenshot(pageApp, __filename, 'app-running');
await closePage(pageApp);
Expand Down Expand Up @@ -83,7 +83,7 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady
await takeScreenshot(page, __filename, 'user-created');

log(`Logging in ${app} as ${user} ...\n`);
pageApp = await createPage(arg.headless, true);
pageApp = await createPage(arg.headless, arg.ignoreHTTPSErrors);
await waitForServerReady(pageApp, url);
await takeScreenshot(pageApp, __filename, `app-${app}-loaded`);
await pageApp.getByLabel('Email').fill(user);
Expand Down
2 changes: 1 addition & 1 deletion scripts/pit/its/cc-localization.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const { assert } = require('console');

log(`Checking that ${app} installed in ${url} is running ...\n`);
// When app is not running, localization cannot be enabled
const pageApp = await createPage(arg.headless, true);
const pageApp = await createPage(arg.headless, arg.ignoreHTTPSErrors);
await waitForServerReady(pageApp, url);
await takeScreenshot(pageApp, __filename, 'app-running');
await closePage(pageApp);
Expand Down
2 changes: 1 addition & 1 deletion scripts/pit/its/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function createPage(headless, ignoreHTTPSErrors) {
const page = await context.newPage();
page.on('console', msg => {
const text = `${msg.text()} - ${msg.location().url}`.replace(/\s+/g, ' ');
if (!/vaadinPush/.test(text)) out("> CONSOLE:", text, '\n');
if (!/vaadinPush|favicon.ico/.test(text)) out("> CONSOLE:", text, '\n');
});
page.on('pageerror', e => warn("> JSERROR:", ('' + e).replace(/\s+/g, ' '), '\n'));
page.browser = browser;
Expand Down
16 changes: 13 additions & 3 deletions scripts/pit/lib/lib-ccenter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@ runPwTests() {
done
}

setClusterContext() {
[ "$1" = "$CC_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
runCmd "$TEST" "Setting context to $current" "kubectl config use-context $current" || return 1
H=`kubectl config current-context`
[ "$H" != "$current" ] && log "Current context is not $current" && return 1
runCmd "$TEST" "Setting default namespace to $ns" "kubectl config set-context --current --namespace=$ns" || return 1
kubectl get ns >/dev/null 2>&1 || return 1
}

## Main method for running control center
runControlCenter() {
CLUSTER=${CLUSTER:-$CC_CLUSTER}
Expand All @@ -167,9 +179,7 @@ runControlCenter() {
[ "$CLUSTER" != "$CC_CLUSTER" ] || createKindCluster $CC_CLUSTER $CC_NS || return 1

## Set the context to the cluster
kubectl config set-context $CLUSTER || return 1
kubectl config set-context --current --namespace=$CC_NS || return 1
kubectl get ns >/dev/null 2>&1 || return 1
setClusterContext "$CLUSTER" "$CC_NS" || return 1

## Clean up CC from a previous run unless SKIPHELM is set
[ -z "$SKIPHELM" ] && uninstallCC $CLUSTER $CC_NS
Expand Down

0 comments on commit 5cb9080

Please sign in to comment.