diff --git a/tests/cli/test_build_and_deploy_azure.sh b/tests/cli/test_build_and_deploy_azure.sh index fd170b8c..f92690a0 100755 --- a/tests/cli/test_build_and_deploy_azure.sh +++ b/tests/cli/test_build_and_deploy_azure.sh @@ -93,10 +93,9 @@ rlJournalStart rlPhaseStartTest "Start VM instance" VM_NAME="Composer-Auto-VM-$UUID" - if [ ! -f ~/.ssh/id_rsa.pub ]; then - rlRun -t -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" - fi - SSH_PUB_KEY=`cat ~/.ssh/id_rsa.pub` + SSH_KEY_DIR=`mktemp -d /tmp/composer-ssh-keys.XXXXXX` + rlRun -t -c "ssh-keygen -t rsa -N '' -f $SSH_KEY_DIR/id_rsa" + SSH_PUB_KEY=`cat $SSH_KEY_DIR/id_rsa.pub` cat > azure-playbook.yaml << __EOF__ --- @@ -134,7 +133,7 @@ __EOF__ rlPhaseStartTest "Verify VM instance" # verify we can login into that instance - rlRun -t -c "ssh -oStrictHostKeyChecking=no azure-user@$IP_ADDRESS 'cat /etc/redhat-release'" + rlRun -t -c "ssh -oStrictHostKeyChecking=no -i $SSH_KEY_DIR/id_rsa azure-user@$IP_ADDRESS 'cat /etc/redhat-release'" rlPhaseEnd rlPhaseStartCleanup @@ -142,7 +141,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 azure-playbook.yaml" + rlRun -t -c "rm -rf $IMAGE $SSH_KEY_DIR azure-playbook.yaml" rlPhaseEnd rlJournalEnd diff --git a/tests/cli/test_build_and_deploy_openstack.sh b/tests/cli/test_build_and_deploy_openstack.sh index ad030cf7..7c0a8bcc 100755 --- a/tests/cli/test_build_and_deploy_openstack.sh +++ b/tests/cli/test_build_and_deploy_openstack.sh @@ -94,10 +94,9 @@ __EOF__ rlPhaseStartTest "Start VM instance" VM_NAME="Composer-Auto-VM-$UUID" - if [ ! -f ~/.ssh/id_rsa.pub ]; then - rlRun -t -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" - fi - rlRun -t -c "ansible localhost -m os_keypair -a 'name=$VM_NAME-key public_key_file=$(readlink -f ~/.ssh/id_rsa.pub)'" + SSH_KEY_DIR=`mktemp -d /tmp/composer-ssh-keys.XXXXXX` + rlRun -t -c "ssh-keygen -t rsa -N '' -f $SSH_KEY_DIR/id_rsa" + rlRun -t -c "ansible localhost -m os_keypair -a 'name=$VM_NAME-key public_key_file=$SSH_KEY_DIR/id_rsa.pub'" response=`ansible localhost -m os_server -a "name=$VM_NAME image=$OS_IMAGE_UUID flavor=t2.medium key_name=$VM_NAME-key auto_ip=yes"` rlAssert0 "VM started successfully" $? @@ -112,7 +111,7 @@ __EOF__ rlPhaseStartTest "Verify VM instance" # verify we can login into that instance - rlRun -t -c "ssh -oStrictHostKeyChecking=no cloud-user@$IP_ADDRESS 'cat /etc/redhat-release'" + rlRun -t -c "ssh -oStrictHostKeyChecking=no -i $SSH_KEY_DIR/id_rsa cloud-user@$IP_ADDRESS 'cat /etc/redhat-release'" rlPhaseEnd rlPhaseStartCleanup @@ -120,7 +119,7 @@ __EOF__ rlRun -t -c "ansible localhost -m os_server -a 'name=$VM_NAME state=absent'" rlRun -t -c "ansible localhost -m os_image -a 'name=$OS_IMAGE_NAME state=absent'" rlRun -t -c "$CLI compose delete $UUID" - rlRun -t -c "rm -rf $IMAGE http-with-rng.toml" + rlRun -t -c "rm -rf $IMAGE $SSH_KEY_DIR $TMP_DIR" rlPhaseEnd rlJournalEnd diff --git a/tests/cli/test_build_and_deploy_vmware.sh b/tests/cli/test_build_and_deploy_vmware.sh index 0fd8ae09..5a576bea 100755 --- a/tests/cli/test_build_and_deploy_vmware.sh +++ b/tests/cli/test_build_and_deploy_vmware.sh @@ -65,11 +65,9 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest "compose start" - if [ ! -f ~/.ssh/id_rsa.pub ]; then - rlRun -t -c "ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa" - fi - - PUB_KEY=`cat ~/.ssh/id_rsa.pub` + SSH_KEY_DIR=`mktemp -d /tmp/composer-ssh-keys.XXXXXX` + rlRun -t -c "ssh-keygen -t rsa -N '' -f $SSH_KEY_DIR/id_rsa" + PUB_KEY=`cat $SSH_KEY_DIR/id_rsa.pub` cat > $TMP_DIR/vmware.toml << __EOF__ name = "vmware" @@ -143,7 +141,7 @@ __EOF__ rlPhaseStartTest "Verify VM instance" # verify we can login into that instance - rlRun -t -c "ssh -oStrictHostKeyChecking=no root@$IP_ADDRESS 'cat /etc/redhat-release'" + rlRun -t -c "ssh -oStrictHostKeyChecking=no -i $SSH_KEY_DIR/id_rsa root@$IP_ADDRESS 'cat /etc/redhat-release'" rlPhaseEnd rlPhaseStartCleanup @@ -151,7 +149,7 @@ __EOF__ python3 $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" + rlRun -t -c "rm -rf $IMAGE $TMP_DIR $SSH_KEY_DIR" rlPhaseEnd rlJournalEnd