From 519d60c9d6841a0ce1a4332fd5d1066c5632b514 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Thu, 24 Sep 2015 20:50:06 +0200 Subject: [PATCH] add local ssh config to runner kitchen tests Signed-off-by: Dominik Richter --- test/runner/cookbooks/test/recipes/default.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/runner/cookbooks/test/recipes/default.rb b/test/runner/cookbooks/test/recipes/default.rb index e61a3e76e..9c685fd7a 100644 --- a/test/runner/cookbooks/test/recipes/default.rb +++ b/test/runner/cookbooks/test/recipes/default.rb @@ -41,6 +41,24 @@ execute 'create block_device' do not_if 'test -e /tmp/block_device' end +# prepare ssh for backend +execute 'create ssh key' do + command 'ssh-keygen -t rsa -b 2048 -f /root/.ssh/id_rsa -N ""' + not_if 'test -e /root/.ssh/id_rsa' +end + +remote_file 'copy ssh key to authorized keys' do + path '/root/.ssh/authorized_keys' + source 'file:///root/.ssh/id_rsa.pub' + owner 'root' + group 'root' + mode 0644 +end + +execute 'test ssh connection' do + command 'ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa root@localhost "echo 1"' +end + # execute tests execute 'bundle install' do command '/opt/chef/embedded/bin/bundle install'