Skip to content

Commit a6923ac

Browse files
committed
add keycloak auth to localdb tests
1 parent d836a50 commit a6923ac

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

scripts/e2e-localdb.sh

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
#!/bin/sh
22
set -e
3+
set -o allexport
34

45
TEST_REPO_URL="https://github.com/cBioPortal/cbioportal-test.git"
6+
KEYCLOAK="true"
7+
STUDIES='ascn_test_study study_hg38 teststudy_genepanels study_es_0 lgg_ucsf_2014_test_generic_assay'
8+
9+
# Use database image with preloaded studies
10+
export DOCKER_IMAGE_MYSQL=cbioportal/cbioportal-dev:database
511

612
# Create a temp dir and clone test repo
713
ROOT_DIR=$(pwd)
814
TEMP_DIR=$(mktemp -d)
915
git clone "$TEST_REPO_URL" "$TEMP_DIR/cbioportal-test" || exit 1
1016
cd "$TEMP_DIR/cbioportal-test" || exit 1
1117

12-
# Use database image with preloaded studies
13-
set -o allexport
14-
export DOCKER_IMAGE_MYSQL=cbioportal/cbioportal-dev:database
18+
# Generate keycloak config
19+
if [ "$KEYCLOAK" = "true" ]; then
20+
./utils/gen-keycloak-config.sh --studies=$STUDIES --template='$ROOT_DIR/end-to-end-test/local/docker_compose/keycloak/keycloak-config.json' --out='keycloak-config-generated.json'
21+
export KEYCLOAK_CONFIG_PATH="$TEMP_DIR/cbioportal-test/keycloak-config-generated.json"
22+
fi
1523

1624
# Start backend
17-
./scripts/docker-compose.sh --portal_type='web-and-data' --docker_args='-d'
25+
if [ "$KEYCLOAK" = "true" ]; then
26+
./scripts/docker-compose.sh --portal_type='keycloak' --docker_args='-d'
27+
28+
# Check keycloak connection at localhost:8081
29+
./utils/check-connection.sh --url=localhost:8081 --max_retries=50
30+
else
31+
./scripts/docker-compose.sh --portal_type='web-and-data' --docker_args='-d'
32+
fi
1833

19-
# Wait for backend at localhost:8080
20-
./utils/check-connection.sh --url=localhost:8080 --max_retries=50
34+
# Check backend connection at localhost:8080
35+
./utils/check-connection.sh --url=localhost:8080/api/health --max_retries=50
2136

2237
# Build frontend
2338
printf "\nBuilding frontend ...\n\n"
@@ -30,7 +45,9 @@ yarn run buildAll
3045
if [ -e "/var/tmp/cbioportal-pid" ]; then
3146
pkill -F /var/tmp/cbioportal-pid
3247
fi
33-
nohup ./node_modules/http-server/bin/http-server --cors dist/ -p 3000 > /dev/null 2>&1 &
48+
openssl \
49+
req -newkey rsa:2048 -new -nodes -x509 -days 1 -keyout key.pem -out cert.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" && \
50+
nohup ./node_modules/http-server/bin/http-server --cors dist/ -p 3000 > /dev/null 2>&1 &
3451
echo $! > /var/tmp/cbioportal-pid
3552

3653
# Wait for frontend at localhost:3000

0 commit comments

Comments
 (0)