summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Moreau Simard <dmsimard@redhat.com>2018-02-19 23:53:34 -0500
committerDavid Moreau Simard <dmsimard@redhat.com>2018-02-19 23:53:34 -0500
commit6ef1d61c25263f6ffd70658ad053316cd572c0ba (patch)
tree595d5095099b8f50c8a0e28948dd2d78a13b3a5d
parent518dcf8bdba9c5c22711297395c4a9cb4e0c644d (diff)
downloadzuul-6ef1d61c25263f6ffd70658ad053316cd572c0ba.tar.gz
Make test-logs.sh more convenient to use
test-logs.sh is convenient to locally test things, this makes it a bit more convenient to use: - Make it executable (chmod +x) - Make it use a virtualenv - Make it install ARA if it's not installed - Make it store logs in temporary directories - Make it use ansible_connection: local instead of a literal SSH connection to localhost Change-Id: Ic2f6403500e2c818d20a90d95395d38959051cb1
-rwxr-xr-x[-rw-r--r--]tools/test-logs.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/tools/test-logs.sh b/tools/test-logs.sh
index a514dd831..429bac5e8 100644..100755
--- a/tools/test-logs.sh
+++ b/tools/test-logs.sh
@@ -15,10 +15,25 @@
# limitations under the License.
ZUUL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
-ARA_DIR=$(dirname $(python3 -c 'import ara ; print(ara.__file__)'))
-WORK_DIR=$PWD/test-logs-output
+# Initialize tox environment if it's not set up
+if [[ ! -d "${ZUUL_DIR}/.tox/venv" ]]; then
+ pushd $ZUUL_DIR
+ echo "Virtualenv doesn't exist... creating."
+ tox -e venv --notest
+ popd
+fi
+# Source tox environment
+source ${ZUUL_DIR}/.tox/venv/bin/activate
+
+# Install ARA if it's not installed (not in requirements.txt by default)
+python -c "import ara" &> /dev/null
+if [ $? -eq 1 ]; then
+ echo "ARA isn't installed... Installing it."
+ pip install ara
+fi
+ARA_DIR=$(dirname $(python3 -c 'import ara; print(ara.__file__)'))
-mkdir -p $WORK_DIR
+WORK_DIR=$(mktemp -d /tmp/zuul_logs_XXXX)
if [ -z $1 ] ; then
INVENTORY=$WORK_DIR/hosts.yaml
@@ -26,11 +41,11 @@ if [ -z $1 ] ; then
all:
hosts:
controller:
- ansible_host: localhost
+ ansible_connection: local
node1:
- ansible_host: localhost
+ ansible_connection: local
node2:
- ansible_host: localhost
+ ansible_connection: local
node:
hosts:
node1: null
@@ -63,4 +78,5 @@ export ARA_LOG_CONFIG=$ZUUL_JOB_LOG_CONFIG
rm -rf $ARA_DIR
ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream.yaml
ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream-failure.yaml
+# ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/functional.yaml
echo "Logs are in $WORK_DIR"