This is an old revision of the document!
This is the unofficial procedure to run Functest within a docker.
Some of the Functest tools need to have access to the OpenStack management network of the controllers.
For more info: https://ask.openstack.org/en/question/68144/keystone-unable-to-use-the-public-endpoint/
For this reason and besides the public network, you need to configure an interface on the management network as well in your jumphost (or wherever you want to deploy the Functest docker to run the tests).
Example:
The OPNFV Fuel installation uses VLAN tagged 300 and subnet 192.168.1.0/24 as Openstack Management network. Supposing that eth1 is the physical interface with access to that subnet: $ ip link add name eth1.300 link eth1 type vlan id 300 $ ip link set eth1.300 up $ ip addr add 192.168.1.66/24 dev eth1.300
After doing this, try to ping one of the controllers and make sure it works, otherwise the Rally installation will fail.
$ curl -sSL https://get.docker.com/ | sh
Ubuntu: https://docs.docker.com/installation/ubuntulinux/
RHEL: https://docs.docker.com/installation/rhel/
$ sudo usermod -aG docker <your_user>
$ docker pull opnfv/functest
$ docker images
$ docker run -ti -e "INSTALLER_TYPE=fuel" -e "INSTALLER_IP=10.20.0.2" opnfv/functest
Now, you are inside the docker container.
$ ${repos_dir}/functest/docker/prepare_env.sh
$ ${repos_dir}/functest/docker/run_tests.sh
NOTE: This will run ALL the tests we have for SR1:
* In order to run only 1 suite of Rally bench, you need to modify the call to rally within run_tests.sh script:
$ vi ${repos_dir}/functest/docker/run_tests.sh (go to line 68 or search the following line) python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug ${FUNCTEST_REPO_DIR}/ all Change "all" to "keystone" for example: python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug ${FUNCTEST_REPO_DIR}/ glance Other options are: ['authenticate', 'glance', 'cinder', 'ceilometer', 'heat', 'keystone', 'neutron', 'nova', 'quotas', 'requests', 'vm', 'all']
# Remove any docker containers leftovers $ docker ps | grep opnfv/functest | awk '{print $1}' | xargs docker stop &>/dev/null $ docker ps -a | grep opnfv/functest | awk '{print $1}' | xargs docker rm &>/dev/null $ docker images | grep opnfv/functest | awk '{print $3}' | xargs docker rmi &>/dev/null # Pull and store fresh image from Dockerhub $ docker pull opnfv/functest # Run Functest (example for Fuel) $ cmd1 = "/home/opnfv/repos/functest/docker/prepare_env.sh" $ cmd2 = "/home/opnfv/repos/functest/docker/run_tests.sh" $ docker run -t -e "INSTALLER_TYPE=fuel" -e "INSTALLER_IP=10.20.0.2" opnfv/functest \ "${cmd1} && ${cmd2}"
In case you need to provide different configuration parameters to Functest (e.g. commit IDs or branches for the repositories, …) copy the config_functest.yaml from the repository to your current directory and run docker with a volume:
$ wget https://git.opnfv.org/cgit/functest/plain/testcases/config_functest.yaml $ cmd1 = "/home/opnfv/repos/functest/docker/prepare_env.sh" $ cmd2 = "/home/opnfv/repos/functest/docker/run_tests.sh" $ docker run -t -e "INSTALLER_TYPE=fuel" -e "INSTALLER_IP=10.20.0.2" opnfv/functest \ -v $(pwd)/config_functest.yaml:/home/opnfv/functest/conf/config_functest.yaml \ "${cmd1} && ${cmd2}"
NOTE: the output will be shown on the screen until you press ^C. To attach to the docker output again type:
$ docker ps $ docker attach <ID_of_the_container>
Follow the steps described previously, but when running the scripts within the docker, add the flag - -offline.
$ cmd1 = "/home/opnfv/repos/functest/docker/prepare_env.sh --offline" $ cmd2 = "/home/opnfv/repos/functest/docker/run_tests.sh --offline" $ docker run -t -e "INSTALLER_TYPE=fuel" -e "INSTALLER_IP=10.20.0.2" opnfv/functest \ "${cmd1} && ${cmd2}"
IMPORTANT: This is still under test! And probably some things need to be updated to be completely offline.