Skip to content

Commit

Permalink
try to fix func tests on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
j33f committed Mar 16, 2021
1 parent 938e0c9 commit a84d5fd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
Expand Down Expand Up @@ -59,3 +58,4 @@ coverage.functional
/plugins/*
/.yggdrasilrc
/public/login.html
/ci/
5 changes: 0 additions & 5 deletions docker-compose/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ services:
backend:
image: j33f/node-docker-container
container_name: backend
command: bash -c "chmod 775 /var/startScripts/runCustom.sh && /var/startScripts/runCustom.sh"
volumes:
- ..:/var/app:cached
- ./config/pm2-dev.json:/var/pm2Config/config.json
- ./scripts/run-ci.sh:/var/startScripts/runCustom.sh
cap_add:
- SYS_PTRACE
depends_on:
Expand All @@ -20,8 +17,6 @@ services:
- 208.67.220.220
- 8.8.8.8
- 8.8.4.4
ports:
- "8842:8842"
environment:
- NODE_ENV=${NODE_ENV:-development}

Expand Down
2 changes: 0 additions & 2 deletions docker-compose/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ services:
backend:
image: j33f/node-docker-container
container_name: backend
restart: always
command: bash -c "chmod 775 /var/startScripts/runCustom.sh && /var/startScripts/runCustom.sh"
volumes:
- ..:/var/app:cached
- ../fileStorage:/var/fileStorage
Expand Down
24 changes: 1 addition & 23 deletions docker-compose/scripts/run-ci.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
#!/usr/bin/env bash

if [ -f /etc/timezone ]; then
echo "Timezone is set to $(cat /etc/timezone)"
else
if [[ -z "${TIMEZONE}" ]]; then
SETUP_TIMEZONE="Europe/Paris"
else
SETUP_TIMEZONE="${TIMEZONE}"
fi
echo "Need to set the timezone"
apk add --no-cache --no-progress tzdata
cp /usr/share/zoneinfo/${SETUP_TIMEZONE} /etc/localtime
echo "${SETUP_TIMEZONE}" > /etc/timezone
apk del tzdata
echo "Timezone is now set to $(cat /etc/timezone)"
fi
cd /var/app

npm install -g npm
npm install --force --build-from-source

echo "Container ready to start tests !"

exec npm run test:functional
echo "Run this via start-ci"
25 changes: 25 additions & 0 deletions features/run-ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

if [ -f /etc/timezone ]; then
echo "Timezone is set to $(cat /etc/timezone)"
else
if [[ -z "${TIMEZONE}" ]]; then
SETUP_TIMEZONE="Europe/Paris"
else
SETUP_TIMEZONE="${TIMEZONE}"
fi
echo "Need to set the timezone"
apk add --no-cache --no-progress tzdata
cp /usr/share/zoneinfo/${SETUP_TIMEZONE} /etc/localtime
echo "${SETUP_TIMEZONE}" > /etc/timezone
apk del tzdata
echo "Timezone is now set to $(cat /etc/timezone)"
fi
cd /var/app

npm install -g npm
npm install --force --build-from-source

echo "Container ready to start tests !"

./features/run.sh
19 changes: 4 additions & 15 deletions start-ci
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
#!/usr/bin/env bash

chmod a+x bin/startServerInTestingMode
chmod a+x features/run-ci.sh
chmod a+x features/run.sh

docker-compose -f docker-compose/ci.yml up -d
echo "[$(date)] - Starting..."

echo "[$(date)] - Awaiting for the container to be ready..."

n=0
until [ "$n" -ge 30 ]
do
docker exec -t backend npm -v && break # substitute your command here
n=$((n+1))
echo "."
sleep 1
done

echo "[$(date)] - The container is ready: starting..."

docker exec -t backend /var/app/features/run.sh
docker-compose -f docker-compose/ci.yml run backend /var/app/features/run-ci.sh
FUNC_TESTS_EXIT_CODE=$? # store the tests exit code

if [ $FUNC_TESTS_EXIT_CODE -eq 0 ]
Expand Down

0 comments on commit a84d5fd

Please sign in to comment.