Merge "Update unit test container setup and instructions"
This commit is contained in:
commit
ebc8a0a664
14
TESTING.rst
14
TESTING.rst
@ -18,15 +18,13 @@ More information on pip here: http://www.pip-installer.org/en/latest/
|
||||
|
||||
sudo pip3 install tox
|
||||
|
||||
A running zookeeper is required to execute tests.
|
||||
A running zookeeper is required to execute tests, but it also needs to be
|
||||
configured for TLS and a certificate authority set up to handle socket
|
||||
authentication. Because of these complexities, it's recommended to use a
|
||||
helper script to set up these dependencies::
|
||||
|
||||
*Install zookeeper*::
|
||||
|
||||
sudo apt-get install zookeeperd
|
||||
|
||||
*Start zookeeper*::
|
||||
|
||||
sudo service zookeeper start
|
||||
sudo apt-get install docker-compose # or podman-compose if preferred
|
||||
ROOTCMD=sudo tools/test-setup-docker.sh
|
||||
|
||||
Run The Tests
|
||||
-------------
|
||||
|
@ -3,9 +3,12 @@
|
||||
# This runs ZooKeeper in a docker container, which is required for
|
||||
# tests.
|
||||
|
||||
# This setup needs to be run as a user that can run docker or podman.
|
||||
# This setup needs to be run as a user that can run docker or podman, or by
|
||||
# setting $ROOTCMD to a user substitution tool like "sudo" in the calling
|
||||
# environment.
|
||||
|
||||
set -xeu
|
||||
ROOTCMD=${ROOTCMD:-}
|
||||
|
||||
cd $(dirname $0)
|
||||
SCRIPT_DIR="$(pwd)"
|
||||
@ -13,8 +16,8 @@ SCRIPT_DIR="$(pwd)"
|
||||
# Select docker or podman
|
||||
if command -v docker > /dev/null; then
|
||||
DOCKER=docker
|
||||
if ! docker ps; then
|
||||
systemctl start docker
|
||||
if ! ${ROOTCMD} docker ps; then
|
||||
${ROOTCMD} systemctl start docker
|
||||
fi
|
||||
elif command -v podman > /dev/null; then
|
||||
DOCKER=podman
|
||||
@ -38,8 +41,8 @@ CA_DIR=$SCRIPT_DIR/ca
|
||||
mkdir -p $CA_DIR
|
||||
$SCRIPT_DIR/zk-ca.sh $CA_DIR nodepool-test-zookeeper
|
||||
|
||||
${COMPOSE} down
|
||||
${ROOTCMD} ${COMPOSE} down
|
||||
|
||||
${COMPOSE} up -d
|
||||
${ROOTCMD} ${COMPOSE} up -d
|
||||
|
||||
echo "Finished"
|
||||
|
Loading…
x
Reference in New Issue
Block a user