Dependencies required for running rasrm-acceptance-tests within a docker container
10K+
System / API tests for RAS & RM services
To override any environment variables you should export any variables before running the tests with behave e.g. export HEADLESS=False or by creating a local .env file. Most of the environment variables are defined in config.py
pipenv install --dev
make test
export HEADLESS=False # or =True for Chrome in headless mode
pipenv install --dev
make test
make start_services # Brings all the services up using Docker
make setup # Prepares data for acceptance tests
make style_tests # Will check for Flake8 errors
make system_tests # Will run the system tests
make acceptance_tests # Will run all acceptance
make acceptance_sequential_tests # Will run the acceptance tests not yet converted to run in parallel
make acceptance_parallel_tests # Will run the acceptance tests converted to run in parallel
make acceptance_sequential_tests_all # Will run ALL the acceptance tests, sequentially, in case of race condition or load/contention failures with parallel tests
make stop_services # Bring down all the Docker services
make test # Will bring all the services up and run all the tests
make TEST_TARGET=acceptance_tests/features/your.feature run_tests # Runs a single feature file WITHOUT 'make setup' first
make TEST_TARGET=acceptance_tests/features/your.feature acceptance_tests # Runs a single feature file WITH 'make setup' first
MAKE_TARGET: secure_messaging_acceptance_tests # Runs secure messaging tests
Config is set by environment variables in config.py
If any config is updated it also has to be updated in the Jenkinsfile
Its possible to use firefox as your browser instead of chrome. Do the following to do this:
brew install geckodriverexport WEBDRIVER=firefoxrun.py and wait to hit the breakpointSet Cloudfoundry database environment variables
export CLOUDFOUNDRY_API=
export CLOUDFOUNDRY_EMAIL=
export CLOUDFOUNDRY_PASSWORD=
export CLOUDFOUNDRY_ORG=
export CLOUDFOUNDRY_SPACE=
Get database environment variables curl -fsSL https://raw.githubusercontent.com/ONSdigital/ras-deploy/master/scripts/get_database_uris.sh |bash|sed -e 's/@.*:5432/@localhost:5432/g' > setenvs.sh
Get database URI export DATABASE_NAME=$(cf apps | grep ras-collection-instrument-ci | awk '{ print "cf env "$1 }' | bash | grep "postgres://" | awk -F \" '{ print $4 }' | sed 's!postgres://.*@\(.*\):.*!\1!')
Create an SSH tunnel to the database cf ssh -L 5432:$DATABASE_NAME:5432 ras-collection-instrument-ci
cloudfoundry app name of a service that has a dependency on the database.
Set environment variables in shell fly -t ons get-pipeline -p rasrm|sed '1,/task: rasrm\-acceptance\-tests/d;/on_failure/,$d'|sed -e '1,3d; s/\"//g'|sed -e 's/\:\ /=/g'|awk '{print "export "$1 }' >> setenvs.sh
Set database environment variables source setenvs.sh
Reset data in cloudfoundry make setup
Run tests pipenv run python run.py
Note. To run in pycharm you'll need to put the same environment variables in
cat setenvs.sh|awk '{ print $2 }'|pbcopyrun.py by clicking Edit Configuration...The tests may be failing because you have teared down postgres recently
make setup which will reload any data required for the testsIf you've got an old image hanging around it could cause failures. There are two things to try
make pull within tmp_ras_rm_docker_dev and then re-run make testdocker kill $(docker ps -qa) ; docker rm $(docker ps -qa) ; docker rmi $(docker images -qa) to delete all images and then re-run make testWhen running the acceptance tests, it may get stuck on resetting databases. This happens because a process gets into a deadlock and after a few minutes the make command should terminate. There is a way of terminating
the process before it hits a timeout and quits.
If you run the sql statement below, it should terminate the process in the deadlock and carry on running the acceptance tests. If it stops running
the make acceptance_tests command, just run the make command again and it should work.
SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
where state = 'idle in transaction' AND query like '%actioncase%'
Another way of terminating the deadlock is by going into pgadmin and terminating it there
localhost:80 and log in using details specified in ras-rm-docker-devContent type
Image
Digest
Size
539 MB
Last updated
over 5 years ago
docker pull sdcplatform/rasrm-acceptance-tests