Skip to content

Testing

TOFarmer edited this page Nov 4, 2018 · 26 revisions

The following document provides instructions as to how to setup an environment for testing

Testing with Docker

Download and install Docker (you may need to create an account)

Installing Docker on Linux

CentOS based

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.repo

Install Docker CE

sudo yum install docker-ce

Start Docker

sudo systemctl start docker

Verify Docker is running (optional)

sudo docker run hello-world

Ubuntu based

Set 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-ce

Verify Docker is running (optional)

sudo docker run hello-world

Running tests in Docker

Start 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/mmtk_dependencies

start bash in docker container of mmtk_dependencies:

sudo docker run -it tfarmer/mmtk_dependencies bash

Use 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=MDMC

Enter GitHub username

Enter GitHub password (it may take 30-60s for GitHub to respond and for pip to start installing)

Staring closed containers (for persistent environment/data)

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/mmtk_dependencies bash) , display all docker containers:

docker container ls -all

Note down the container name of the most recently created container, 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_name

To enter the container at the bash prompt:

docker exec -it container_name bash

The 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.

Clone this wiki locally