From 51d0e36ae7c283dc8abae617f2d65dea7e7e2c2a Mon Sep 17 00:00:00 2001 From: dkhandel Date: Wed, 6 Jun 2018 17:03:31 +0530 Subject: Remove the conditional-step builder and change file names: - Rename distributed-node-create.sh -> distributed-regression.sh - Rename distributed-regression.py -> run-distributed.test.py Change-Id: I332b1f905a1ba811e09c70e342853f61b5bd1165 --- .../scripts/distributed-node-create.sh | 25 --------------- .../scripts/distributed-regression.py | 25 --------------- .../scripts/distributed-regression.sh | 36 ++++++++++++++++++++++ build-gluster-org/scripts/run-distributed-test.py | 25 +++++++++++++++ 4 files changed, 61 insertions(+), 50 deletions(-) delete mode 100644 build-gluster-org/scripts/distributed-node-create.sh delete mode 100644 build-gluster-org/scripts/distributed-regression.py create mode 100644 build-gluster-org/scripts/distributed-regression.sh create mode 100644 build-gluster-org/scripts/run-distributed-test.py (limited to 'build-gluster-org/scripts') diff --git a/build-gluster-org/scripts/distributed-node-create.sh b/build-gluster-org/scripts/distributed-node-create.sh deleted file mode 100644 index 5b9747d..0000000 --- a/build-gluster-org/scripts/distributed-node-create.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -MAX_ATTEMPTS=3 -set -e - -# create and activate virtual env -virtualenv env -source env/bin/activate - -# create SSH key pair of 4096 bits to use it for instances at Rackspace -ssh-keygen -f ${WORKSPACE}/key -t rsa -b 4096 - -# Install pyrax dependency -pip install pyrax -/opt/qa/distributed-tests/rackspace-server-manager.py create -n ${MACHINES_COUNT} - -for retry in `seq 1 $MAX_ATTEMPTS` -do - ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts --private-key=key /opt/qa/distributed-tests/distributed-server.yml -u root - ret=$? - if [ $ret -eq 0 ]; then - break - fi - echo 'Attempting to run again...' -done diff --git a/build-gluster-org/scripts/distributed-regression.py b/build-gluster-org/scripts/distributed-regression.py deleted file mode 100644 index 820c3a0..0000000 --- a/build-gluster-org/scripts/distributed-regression.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python -import subprocess -import os -from ansible.parsing.dataloader import DataLoader -from ansible.vars.manager import VariableManager -from ansible.inventory.manager import InventoryManager - - -def get_ansible_host_ip(): - loader = DataLoader() - inventory = InventoryManager(loader=loader, sources='hosts') - variable_manager = VariableManager(loader=loader, inventory=inventory) - hostnames = [] - for host in inventory.get_hosts(): - hostnames.append(variable_manager.get_vars(host=host)) - ip = ' '.join([str(i['ansible_host']) for i in hostnames]) - return str(ip) - - -def main(): - ip = get_ansible_host_ip() - subprocess.call(['./extras/distributed-testing/distributed-test.sh', '--hosts', '%s' % ip, '--id-rsa', 'key', '-v']) - - -main() diff --git a/build-gluster-org/scripts/distributed-regression.sh b/build-gluster-org/scripts/distributed-regression.sh new file mode 100644 index 0000000..12f3396 --- /dev/null +++ b/build-gluster-org/scripts/distributed-regression.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +MAX_ATTEMPTS=3 +set -e + +# create and activate virtual env +virtualenv env +source env/bin/activate + +# create SSH key pair of 4096 bits to use it for instances at Rackspace +ssh-keygen -f ${WORKSPACE}/key -t rsa -b 4096 + +# Install pyrax dependency +pip install pyrax +/opt/qa/distributed-tests/rackspace-server-manager.py create -n ${MACHINES_COUNT} + +for retry in `seq 1 $MAX_ATTEMPTS` +do + ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts --private-key=key /opt/qa/distributed-tests/distributed-server.yml -u root + ret=$? + if [ $ret -eq 0 ]; then + break + fi + echo 'Attempting to run again...' +done + +# run the script of distributed-test +../scripts/run-distributed-test.py +ret=$? +if [ $ret -eq 0 ]; then + # Create tar file from all the failed test log files generated in /tmp + tar -czf $WORKSPACE/failed-test-logs.tgz /tmp/*.log + + # if test runs are successful, delete all the machines + /opt/qa/distributed-tests/rackspace-server-manager.py delete +fi diff --git a/build-gluster-org/scripts/run-distributed-test.py b/build-gluster-org/scripts/run-distributed-test.py new file mode 100644 index 0000000..820c3a0 --- /dev/null +++ b/build-gluster-org/scripts/run-distributed-test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +import subprocess +import os +from ansible.parsing.dataloader import DataLoader +from ansible.vars.manager import VariableManager +from ansible.inventory.manager import InventoryManager + + +def get_ansible_host_ip(): + loader = DataLoader() + inventory = InventoryManager(loader=loader, sources='hosts') + variable_manager = VariableManager(loader=loader, inventory=inventory) + hostnames = [] + for host in inventory.get_hosts(): + hostnames.append(variable_manager.get_vars(host=host)) + ip = ' '.join([str(i['ansible_host']) for i in hostnames]) + return str(ip) + + +def main(): + ip = get_ansible_host_ip() + subprocess.call(['./extras/distributed-testing/distributed-test.sh', '--hosts', '%s' % ip, '--id-rsa', 'key', '-v']) + + +main() -- cgit