Skip to content

Commit

Permalink
tests now run via make tests. #158
Browse files Browse the repository at this point in the history
  • Loading branch information
tla committed Feb 24, 2023
1 parent df3543d commit 7aa3514
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CY_NPM_COMMAND="cy:run"

build-tests:
@echo "==> 🏗 Build Test Containers"
@docker build -t stemmaweb-middleware ./middleware
@CY_NPM_COMMAND=$(CY_NPM_COMMAND) docker compose --env-file .env.test -f docker-compose.test.yml build

build-tests-arm:
Expand Down
6 changes: 4 additions & 2 deletions bin/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ docker-compose --env-file $ENV_FILE -f $DOCKER_COMPOSE_FILE up -d
# Check the exit status of the docker container responsible for starting the tests
exit_status=$(docker wait $TEST_CONTAINER_NAME)

# Check if the exit status is 0
# Check if the exit status is 0; if so we will remove the containers
if [ "$exit_status" -eq 0 ]; then
echo "All tests passed ✅"
stopcmd=down
else
echo "Some tests failed ❌"
stopcmd=stop
fi

# Display logs
docker logs $TEST_CONTAINER_NAME

# Stop the services
docker-compose --env-file $ENV_FILE -f $DOCKER_COMPOSE_FILE down
docker-compose --env-file $ENV_FILE -f $DOCKER_COMPOSE_FILE $stopcmd

# Exit with the exit status of the docker container responsible for starting the tests
exit "$exit_status"
12 changes: 6 additions & 6 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
stemmarest-initializer:
build: bin
env_file:
- .env.dev
- .env.test
depends_on:
- stemmarest
volumes:
Expand All @@ -20,7 +20,7 @@ services:
image: mariadb:10.4
restart: always
env_file:
- stemweb/.env.dev
- stemweb/.env.prod

stemweb_redis:
container_name: stemweb_redis
Expand All @@ -41,7 +41,7 @@ services:
image: dhuniwien/stemweb_py37:latest
restart: always
env_file:
- stemweb/.env.dev
- stemweb/.env.prod
depends_on:
- stemweb_mysql
- stemweb_redis
Expand All @@ -53,18 +53,18 @@ services:
- stemmarest
- stemweb
env_file:
- .env.prod
- .env.test
volumes:
- ./frontend/config/env.js.prod:/usr/src/app/stemmaweb_middleware/stemmaweb/src/js/env.js

stemmaweb-e2e:
container_name: stemmaweb-e2e
build: frontend-e2e
env_file:
- .env.dev
depends_on:
- stemmaweb
- stemmarest-initializer
env_file:
- .env.test
volumes:
- ./frontend-e2e/:/app
entrypoint: >
Expand Down
Binary file modified env.zip.gpg
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/www/src/js/modules/common/service/stemwebService.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ class StemwebService extends BaseService {
* @returns {Promise<BaseResponse<RunAlgorithmStatusResponse>>}
*/
runAlgorithm(userid, algorithmId, textid, data, parameters) {
const return_host = 'http://reverse-proxy:80';
const return_path = '/stemmaweb/requests/stemweb/result';
const return_host = this.baseUrl;
const return_path = '/result';
/** @type {RunAlgorithmDTO} */
const dto = { userid, textid, data, parameters, return_host, return_path };
return this.fetch(`/algorithms/process/${algorithmId}`, {
Expand Down

0 comments on commit 7aa3514

Please sign in to comment.