From 77649cbf76bc7f0e130631772cf45e61b5d61004 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Thu, 1 Aug 2019 14:45:56 +0300 Subject: [PATCH] Install test dependencies inside virtualenv Related: rhbz#1698366 --- test/vm.install | 4 ++++ tests/cli/test_build_and_deploy_aws.sh | 7 ++++++- tests/cli/test_build_and_deploy_azure.sh | 8 +++++--- tests/cli/test_build_and_deploy_openstack.sh | 2 -- tests/cli/test_build_and_deploy_vmware.sh | 7 ++++++- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/test/vm.install b/test/vm.install index ba512bb2..31573554 100755 --- a/test/vm.install +++ b/test/vm.install @@ -47,6 +47,10 @@ if ! rpm -q python2-pip; then yum -y install python2-pip fi +if ! rpm -q python-virtualenv; then + yum -y install python-virtualenv +fi + # don't build images with EPEL enabled rm -f $EPEL_REPO diff --git a/tests/cli/test_build_and_deploy_aws.sh b/tests/cli/test_build_and_deploy_aws.sh index f45b206d..38e508cc 100755 --- a/tests/cli/test_build_and_deploy_aws.sh +++ b/tests/cli/test_build_and_deploy_aws.sh @@ -13,6 +13,7 @@ set -e . $(dirname $0)/lib/lib.sh CLI="${CLI:-./src/bin/composer-cli}" +VENV=`mktemp -d /tmp/venv.XXX` rlJournalStart @@ -40,6 +41,10 @@ rlJournalStart rlAssertRpm python2-pip fi + rlAssertRpm python-virtualenv + rlRun -t -c "virtualenv $VENV" + source $VENV/bin/activate + rlRun -t -c "pip install --upgrade pip setuptools" rlRun -t -c "pip install awscli" @@ -200,7 +205,7 @@ __EOF__ rlRun -t -c "aws ec2 delete-snapshot --snapshot-id $SNAPSHOT_ID" rlRun -t -c "aws s3 rm s3://$AWS_BUCKET/$AMI" rlRun -t -c "$CLI compose delete $UUID" - rlRun -t -c "rm -rf $AMI $SSH_KEY_DIR containers.json" + rlRun -t -c "rm -rf $AMI $SSH_KEY_DIR containers.json $VENV" rlPhaseEnd rlJournalEnd diff --git a/tests/cli/test_build_and_deploy_azure.sh b/tests/cli/test_build_and_deploy_azure.sh index 8745aaa5..b96ae581 100755 --- a/tests/cli/test_build_and_deploy_azure.sh +++ b/tests/cli/test_build_and_deploy_azure.sh @@ -13,6 +13,7 @@ set -e . $(dirname $0)/lib/lib.sh CLI="${CLI:-./src/bin/composer-cli}" +VENV=`mktemp -d /tmp/venv.XXX` rlJournalStart @@ -55,8 +56,9 @@ rlJournalStart rlAssertRpm python2-pip fi - rlRun -t -c "rpm -e --nodeps pyOpenSSL" - rlRun -t -c "yum -y remove python*-requests python*-dateutil" + rlAssertRpm python-virtualenv + rlRun -t -c "virtualenv $VENV" + source $VENV/bin/activate rlRun -t -c "pip install --upgrade pip setuptools" rlRun -t -c "pip install ansible[azure] futures" @@ -155,7 +157,7 @@ __EOF__ rlRun -t -c "ansible localhost -m azure_rm_image -a 'resource_group=$AZURE_RESOURCE_GROUP name=$OS_IMAGE_NAME state=absent'" rlRun -t -c "ansible localhost -m azure_rm_storageblob -a 'resource_group=$AZURE_RESOURCE_GROUP storage_account_name=$AZURE_STORAGE_ACCOUNT container=$AZURE_STORAGE_CONTAINER blob=$IMAGE state=absent'" rlRun -t -c "$CLI compose delete $UUID" - rlRun -t -c "rm -rf $IMAGE $SSH_KEY_DIR $TMP_DIR" + rlRun -t -c "rm -rf $IMAGE $SSH_KEY_DIR $TMP_DIR $VENV" rlPhaseEnd rlJournalEnd diff --git a/tests/cli/test_build_and_deploy_openstack.sh b/tests/cli/test_build_and_deploy_openstack.sh index aad97718..c9064ce2 100755 --- a/tests/cli/test_build_and_deploy_openstack.sh +++ b/tests/cli/test_build_and_deploy_openstack.sh @@ -44,10 +44,8 @@ rlJournalStart rlAssertRpm python2-pip fi - rlRun -t -c "yum -y install python-virtualenv" rlAssertRpm python-virtualenv rlRun -t -c "virtualenv $VENV" - source $VENV/bin/activate rlRun -t -c "pip install --upgrade pip setuptools" diff --git a/tests/cli/test_build_and_deploy_vmware.sh b/tests/cli/test_build_and_deploy_vmware.sh index 48a55b29..b55f2efe 100755 --- a/tests/cli/test_build_and_deploy_vmware.sh +++ b/tests/cli/test_build_and_deploy_vmware.sh @@ -13,6 +13,7 @@ set -e . $(dirname $0)/lib/lib.sh CLI="${CLI:-./src/bin/composer-cli}" +VENV=`mktemp -d /tmp/venv.XXX` rlJournalStart @@ -55,6 +56,10 @@ rlJournalStart rlAssertRpm python2-pip fi + rlAssertRpm python-virtualenv + rlRun -t -c "virtualenv $VENV" + source $VENV/bin/activate + rlRun -t -c "pip install --upgrade pip setuptools" rlRun -t -c "pip install pyvmomi" @@ -156,7 +161,7 @@ __EOF__ python $SAMPLES/destroy_vm.py -S -s $V_HOST -u $V_USERNAME -p $V_PASSWORD --uuid $INSTANCE_UUID rlAssert0 "VM destroyed" $? rlRun -t -c "$CLI compose delete $UUID" - rlRun -t -c "rm -rf $IMAGE $TMP_DIR $SSH_KEY_DIR" + rlRun -t -c "rm -rf $IMAGE $TMP_DIR $SSH_KEY_DIR $VENV" rlPhaseEnd rlJournalEnd