From 0d9e938e92a25673c3712866e2d2108a255b67d5 Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Tue, 20 May 2014 18:15:03 -0700 Subject: Update specs and fix FM-1361 - Add install.rb for pre-suite - Add catches for failures/changes to manifest application - Correct root ssh key copying - Add sleeps for killing processes releasing ports - Fix FM-1361 --- .../beaker/git/group_checkout/group_checkout_file.rb | 8 ++++---- .../beaker/git/group_checkout/group_checkout_file_path.rb | 8 ++++---- .../beaker/git/group_checkout/group_checkout_git.rb | 10 +++++----- .../beaker/git/group_checkout/group_checkout_http.rb | 10 +++++----- .../beaker/git/group_checkout/group_checkout_https.rb | 10 +++++----- .../beaker/git/group_checkout/group_checkout_scp.rb | 15 ++++++++------- .../beaker/git/group_checkout/group_checkout_ssh.rb | 15 ++++++++------- .../negative/group_checkout_file_non_existent_group.rb | 5 ++--- 8 files changed, 41 insertions(+), 40 deletions(-) (limited to 'spec/acceptance/beaker/git/group_checkout') diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb index 6913bd5..be5ae92 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb @@ -14,12 +14,12 @@ hosts.each do |host| end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout as a group with puppet' do @@ -32,8 +32,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb index 6701dda..c204792 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb @@ -14,12 +14,12 @@ hosts.each do |host| end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout a group with puppet' do @@ -32,8 +32,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb index 31ef286..6147549 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb @@ -18,13 +18,13 @@ hosts.each do |host| end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon') - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + on(host, 'pkill -9 git-daemon ; sleep 1') + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout a group with puppet' do @@ -37,8 +37,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb index 0c86c77..43c3f2e 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb @@ -26,13 +26,13 @@ hosts.each do |host| end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout a group with puppet' do @@ -45,8 +45,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb index 0bcbd97..6825df3 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb @@ -33,13 +33,13 @@ hosts.each do |host| end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout as a group with puppet' do @@ -52,8 +52,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb index d8f5bb5..0bcf143 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb @@ -14,22 +14,23 @@ hosts.each do |host| end step 'setup - establish ssh keys' do # create ssh keys - on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') + on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') # copy public key to authorized_keys + on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') on(host, 'chown -R root:root /root/.ssh') end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true) + apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true) + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout as a group with puppet (scp syntax)' do @@ -42,8 +43,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb index 1255864..87bad69 100644 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb @@ -14,22 +14,23 @@ hosts.each do |host| end step 'setup - establish ssh keys' do # create ssh keys - on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') + on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') # copy public key to authorized_keys + on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') on(host, 'chown -R root:root /root/.ssh') end step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") + apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true) end teardown do on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", :catch_failures => true) + apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", :catch_failures => true) + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end step 'checkout as a group with puppet' do @@ -42,8 +43,8 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :catch_failures => true) + apply_manifest_on(host, pp, :catch_changes => true) end step "verify git checkout is own by group #{group}" do diff --git a/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb b/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb index 5bce264..5388f7f 100644 --- a/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb +++ b/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb @@ -14,7 +14,7 @@ hosts.each do |host| end step 'setup - delete group' do - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true) end teardown do @@ -31,8 +31,7 @@ hosts.each do |host| } EOS - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) + apply_manifest_on(host, pp, :expect_failures => true) end step "verify git checkout is NOT owned by group #{group}" do -- cgit v1.2.3