mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
This commit alone doesn't fix the problem of our functional tests timing out. It is harmless to increase the timeout. The maximum timeout for shared runners in Salsa is 3h according to this: https://salsa.debian.org/salsa-ci-team/pipeline/-/blob/master/README.md#set-build-timeout Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
62 lines
2.5 KiB
YAML
62 lines
2.5 KiB
YAML
---
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
.app-server:
|
|
stage: functional-tests
|
|
dependencies: []
|
|
except:
|
|
- $GITLAB_USER_LOGIN == "weblate"
|
|
script:
|
|
- BUILD_JOB_ID=$(curl -s "https://salsa.debian.org/api/v4/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs?scope[]=success" | jq -r '.[] | select(.name==env.BUILD_JOB_NAME) | .id')
|
|
- export AWS_DEFAULT_REGION=us-east-1
|
|
- |
|
|
aws lambda invoke --function-name launch_app_server --payload '{"launch_template_name": "'"$LAUNCH_TEMPLATE_NAME"'", "instance_name": "'"$INSTANCE_NAME"'", "ci_project_id": "'"$CI_PROJECT_ID"'", "build_job_id": "'"$BUILD_JOB_ID"'"}' response.json
|
|
- echo "APP_SERVER_IP=$(jq -r '.app_server_ip' response.json)" >> app-servers.env
|
|
- echo "INSTANCE_ID=$(jq -r '.instance_id' response.json)" >> app-servers.env
|
|
tags:
|
|
- functional-tests
|
|
artifacts:
|
|
reports:
|
|
dotenv: app-servers.env
|
|
|
|
.run-functional-tests:
|
|
stage: functional-tests
|
|
timeout: 3h
|
|
# Need to find a way of running the cleanup step even on failure
|
|
allow_failure: true
|
|
when: delayed
|
|
# Wait for the app-server to come up. Saves time for the CI runners.
|
|
start_in: 3 minutes
|
|
before_script:
|
|
- apt-get update
|
|
- apt-get install -y sudo curl wget
|
|
- ./plinth/tests/functional/install.sh
|
|
- adduser tester --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password && echo "tester:password" | chpasswd
|
|
script:
|
|
- cp -r . /home/tester/freedombox && chown -R tester:tester /home/tester/freedombox
|
|
- sudo -u tester bash -c 'pip3 install --user selenium==4.2.0 splinter==0.17.0 pytest-splinter pytest-reporter-html1'
|
|
- |
|
|
sudo FREEDOMBOX_URL="https://$APP_SERVER_IP" -u tester bash -c \
|
|
'cd /home/tester/freedombox && py.test-3 -v --durations=10 --include-functional --splinter-headless --template=html1/index.html --report=functional-tests.html'
|
|
after_script:
|
|
- echo "INSTANCE_ID=$INSTANCE_ID" >> app-servers.env
|
|
- cp /home/tester/freedombox/functional-tests.html .
|
|
- cp -r /home/tester/freedombox/screenshots/ .
|
|
artifacts:
|
|
when: always
|
|
reports:
|
|
dotenv: app-servers.env
|
|
paths:
|
|
- functional-tests.html
|
|
- screenshots/
|
|
|
|
# Does not run if the previous job times out or is cancelled
|
|
.terminate-app-server:
|
|
stage: functional-tests
|
|
script:
|
|
- export AWS_DEFAULT_REGION=us-east-1
|
|
- |
|
|
aws lambda invoke --function-name terminate_app_server --payload '{"instance_id": "'"$INSTANCE_ID"'"}' response.json
|
|
tags:
|
|
- functional-tests
|