From 591725e0f2a0dd0dd31b0086dbd4068bd302b0e1 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Sat, 10 May 2014 21:13:03 -0700 Subject: Move git tests into sub-directory --- .../git/branch_checkout/branch_checkout_file.rb | 44 +++++++++++++++ .../branch_checkout/branch_checkout_file_path.rb | 44 +++++++++++++++ .../git/branch_checkout/branch_checkout_git.rb | 49 +++++++++++++++++ .../git/branch_checkout/branch_checkout_http.rb | 56 +++++++++++++++++++ .../git/branch_checkout/branch_checkout_https.rb | 63 ++++++++++++++++++++++ .../git/branch_checkout/branch_checkout_ssh.rb | 54 +++++++++++++++++++ .../negative/branch_checkout_not_exists.rb | 43 +++++++++++++++ 7 files changed, 353 insertions(+) create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb create mode 100644 spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb new file mode 100644 index 0000000..6ed945b --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb @@ -0,0 +1,44 @@ +test_name 'C3438 - checkout a branch (file protocol)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb new file mode 100644 index 0000000..441a2bc --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb @@ -0,0 +1,44 @@ +test_name 'C3437 - checkout a branch (file path)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb new file mode 100644 index 0000000..d786ae2 --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb @@ -0,0 +1,49 @@ +test_name 'C3436 - checkout a branch (git protocol)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + step 'setup - start git daemon' do + install_package(host, 'git-daemon') + on(host, "nohup git daemon --detach --base-path=/#{tmpdir}") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + on(host, 'pkill -9 git-daemon') + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb new file mode 100644 index 0000000..151d801 --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb @@ -0,0 +1,56 @@ +test_name 'C3441 - checkout a branch (http protocol)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + + step 'setup - start http server' do + http_daemon =<<-EOF + require 'webrick' + server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") + WEBrick::Daemon.start + server.start + EOF + create_remote_file(host, '/tmp/http_daemon.rb', http_daemon) + on(host, "ruby /tmp/http_daemon.rb") + 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') + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb new file mode 100644 index 0000000..273f5aa --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb @@ -0,0 +1,63 @@ +test_name 'C3442 - checkout a branch (https protocol)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + step 'setup - start https server' do + https_daemon =<<-EOF + require 'webrick' + require 'webrick/https' + server = WEBrick::HTTPServer.new( + :Port => 8443, + :DocumentRoot => "#{tmpdir}", + :SSLEnable => true, + :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, + :SSLCertificate => OpenSSL::X509::Certificate.new( File.open("#{tmpdir}/server.crt").read), + :SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("#{tmpdir}/server.key").read), + :SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ]) + WEBrick::Daemon.start + server.start + EOF + create_remote_file(host, '/tmp/https_daemon.rb', https_daemon) + #on(host, "ruby /tmp/https_daemon.rb") + 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') + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb new file mode 100644 index 0000000..ea9fb4a --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb @@ -0,0 +1,54 @@ +test_name 'C3440 - checkout a branch (ssh protocol)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + step 'setup - establish ssh keys' do + # create ssh keys + on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') + + # copy public key to authorized_keys + on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') + on(host, 'chown -R root:root /root/.ssh') + 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 }") + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end diff --git a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb new file mode 100644 index 0000000..f8c85d0 --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb @@ -0,0 +1,43 @@ +test_name 'C3609 - checkout a branch that does not exist' + +# Globals +repo_name = 'testrepo_branch_checkout' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'checkout branch that does not exist with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + revision => 'non_existent_branch', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify that master branch is checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/master" + end + end + +end -- cgit v1.2.3 From 93a410c9ad3d8b3cb8da1ce79040cd00475fceaf Mon Sep 17 00:00:00 2001 From: John Duarte Date: Mon, 12 May 2014 10:39:37 -0700 Subject: Add tests git using ssh scp syntax --- .../git/branch_checkout/branch_checkout_scp.rb | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb new file mode 100644 index 0000000..0a4e07a --- /dev/null +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb @@ -0,0 +1,54 @@ +test_name 'C3439 - checkout a branch (ssh protocol, scp syntax)' + +# Globals +repo_name = 'testrepo_branch_checkout' +branch = 'a_branch' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create repo' do + install_package(host, 'git') + my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) + on(host, "cd #{tmpdir} && ./create_git_repo.sh") + end + step 'setup - establish ssh keys' do + # create ssh keys + on(host, 'ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') + + # copy public key to authorized_keys + on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') + on(host, 'chown -R root:root /root/.ssh') + 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 }") + end + + step 'checkout a branch with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "root@#{host}:#{tmpdir}/testrepo.git", + provider => git, + revision => '#{branch}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is on the #{branch} branch" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}" + end + end + +end -- cgit v1.2.3 From 97e64b52f63f3dd673dfa2fe92c71d4d9ddbcbc7 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Thu, 15 May 2014 11:43:29 -0700 Subject: Add conditional ruby path based on pe --- spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb | 5 +++-- spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb index 151d801..9fea700 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb @@ -5,6 +5,7 @@ repo_name = 'testrepo_branch_checkout' branch = 'a_branch' hosts.each do |host| + ruby = '/opt/puppet/bin/ruby' if host.is_pe? || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do install_package(host, 'git') @@ -21,12 +22,12 @@ hosts.each do |host| server.start EOF create_remote_file(host, '/tmp/http_daemon.rb', http_daemon) - on(host, "ruby /tmp/http_daemon.rb") + on(host, "#{ruby} /tmp/http_daemon.rb") 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') + on(host, 'ps ax | grep "#{ruby} /tmp/http_daemon.rb" | grep -v grep | awk \'{print "kill -9 " $1}\' | sh') end step 'checkout a branch with puppet' do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb index 273f5aa..4d6a4ab 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb @@ -5,6 +5,7 @@ repo_name = 'testrepo_branch_checkout' branch = 'a_branch' hosts.each do |host| + ruby = '/opt/puppet/bin/ruby' if host.is_pe? || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do install_package(host, 'git') @@ -28,12 +29,12 @@ hosts.each do |host| server.start EOF create_remote_file(host, '/tmp/https_daemon.rb', https_daemon) - #on(host, "ruby /tmp/https_daemon.rb") + #on(host, "#{ruby} /tmp/https_daemon.rb") 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') + on(host, 'ps ax | grep "#{ruby} /tmp/https_daemon.rb" | grep -v grep | awk \'{print "kill -9 " $1}\' | sh') end step 'checkout a branch with puppet' do -- cgit v1.2.3 From 0406d627bcd7e24d181944b4d2c70a7b6e50ccf5 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Fri, 16 May 2014 14:58:17 -0700 Subject: Fix calls to ruby --- spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb | 4 ++-- spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb index 9fea700..6da34e8 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb @@ -5,7 +5,7 @@ repo_name = 'testrepo_branch_checkout' branch = 'a_branch' hosts.each do |host| - ruby = '/opt/puppet/bin/ruby' if host.is_pe? || 'ruby' + ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do install_package(host, 'git') @@ -27,7 +27,7 @@ hosts.each do |host| 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') + on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh") end step 'checkout a branch with puppet' do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb index 4d6a4ab..6ebd9fd 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb @@ -5,7 +5,7 @@ repo_name = 'testrepo_branch_checkout' branch = 'a_branch' hosts.each do |host| - ruby = '/opt/puppet/bin/ruby' if host.is_pe? || 'ruby' + ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do install_package(host, 'git') @@ -34,7 +34,7 @@ hosts.each do |host| 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') + on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh") end step 'checkout a branch with puppet' do -- cgit v1.2.3 From e42f4047c086a79fa0286dc9e46cdfe187a18320 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Sun, 18 May 2014 17:26:20 -0700 Subject: Fix git daemon call --- spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb index d786ae2..baeb5ec 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb @@ -14,7 +14,7 @@ hosts.each do |host| end step 'setup - start git daemon' do install_package(host, 'git-daemon') - on(host, "nohup git daemon --detach --base-path=/#{tmpdir}") + on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") end teardown do -- cgit v1.2.3 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/branch_checkout/branch_checkout_file.rb | 4 ++-- .../beaker/git/branch_checkout/branch_checkout_file_path.rb | 4 ++-- .../beaker/git/branch_checkout/branch_checkout_git.rb | 6 +++--- .../beaker/git/branch_checkout/branch_checkout_http.rb | 6 +++--- .../beaker/git/branch_checkout/branch_checkout_https.rb | 6 +++--- .../beaker/git/branch_checkout/branch_checkout_scp.rb | 11 ++++++----- .../beaker/git/branch_checkout/branch_checkout_ssh.rb | 11 ++++++----- .../branch_checkout/negative/branch_checkout_not_exists.rb | 3 +-- 8 files changed, 26 insertions(+), 25 deletions(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb index 6ed945b..1fbdd1a 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb @@ -27,8 +27,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb index 441a2bc..efbedc7 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb @@ -27,8 +27,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb index baeb5ec..8afa813 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb @@ -19,7 +19,7 @@ hosts.each do |host| teardown do on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon') + on(host, 'pkill -9 git-daemon ; sleep 1') end step 'checkout a branch 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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb index 6da34e8..a8d622d 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb @@ -27,7 +27,7 @@ hosts.each do |host| 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") + on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") end step 'checkout a branch with puppet' do @@ -40,8 +40,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb index 6ebd9fd..f6baf19 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb @@ -34,7 +34,7 @@ hosts.each do |host| 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") + on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") end step 'checkout a branch with puppet' do @@ -47,8 +47,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb index 0a4e07a..e55f805 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb @@ -14,17 +14,18 @@ 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 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, "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) end step 'checkout a branch with puppet' do @@ -37,8 +38,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb index ea9fb4a..6063bb9 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb @@ -14,17 +14,18 @@ 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 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, "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) end step 'checkout a branch with puppet' do @@ -37,8 +38,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 checkout is on the #{branch} branch" do diff --git a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb index f8c85d0..e44ea7e 100644 --- a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb +++ b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb @@ -26,8 +26,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 that master branch is checked out' do -- cgit v1.2.3 From 47b32a8d380beb48e0ea85be904c48da0405e982 Mon Sep 17 00:00:00 2001 From: John Duarte Date: Sat, 14 Jun 2014 08:02:45 -0700 Subject: Change tests to not install git-daemon on debian The git-daemon is not a valid package on debian based systems. Update tests to not try installing git-daemon on debian systems. --- spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb index 8afa813..837e170 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb @@ -13,7 +13,7 @@ hosts.each do |host| on(host, "cd #{tmpdir} && ./create_git_repo.sh") end step 'setup - start git daemon' do - install_package(host, 'git-daemon') + install_package(host, 'git-daemon') unless host['platform'] =~ /debian|ubuntu/ on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") end -- cgit v1.2.3 From e6a561125b6477051c339d5dfce909e4318f504c Mon Sep 17 00:00:00 2001 From: John Duarte Date: Sat, 14 Jun 2014 11:57:07 -0700 Subject: Accomodate ubuntu-10 package for git in beaker tests Add conditional to install `git-core` if the platform under test is ubuntu-10. The `git` package is not available for this platform. --- spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb | 6 +++++- .../beaker/git/branch_checkout/branch_checkout_file_path.rb | 6 +++++- spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb | 6 +++++- spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb | 6 +++++- spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb | 6 +++++- spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb | 6 +++++- spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb | 6 +++++- .../git/branch_checkout/negative/branch_checkout_not_exists.rb | 6 +++++- 8 files changed, 40 insertions(+), 8 deletions(-) (limited to 'spec/acceptance/beaker/git/branch_checkout') diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb index 1fbdd1a..3d2131c 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb @@ -7,7 +7,11 @@ branch = 'a_branch' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb index efbedc7..49b034e 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb @@ -7,7 +7,11 @@ branch = 'a_branch' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb index 837e170..9557de8 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb @@ -7,7 +7,11 @@ branch = 'a_branch' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb index a8d622d..fec60e2 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb @@ -8,7 +8,11 @@ hosts.each do |host| ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb index f6baf19..3474c73 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb @@ -8,7 +8,11 @@ hosts.each do |host| ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb index e55f805..493b3f4 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb @@ -7,7 +7,11 @@ branch = 'a_branch' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb index 6063bb9..5195ab8 100644 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb +++ b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb @@ -7,7 +7,11 @@ branch = 'a_branch' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") diff --git a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb index e44ea7e..7b9e64d 100644 --- a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb +++ b/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb @@ -6,7 +6,11 @@ repo_name = 'testrepo_branch_checkout' hosts.each do |host| tmpdir = host.tmpdir('vcsrepo') step 'setup - create repo' do - install_package(host, 'git') + git_pkg = 'git' + if host['platform'] =~ /ubuntu-10/ + git_pkg = 'git-core' + end + install_package(host, git_pkg) my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) on(host, "cd #{tmpdir} && ./create_git_repo.sh") -- cgit v1.2.3