From 828f00bf860fcceaf9b63fbc46a7a6aca6b49ca1 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Sun, 8 Apr 2018 23:30:12 +0300 Subject: [PATCH] test: add ssh key in travis script Signed-off-by: Ruslan Kuprieiev --- scripts/ci/script.sh | 11 +++++++++++ tests/test_data_cloud.py | 9 --------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/ci/script.sh b/scripts/ci/script.sh index 283f7493d..2cef917bd 100644 --- a/scripts/ci/script.sh +++ b/scripts/ci/script.sh @@ -3,6 +3,17 @@ set -x set -e +#NOTE: ssh keys for ssh test to be able to ssh to the localhost +ls -la ~/.ssh/ + +ssh-keygen -t rsa -N "" -f mykey +mkdir -p ~/.ssh +cp mykey ~/.ssh/id_rsa +cp mykey.pub ~/.ssh/id_rsa.pub +cat mykey.pub >> ~/.ssh/authorized_keys +ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts +ssh 127.0.0.1 ls &> /dev/null + python -mtests if [[ "$TRAVIS_PULL_REQUEST" == "false" && \ diff --git a/tests/test_data_cloud.py b/tests/test_data_cloud.py index b5c627cf6..accc5c945 100644 --- a/tests/test_data_cloud.py +++ b/tests/test_data_cloud.py @@ -60,15 +60,6 @@ def _should_test_ssh(): if os.name == 'nt': return False - #FIXME: this is ugly - if os.getenv('TRAVIS') == 'true': - os.system('ssh-keygen -t dsa -N "" -C "test key" -f mykey') - os.system('mkdir -p ~/.ssh') - os.system('cp mykey ~/.ssh/id_rsa') - os.system('cp mykey.pub ~/.ssh/id_rsa.pub') - os.system('cat mykey.pub >> ~/.ssh/authorized_keys') - os.system('ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts') - assert os.system('ssh 127.0.0.1 ls &> /dev/null') == 0 return True