-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
The following document provides instructions as to how to setup an environment for testing
Download and install Docker (you may need to create an account)
Follow the instructions on the Docker website (essentially just creating an account and clicking a download link).
Set up repository
sudo yum install -y yum-utils device-mapper-persistent-data lvms
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoInstall Docker CE
sudo yum install docker-ceStart Docker
sudo systemctl start dockerVerify Docker is running (optional)
sudo docker run hello-worldSet up repository (for x86_64/amd64 architecture - see https://docs.docker.com/install/linux/docker-ce/ubuntu/ for others)
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"Install Docker CE
sudo apt-get install docker-ceVerify Docker is running (optional)
sudo docker run hello-worldStart Docker (required once for Mac/Windows, not required for Linux).
For Windows, do not include sudo.
Pull to ensure most recent image:
sudo docker pull tfarmer/mdmc_dependenciesstart bash in docker container of mdmc_dependencies:
sudo docker run -it tfarmer/mdmc_dependencies bashUse pip to install MDMC. Specify the branch after @, e.g. for refinement branch:
pip install -e git+https://github.com/MDMCproject/MDMCv0.2_pilot.git@refinement#egg=MDMCor to check the main branch (called master) out do
pip install -e git+https://github.com/MDMCproject/MDMCv0.2_pilot.git@master#egg=MDMCNB: This will install the src into /src, so to easily keep track of where this is (useful for testing, see below), it might be beneficial to navigate to /usr before this pip install.
Enter GitHub username
Enter GitHub password (it may take 30-60s for GitHub to respond and for pip to start installing)
In order to access a container that you have previously used, do the following:
When closing the container after the first use (i.e. after docker run -it farmer/mdmc_dependencies bash) , display all docker containers:
docker container ls -allNote down the container name of the most recently created container which has a command "/bin/bash", as this will be the container you just ran from the image. The container should now be stopped. To start the container:
docker start container_nameTo enter the container at the bash prompt:
docker exec -it container_name bashThe container should be in the same state in which it was previously stopped.
It should always be possible to restart this container in the same way (i.e. start and the exec) as long as the container is not pruned (this is a docker command which removes all stopped containers. If you wish to prune stopped container then just make sure to start (you don't need to exec) any containers which you do not want removed.
Pytest is included within the container. To run a unit or system test, navigate to the MDMC test directory (relative to wherever pip install was called):
cd /src/mdmc/tests/Pytest will test all files in all subdirectories which start with 'test'. To test specific unit tests, navigate to the relevant directory before running the following command. If running pytest from the main test directory, it is recommended that you run with the following flags:
python -m pytest -vv --ignore="./system_tests"-vv provides very verbose output (useful in all cases), and --ignore ./system_tests excludes the system tests; these take a 5-10 minutes to run and so should be excluded unless necessary.