Skip to content

Commit

Permalink
Run control-center tests also in dev version
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Feb 6, 2025
1 parent d00b8e9 commit d5503c2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
env:
CC_KEY: ${{ secrets.CC_KEY }}
CC_CERT: ${{ secrets.CC_CERT }}
GHTK: ${{ secrets.GHTK }}
run: |
[ -n "${{ inputs.skipcurrent }}" ] && A="$A --skip-current"
[ -n "${{ inputs.skipdev }}" ] && A="$A --skip-dev"
Expand Down
36 changes: 29 additions & 7 deletions scripts/pit/lib/lib-ccenter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ installCC() {
[ -n "SKIPHELM" ] && H=`kubectl get pods 2>&1` && echo "$H" | egrep -q 'control-center-[0-9abcdef]+-..... ' && return 0
[ -n "$VERBOSE" ] && D=--debug || D=""
[ -n "$CC_KEY" -a -n "$CC_CERT" ] && args="--set app.tlsSecret=$CC_TLS_A --set keycloak.tlsSecret=$CC_TLS_K" || args=""
[ "$1" = "next" ] && args="$args charts/control-center --set app.image.tag=local" || args="$args oci://docker.io/vaadin/control-center"

runCmd "$TEST" "Installing Vaadin Control Center" \
"time helm install control-center oci://docker.io/vaadin/control-center \
"time helm install control-center $args \
-n $CC_NS --create-namespace --set livenessProbe.failureThreshold=20 \
--set domain=$CC_DOMAIN \
--set user.email=$CC_EMAIL \
--set app.host=$CC_CONTROL --set keycloak.host=$CC_AUTH $D $args"
--set app.host=$CC_CONTROL --set keycloak.host=$CC_AUTH $D" || return 1
}

## a loop for waiting to the control-center to be ready
Expand Down Expand Up @@ -171,12 +173,21 @@ setClusterContext() {
kubectl get ns >/dev/null 2>&1 || return 1
}

buildCC() {
computeMvn
[ -z "$VERBOSE" ] && D=-q || D=""
runCmd "$TEST" "Compiling CC" "'$MVN' $D -ntp -B -pl :control-center-app -Pproduction -DskipTests -am install" || return 1
runCmd "$TEST" "Creating CC application docker image" "'$MVN' $D -ntp -B -pl :control-center-app -Pproduction -Ddocker.tag=local docker:build" || return 1
runCmd "$TEST" "Creating CC keycloack docker image" "'$MVN' $D -ntp -B -pl :control-center-keycloak package -Ddocker.tag=local docker:build" || return 1
runCmd "$TEST" "Update helm dependencies" helm dependency build charts/control-center
}

## Main method for running control center
runControlCenter() {
CLUSTER=${CLUSTER:-$KIND_CLUSTER}
[ -z "$TEST" ] && bold "----> Running builds and tests on app control-center version=$1"
[ -n "$TEST" ] && cmd "### Run PiT for: app=contro-center version=$1"

checkCommands docker kubectl helm unzip || return 1
checkDockerRunning || return 1
CLUSTER=${CLUSTER:-$KIND_CLUSTER}

## Start a new kind cluster if needed
[ "$CLUSTER" != "$KIND_CLUSTER" ] || createKindCluster $CLUSTER $CC_NS || return 1
Expand All @@ -188,10 +199,10 @@ runControlCenter() {
[ -z "$SKIPHELM" ] && uninstallCC

## Check if port 443 is busy
checkBusyPort "443" || return 1
[ -z "$TEST" ] && checkBusyPort "443" || return 1

## Install Control Center
installCC || return 1
installCC $1 || return 1
## Control center takes a long time to start
waitForCC 900 || return 1

Expand All @@ -214,9 +225,20 @@ runControlCenter() {
## Otherwise, uninstall the control-center if --keep-cc is not set
[ -n "$TEST" -o -n "$KEEPCC" -o "$CLUSTER" = "$KIND_CLUSTER" ] || uninstallCC --wait=false || return 1

[ -z "$TEST" ] && bold "----> The version $1 of 'control-center' app was successfully built and tested.\n"

return 0
}

validateControlCenter() {
checkCommands docker kubectl helm unzip || return 1
checkDockerRunning || return 1
if [ -z "$NOCURRENT" ]; then
runControlCenter current
fi
buildCC || return 1
runControlCenter next
}



Expand Down
1 change: 1 addition & 0 deletions scripts/pit/lib/lib-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ computeAbsolutePath() {
}
## Compute the maven command to use for the project and stores in MVN env variable
computeMvn() {
MVN=${MVN:-mvn}
[ -x ./mvnw ] && MVN=./mvnw
isWindows && [ -x ./mvnw.bat ] && MVN=./mvnw.bat
isWindows && [ -x ./mvnw.cmd ] && MVN=./mvnw.cmd
Expand Down
6 changes: 3 additions & 3 deletions scripts/pit/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

set -o pipefail


## Default configuration
DEFAULT_PORT=8080
DEFAULT_TIMEOUT=300
Expand Down Expand Up @@ -102,8 +101,9 @@ main() {
## Run demos (proper starters in github)
for i in $demos; do
if [ $i = control-center ]; then
mkdir -p tmp/$i && cd tmp/$i
run runControlCenter $i
cd "$tmp"
checkoutDemo $i || return 1
run validateControlCenter $i
cd "$pwd"
continue
elif expr "$i" : '.*_jdk' >/dev/null; then
Expand Down

0 comments on commit d5503c2

Please sign in to comment.