Skip to content

Commit e5ef1db

Browse files
committed
support configurable frontend setup for localdb tests
1 parent b2243f4 commit e5ef1db

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@ The script that can be used to run e2e-localdb tests is located at [./scripts/e2
195195

196196
3. You need to have a global version of Maven installed.
197197

198-
In a terminal, call script from root directory.
199-
198+
In a terminal, run the following commands from root directory.
200199
```
201200
./scripts/e2e-localdb.sh
201+
yarn run e2e:local
202202
```
203203

204204
### Running e2e-localdb tests _CircleCI_ or _CircleCI+PR_ context

scripts/e2e-localdb.sh

+32-26
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ set -o allexport
44

55
TEST_REPO_URL="https://github.com/cBioPortal/cbioportal-test.git"
66
DOCKER_COMPOSE_REPO_URL="https://github.com/cBioPortal/cbioportal-docker-compose.git"
7-
KEYCLOAK="true"
87
STUDIES='ascn_test_study study_hg38 teststudy_genepanels study_es_0 lgg_ucsf_2014_test_generic_assay'
8+
KEYCLOAK="true"
9+
RUN_FRONTEND="false" # Set to "true" if you want to build and run frontend at localhost:3000
10+
RUN_TESTS="false" # Set to "true" if you want to run all e2e:local tests
911

1012
# Use database image with preloaded studies
1113
export DOCKER_IMAGE_MYSQL=cbioportal/cbioportal-dev:database
@@ -19,7 +21,7 @@ cd "$TEMP_DIR/cbioportal-test" || exit 1
1921

2022
# Generate keycloak config
2123
if [ "$KEYCLOAK" = "true" ]; then
22-
./utils/gen-keycloak-config.sh --studies=$STUDIES --template='$TEMP_DIR/cbioportal-docker-compose/dev/keycloak/keycloak-config.json' --out='keycloak-config-generated.json'
24+
./utils/gen-keycloak-config.sh --studies="$STUDIES" --template='$TEMP_DIR/cbioportal-docker-compose/dev/keycloak/keycloak-config.json' --out='keycloak-config-generated.json'
2325
export KEYCLOAK_CONFIG_PATH="$TEMP_DIR/cbioportal-test/keycloak-config-generated.json"
2426
fi
2527

@@ -36,34 +38,38 @@ fi
3638
# Check backend connection at localhost:8080
3739
./utils/check-connection.sh --url=localhost:8080/api/health --max_retries=50
3840

39-
# Build frontend
40-
printf "\nBuilding frontend ...\n\n"
41-
cd "$ROOT_DIR" || exit 1
42-
export BRANCH_ENV=master
43-
yarn install --frozen-lockfile
44-
yarn run buildAll
41+
if [ "$RUN_FRONTEND" = "true" ]; then
42+
# Build frontend
43+
printf "\nBuilding frontend ...\n\n"
44+
cd "$ROOT_DIR" || exit 1
45+
export BRANCH_ENV=master
46+
yarn install --frozen-lockfile
47+
yarn run buildAll
4548

46-
# Start frontend http server, delete if previous server exists
47-
if [ -e "/var/tmp/cbioportal-pid" ]; then
48-
pkill -F /var/tmp/cbioportal-pid
49-
fi
50-
openssl \
51-
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" && \
52-
nohup ./node_modules/http-server/bin/http-server --cors dist/ -p 3000 > /dev/null 2>&1 &
53-
echo $! > /var/tmp/cbioportal-pid
49+
# Start frontend http server, delete if previous server exists
50+
if [ -e "/var/tmp/cbioportal-pid" ]; then
51+
pkill -F /var/tmp/cbioportal-pid
52+
fi
53+
openssl \
54+
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" && \
55+
nohup ./node_modules/http-server/bin/http-server --cors dist/ -p 3000 > /dev/null 2>&1 &
56+
echo $! > /var/tmp/cbioportal-pid
5457

55-
# Wait for frontend at localhost:3000
56-
printf "\nVerifying frontend connection ...\n\n"
57-
cd "$TEMP_DIR/cbioportal-test" || exit 1
58-
./utils/check-connection.sh --url=localhost:3000
58+
# Wait for frontend at localhost:3000
59+
printf "\nVerifying frontend connection ...\n\n"
60+
cd "$TEMP_DIR/cbioportal-test" || exit 1
61+
./utils/check-connection.sh --url=localhost:3000
62+
fi
5963

60-
# Build e2e localdb tests
61-
cd "$ROOT_DIR/end-to-end-test" || exit 1
62-
yarn --ignore-engines
64+
if [ "$RUN_TESTS" = "true" ]; then
65+
# Build e2e localdb tests
66+
cd "$ROOT_DIR/end-to-end-test" || exit 1
67+
yarn --ignore-engines
6368

64-
# Run e2e localdb tests
65-
cd "$ROOT_DIR" || exit 1
66-
yarn run e2e:local
69+
# Run e2e localdb tests
70+
cd "$ROOT_DIR" || exit 1
71+
yarn run e2e:local
72+
fi
6773

6874
# Cleanup
6975
cd "$ROOT_DIR" || exit 1

0 commit comments

Comments
 (0)