d23662e50f
Update the TESTING.rst file to reflect that just installing and starting zookeeperd is no longer sufficient now that we require TLS and auth for the connection. Suggest the container-based setup script instead. Also improve that script to allow it to be invoked as a normal user, with root command escalation tool choice (e.g. "sudo") supplied through a ROOTCMD environment variable, so that things created inside the git worktree like the CA don't end up root-owned. Change-Id: Ia00f5514ba0bd97b2ef17fb798b7c2dc68d9a55e
49 lines
1.0 KiB
Bash
Executable File
49 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# 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, 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)"
|
|
|
|
# Select docker or podman
|
|
if command -v docker > /dev/null; then
|
|
DOCKER=docker
|
|
if ! ${ROOTCMD} docker ps; then
|
|
${ROOTCMD} systemctl start docker
|
|
fi
|
|
elif command -v podman > /dev/null; then
|
|
DOCKER=podman
|
|
else
|
|
echo "Please install docker or podman."
|
|
exit 1
|
|
fi
|
|
|
|
# Select docker-compose or podman-compose
|
|
if command -v docker-compose > /dev/null; then
|
|
COMPOSE=docker-compose
|
|
elif command -v podman-compose > /dev/null; then
|
|
COMPOSE=podman-compose
|
|
else
|
|
echo "Please install docker-compose or podman-compose."
|
|
exit 1
|
|
fi
|
|
|
|
CA_DIR=$SCRIPT_DIR/ca
|
|
|
|
mkdir -p $CA_DIR
|
|
$SCRIPT_DIR/zk-ca.sh $CA_DIR nodepool-test-zookeeper
|
|
|
|
${ROOTCMD} ${COMPOSE} down
|
|
|
|
${ROOTCMD} ${COMPOSE} up -d
|
|
|
|
echo "Finished"
|