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 --- .../beaker/branch_checkout/branch_checkout_file.rb | 44 -------------- .../branch_checkout/branch_checkout_file_path.rb | 44 -------------- .../beaker/branch_checkout/branch_checkout_git.rb | 49 --------------- .../beaker/branch_checkout/branch_checkout_http.rb | 56 ------------------ .../branch_checkout/branch_checkout_https.rb | 63 -------------------- .../beaker/branch_checkout/branch_checkout_ssh.rb | 54 ----------------- .../negative/branch_checkout_not_exists.rb | 43 -------------- ...clone_over_different_exiting_repo_with_force.rb | 44 -------------- .../clone/clone_repo_with_excludes_in_repo.rb | 42 ------------- .../clone/clone_repo_with_excludes_not_in_repo.rb | 42 ------------- .../negative/clone_over_different_exiting_repo.rb | 43 -------------- .../negative/clone_repo_with_hostile_excludes.rb | 40 ------------- .../beaker/compression/compression_0_checkout.rb | 39 ------------ .../beaker/compression/compression_1_checkout.rb | 39 ------------ .../beaker/compression/compression_2_checkout.rb | 39 ------------ .../beaker/compression/compression_3_checkout.rb | 39 ------------ .../beaker/compression/compression_4_checkout.rb | 39 ------------ .../beaker/compression/compression_5_checkout.rb | 39 ------------ .../beaker/compression/compression_6_checkout.rb | 39 ------------ .../compression/negative/compression_7_checkout.rb | 39 ------------ .../negative/compression_alpha_checkout.rb | 39 ------------ .../negative/compression_eval_checkout.rb | 39 ------------ .../negative/compression_exec_checkout.rb | 39 ------------ .../negative/compression_negative_checkout.rb | 39 ------------ .../create/create_bare_repo_that_already_exists.rb | 35 ----------- .../create/create_repo_that_already_exists.rb | 37 ------------ .../create_bare_repo_specifying_revision.rb | 34 ----------- .../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 ++++++++++++++ ...clone_over_different_exiting_repo_with_force.rb | 44 ++++++++++++++ .../git/clone/clone_repo_with_excludes_in_repo.rb | 42 +++++++++++++ .../clone/clone_repo_with_excludes_not_in_repo.rb | 42 +++++++++++++ .../negative/clone_over_different_exiting_repo.rb | 43 ++++++++++++++ .../negative/clone_repo_with_hostile_excludes.rb | 40 +++++++++++++ .../git/compression/compression_0_checkout.rb | 39 ++++++++++++ .../git/compression/compression_1_checkout.rb | 39 ++++++++++++ .../git/compression/compression_2_checkout.rb | 39 ++++++++++++ .../git/compression/compression_3_checkout.rb | 39 ++++++++++++ .../git/compression/compression_4_checkout.rb | 39 ++++++++++++ .../git/compression/compression_5_checkout.rb | 39 ++++++++++++ .../git/compression/compression_6_checkout.rb | 39 ++++++++++++ .../compression/negative/compression_7_checkout.rb | 39 ++++++++++++ .../negative/compression_alpha_checkout.rb | 39 ++++++++++++ .../negative/compression_eval_checkout.rb | 39 ++++++++++++ .../negative/compression_exec_checkout.rb | 39 ++++++++++++ .../negative/compression_negative_checkout.rb | 39 ++++++++++++ .../create/create_bare_repo_that_already_exists.rb | 35 +++++++++++ .../git/create/create_repo_that_already_exists.rb | 37 ++++++++++++ .../create_bare_repo_specifying_revision.rb | 34 +++++++++++ .../git/group_checkout/group_checkout_file.rb | 49 +++++++++++++++ .../git/group_checkout/group_checkout_file_path.rb | 49 +++++++++++++++ .../git/group_checkout/group_checkout_git.rb | 54 +++++++++++++++++ .../git/group_checkout/group_checkout_http.rb | 61 +++++++++++++++++++ .../git/group_checkout/group_checkout_https.rb | 68 +++++++++++++++++++++ .../git/group_checkout/group_checkout_ssh.rb | 59 ++++++++++++++++++ .../group_checkout_file_non_existent_group.rb | 48 +++++++++++++++ .../negative/revision_checkout_not_exists.rb | 43 ++++++++++++++ .../revision_checkout/revision_checkout_file.rb | 49 +++++++++++++++ .../revision_checkout_file_path.rb | 49 +++++++++++++++ .../git/revision_checkout/revision_checkout_git.rb | 54 +++++++++++++++++ .../revision_checkout/revision_checkout_http.rb | 61 +++++++++++++++++++ .../revision_checkout/revision_checkout_https.rb | 69 ++++++++++++++++++++++ .../git/revision_checkout/revision_checkout_ssh.rb | 59 ++++++++++++++++++ .../negative/shallow_clone_hostile_depth.rb | 39 ++++++++++++ .../negative/shallow_clone_negative_depth.rb | 39 ++++++++++++ .../negative/shallow_clone_overflow_depth.rb | 39 ++++++++++++ .../beaker/git/shallow_clone/shallow_clone_file.rb | 43 ++++++++++++++ .../git/shallow_clone/shallow_clone_file_path.rb | 43 ++++++++++++++ .../beaker/git/shallow_clone/shallow_clone_git.rb | 48 +++++++++++++++ .../beaker/git/shallow_clone/shallow_clone_http.rb | 55 +++++++++++++++++ .../git/shallow_clone/shallow_clone_https.rb | 62 +++++++++++++++++++ .../beaker/git/shallow_clone/shallow_clone_ssh.rb | 53 +++++++++++++++++ .../git/shallow_clone/shallow_clone_zero_depth.rb | 39 ++++++++++++ .../negative/tag_checkout_not_exists.rb | 43 ++++++++++++++ .../beaker/git/tag_checkout/tag_checkout_file.rb | 44 ++++++++++++++ .../git/tag_checkout/tag_checkout_file_path.rb | 44 ++++++++++++++ .../beaker/git/tag_checkout/tag_checkout_git.rb | 55 +++++++++++++++++ .../beaker/git/tag_checkout/tag_checkout_http.rb | 62 +++++++++++++++++++ .../beaker/git/tag_checkout/tag_checkout_https.rb | 69 ++++++++++++++++++++++ .../beaker/git/tag_checkout/tag_checkout_ssh.rb | 60 +++++++++++++++++++ .../user_checkout_file_non_existent_user.rb | 48 +++++++++++++++ .../beaker/git/user_checkout/user_checkout_file.rb | 49 +++++++++++++++ .../git/user_checkout/user_checkout_file_path.rb | 49 +++++++++++++++ .../beaker/git/user_checkout/user_checkout_git.rb | 54 +++++++++++++++++ .../beaker/git/user_checkout/user_checkout_http.rb | 61 +++++++++++++++++++ .../git/user_checkout/user_checkout_https.rb | 68 +++++++++++++++++++++ .../beaker/git/user_checkout/user_checkout_ssh.rb | 59 ++++++++++++++++++ .../beaker/group_checkout/group_checkout_file.rb | 49 --------------- .../group_checkout/group_checkout_file_path.rb | 49 --------------- .../beaker/group_checkout/group_checkout_git.rb | 54 ----------------- .../beaker/group_checkout/group_checkout_http.rb | 61 ------------------- .../beaker/group_checkout/group_checkout_https.rb | 68 --------------------- .../beaker/group_checkout/group_checkout_ssh.rb | 59 ------------------ .../group_checkout_file_non_existent_group.rb | 48 --------------- .../negative/revision_checkout_not_exists.rb | 43 -------------- .../revision_checkout/revision_checkout_file.rb | 49 --------------- .../revision_checkout_file_path.rb | 49 --------------- .../revision_checkout/revision_checkout_git.rb | 54 ----------------- .../revision_checkout/revision_checkout_http.rb | 61 ------------------- .../revision_checkout/revision_checkout_https.rb | 69 ---------------------- .../revision_checkout/revision_checkout_ssh.rb | 59 ------------------ .../negative/shallow_clone_hostile_depth.rb | 39 ------------ .../negative/shallow_clone_negative_depth.rb | 39 ------------ .../negative/shallow_clone_overflow_depth.rb | 39 ------------ .../beaker/shallow_clone/shallow_clone_file.rb | 43 -------------- .../shallow_clone/shallow_clone_file_path.rb | 43 -------------- .../beaker/shallow_clone/shallow_clone_git.rb | 48 --------------- .../beaker/shallow_clone/shallow_clone_http.rb | 55 ----------------- .../beaker/shallow_clone/shallow_clone_https.rb | 62 ------------------- .../beaker/shallow_clone/shallow_clone_ssh.rb | 53 ----------------- .../shallow_clone/shallow_clone_zero_depth.rb | 39 ------------ .../negative/tag_checkout_not_exists.rb | 43 -------------- .../beaker/tag_checkout/tag_checkout_file.rb | 44 -------------- .../beaker/tag_checkout/tag_checkout_file_path.rb | 44 -------------- .../beaker/tag_checkout/tag_checkout_git.rb | 55 ----------------- .../beaker/tag_checkout/tag_checkout_http.rb | 62 ------------------- .../beaker/tag_checkout/tag_checkout_https.rb | 69 ---------------------- .../beaker/tag_checkout/tag_checkout_ssh.rb | 60 ------------------- .../user_checkout_file_non_existent_user.rb | 48 --------------- .../beaker/user_checkout/user_checkout_file.rb | 49 --------------- .../user_checkout/user_checkout_file_path.rb | 49 --------------- .../beaker/user_checkout/user_checkout_git.rb | 54 ----------------- .../beaker/user_checkout/user_checkout_http.rb | 61 ------------------- .../beaker/user_checkout/user_checkout_https.rb | 68 --------------------- .../beaker/user_checkout/user_checkout_ssh.rb | 59 ------------------ 130 files changed, 3135 insertions(+), 3135 deletions(-) delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_file.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_git.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_http.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_https.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/branch_checkout_ssh.rb delete mode 100644 spec/acceptance/beaker/branch_checkout/negative/branch_checkout_not_exists.rb delete mode 100644 spec/acceptance/beaker/clone/clone_over_different_exiting_repo_with_force.rb delete mode 100644 spec/acceptance/beaker/clone/clone_repo_with_excludes_in_repo.rb delete mode 100644 spec/acceptance/beaker/clone/clone_repo_with_excludes_not_in_repo.rb delete mode 100644 spec/acceptance/beaker/clone/negative/clone_over_different_exiting_repo.rb delete mode 100644 spec/acceptance/beaker/clone/negative/clone_repo_with_hostile_excludes.rb delete mode 100644 spec/acceptance/beaker/compression/compression_0_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_1_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_2_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_3_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_4_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_5_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/compression_6_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/negative/compression_7_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/negative/compression_alpha_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/negative/compression_eval_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/negative/compression_exec_checkout.rb delete mode 100644 spec/acceptance/beaker/compression/negative/compression_negative_checkout.rb delete mode 100644 spec/acceptance/beaker/create/create_bare_repo_that_already_exists.rb delete mode 100644 spec/acceptance/beaker/create/create_repo_that_already_exists.rb delete mode 100644 spec/acceptance/beaker/create/negative/create_bare_repo_specifying_revision.rb 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 create mode 100644 spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb create mode 100644 spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb create mode 100644 spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb create mode 100644 spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb create mode 100644 spec/acceptance/beaker/git/clone/negative/clone_repo_with_hostile_excludes.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_0_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_1_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_2_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_3_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_4_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_5_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/compression_6_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/negative/compression_7_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/negative/compression_alpha_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/negative/compression_eval_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/negative/compression_exec_checkout.rb create mode 100644 spec/acceptance/beaker/git/compression/negative/compression_negative_checkout.rb create mode 100644 spec/acceptance/beaker/git/create/create_bare_repo_that_already_exists.rb create mode 100644 spec/acceptance/beaker/git/create/create_repo_that_already_exists.rb create mode 100644 spec/acceptance/beaker/git/create/negative/create_bare_repo_specifying_revision.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb create mode 100644 spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/negative/revision_checkout_not_exists.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_file.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_file_path.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_git.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_http.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_https.rb create mode 100644 spec/acceptance/beaker/git/revision_checkout/revision_checkout_ssh.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_hostile_depth.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_negative_depth.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_overflow_depth.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_file.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_file_path.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_http.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_https.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_ssh.rb create mode 100644 spec/acceptance/beaker/git/shallow_clone/shallow_clone_zero_depth.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/negative/tag_checkout_not_exists.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_file.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_file_path.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_git.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_http.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_https.rb create mode 100644 spec/acceptance/beaker/git/tag_checkout/tag_checkout_ssh.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/negative/user_checkout_file_non_existent_user.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_file.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_file_path.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_git.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_http.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_https.rb create mode 100644 spec/acceptance/beaker/git/user_checkout/user_checkout_ssh.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_file.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_file_path.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_git.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_http.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_https.rb delete mode 100644 spec/acceptance/beaker/group_checkout/group_checkout_ssh.rb delete mode 100644 spec/acceptance/beaker/group_checkout/negative/group_checkout_file_non_existent_group.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/negative/revision_checkout_not_exists.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_file.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_file_path.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_git.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_http.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_https.rb delete mode 100644 spec/acceptance/beaker/revision_checkout/revision_checkout_ssh.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/negative/shallow_clone_hostile_depth.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/negative/shallow_clone_negative_depth.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/negative/shallow_clone_overflow_depth.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_file.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_file_path.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_git.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_http.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_https.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_ssh.rb delete mode 100644 spec/acceptance/beaker/shallow_clone/shallow_clone_zero_depth.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/negative/tag_checkout_not_exists.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_file.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_file_path.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_git.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_http.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_https.rb delete mode 100644 spec/acceptance/beaker/tag_checkout/tag_checkout_ssh.rb delete mode 100644 spec/acceptance/beaker/user_checkout/negative/user_checkout_file_non_existent_user.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_file.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_file_path.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_git.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_http.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_https.rb delete mode 100644 spec/acceptance/beaker/user_checkout/user_checkout_ssh.rb (limited to 'spec/acceptance') diff --git a/spec/acceptance/beaker/branch_checkout/branch_checkout_file.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_file.rb deleted file mode 100644 index e78e374..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_file.rb +++ /dev/null @@ -1,44 +0,0 @@ -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/branch_checkout/branch_checkout_file_path.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb deleted file mode 100644 index 9870daa..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb +++ /dev/null @@ -1,44 +0,0 @@ -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/branch_checkout/branch_checkout_git.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_git.rb deleted file mode 100644 index a319b7d..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_git.rb +++ /dev/null @@ -1,49 +0,0 @@ -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/branch_checkout/branch_checkout_http.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_http.rb deleted file mode 100644 index ddfaff5..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_http.rb +++ /dev/null @@ -1,56 +0,0 @@ -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/branch_checkout/branch_checkout_https.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_https.rb deleted file mode 100644 index 024daaa..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_https.rb +++ /dev/null @@ -1,63 +0,0 @@ -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/branch_checkout/branch_checkout_ssh.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_ssh.rb deleted file mode 100644 index 8eabd98..0000000 --- a/spec/acceptance/beaker/branch_checkout/branch_checkout_ssh.rb +++ /dev/null @@ -1,54 +0,0 @@ -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/branch_checkout/negative/branch_checkout_not_exists.rb b/spec/acceptance/beaker/branch_checkout/negative/branch_checkout_not_exists.rb deleted file mode 100644 index 5168ac7..0000000 --- a/spec/acceptance/beaker/branch_checkout/negative/branch_checkout_not_exists.rb +++ /dev/null @@ -1,43 +0,0 @@ -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 diff --git a/spec/acceptance/beaker/clone/clone_over_different_exiting_repo_with_force.rb b/spec/acceptance/beaker/clone/clone_over_different_exiting_repo_with_force.rb deleted file mode 100644 index 2d755fc..0000000 --- a/spec/acceptance/beaker/clone/clone_over_different_exiting_repo_with_force.rb +++ /dev/null @@ -1,44 +0,0 @@ -test_name 'C3511 - clone over an existing repo with force' - -# Globals -repo_name = 'testrepo_already_exists' - -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") - on(host, "mkdir #{tmpdir}/#{repo_name}") - on(host, "cd #{tmpdir}/#{repo_name} && git init") - on(host, "cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone over existing repo with force using puppet' do - on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| - @existing_sha = res.stdout - end - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - force => true, - } - EOS - - apply_manifest_on(host, pp) - end - - step 'verify new repo has replaced old one' do - on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| - fail_test('original repo not replaced by force') if res.stdout.include? "#{@existing_sha}" - end - end - -end diff --git a/spec/acceptance/beaker/clone/clone_repo_with_excludes_in_repo.rb b/spec/acceptance/beaker/clone/clone_repo_with_excludes_in_repo.rb deleted file mode 100644 index 1252e3b..0000000 --- a/spec/acceptance/beaker/clone/clone_repo_with_excludes_in_repo.rb +++ /dev/null @@ -1,42 +0,0 @@ -test_name 'C3507 - clone repo with excludes in repo' - -# Globals -repo_name = 'testrepo_with_excludes_in_repo' -exclude1 = 'file1.txt' -exclude2 ='file2.txt' - -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 'clone repo with excludes in repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}', '#{exclude2}' ], - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify exludes are known to git' do - on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| - fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" - fail_test('exclude not found') unless res.stdout.include? "#{exclude2}" - end - end - -end diff --git a/spec/acceptance/beaker/clone/clone_repo_with_excludes_not_in_repo.rb b/spec/acceptance/beaker/clone/clone_repo_with_excludes_not_in_repo.rb deleted file mode 100644 index ce173fd..0000000 --- a/spec/acceptance/beaker/clone/clone_repo_with_excludes_not_in_repo.rb +++ /dev/null @@ -1,42 +0,0 @@ -test_name 'C3508 - clone repo with excludes not in repo' - -# Globals -repo_name = 'testrepo_with_excludes_not_in_repo' -exclude1 = 'worh02o' -exclude2 ='ho398b' - -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 'clone repo with excludes not in repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}', '#{exclude2}' ], - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify exludes are known to git' do - on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| - fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" - fail_test('exclude not found') unless res.stdout.include? "#{exclude2}" - end - end - -end diff --git a/spec/acceptance/beaker/clone/negative/clone_over_different_exiting_repo.rb b/spec/acceptance/beaker/clone/negative/clone_over_different_exiting_repo.rb deleted file mode 100644 index 7821ce2..0000000 --- a/spec/acceptance/beaker/clone/negative/clone_over_different_exiting_repo.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3482 - clone over an existing repo' - -# Globals -repo_name = 'testrepo_already_exists' - -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") - on(host, "mkdir #{tmpdir}/#{repo_name}") - on(host, "cd #{tmpdir}/#{repo_name} && git init") - on(host, "cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone over existing repo using puppet' do - on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| - @existing_sha = res.stdout - end - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - } - EOS - - apply_manifest_on(host, pp) - end - - step 'verify original repo was not replaced' do - on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| - fail_test('original repo was replaced without force') unless res.stdout.include? "#{@existing_sha}" - end - end - -end diff --git a/spec/acceptance/beaker/clone/negative/clone_repo_with_hostile_excludes.rb b/spec/acceptance/beaker/clone/negative/clone_repo_with_hostile_excludes.rb deleted file mode 100644 index 4e04c78..0000000 --- a/spec/acceptance/beaker/clone/negative/clone_repo_with_hostile_excludes.rb +++ /dev/null @@ -1,40 +0,0 @@ -test_name 'C3509 - clone repo with excludes not in repo' - -# Globals -repo_name = 'testrepo_with_excludes_not_in_repo' -exclude1 = 'rm -rf /tmp' - -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 'clone repo with excludes not in repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}' ], - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify excludes are known to git' do - on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| - fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_0_checkout.rb b/spec/acceptance/beaker/compression/compression_0_checkout.rb deleted file mode 100644 index fc62d4a..0000000 --- a/spec/acceptance/beaker/compression/compression_0_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3495 - checkout with compression 0' - -# Globals -repo_name = 'testrepo_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 with compression 0 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 0, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_1_checkout.rb b/spec/acceptance/beaker/compression/compression_1_checkout.rb deleted file mode 100644 index c1ec2f2..0000000 --- a/spec/acceptance/beaker/compression/compression_1_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3496 - checkout with compression 1' - -# Globals -repo_name = 'testrepo_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 with compression 1 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_2_checkout.rb b/spec/acceptance/beaker/compression/compression_2_checkout.rb deleted file mode 100644 index c92a878..0000000 --- a/spec/acceptance/beaker/compression/compression_2_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3497 - checkout with compression 2' - -# Globals -repo_name = 'testrepo_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 with compression 2 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 2, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_3_checkout.rb b/spec/acceptance/beaker/compression/compression_3_checkout.rb deleted file mode 100644 index 8cba272..0000000 --- a/spec/acceptance/beaker/compression/compression_3_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3498 - checkout with compression 3' - -# Globals -repo_name = 'testrepo_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 with compression 3 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 3, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_4_checkout.rb b/spec/acceptance/beaker/compression/compression_4_checkout.rb deleted file mode 100644 index c5c12a6..0000000 --- a/spec/acceptance/beaker/compression/compression_4_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3499 - checkout with compression 4' - -# Globals -repo_name = 'testrepo_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 with compression 4 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 4, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_5_checkout.rb b/spec/acceptance/beaker/compression/compression_5_checkout.rb deleted file mode 100644 index 474b62f..0000000 --- a/spec/acceptance/beaker/compression/compression_5_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3500 - checkout with compression 5' - -# Globals -repo_name = 'testrepo_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 with compression 5 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 5, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/compression_6_checkout.rb b/spec/acceptance/beaker/compression/compression_6_checkout.rb deleted file mode 100644 index b3fb71b..0000000 --- a/spec/acceptance/beaker/compression/compression_6_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3501 - checkout with compression 6' - -# Globals -repo_name = 'testrepo_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 with compression 6 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 6, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/negative/compression_7_checkout.rb b/spec/acceptance/beaker/compression/negative/compression_7_checkout.rb deleted file mode 100644 index b7af79a..0000000 --- a/spec/acceptance/beaker/compression/negative/compression_7_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3503 - checkout with compression 7' - -# Globals -repo_name = 'testrepo_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 with compression 7 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 7, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/negative/compression_alpha_checkout.rb b/spec/acceptance/beaker/compression/negative/compression_alpha_checkout.rb deleted file mode 100644 index 06a0a01..0000000 --- a/spec/acceptance/beaker/compression/negative/compression_alpha_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3505 - checkout with compression alpha' - -# Globals -repo_name = 'testrepo_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 with compression alpha with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => abcde, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/negative/compression_eval_checkout.rb b/spec/acceptance/beaker/compression/negative/compression_eval_checkout.rb deleted file mode 100644 index d66996e..0000000 --- a/spec/acceptance/beaker/compression/negative/compression_eval_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3504 - checkout with compression 10-5' - -# Globals -repo_name = 'testrepo_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 with compression 10-5 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 10-5, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/negative/compression_exec_checkout.rb b/spec/acceptance/beaker/compression/negative/compression_exec_checkout.rb deleted file mode 100644 index 46e730d..0000000 --- a/spec/acceptance/beaker/compression/negative/compression_exec_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3506 - checkout with compression exec' - -# Globals -repo_name = 'testrepo_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 with compression exec with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => `exec rm -rf /tmp`, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/compression/negative/compression_negative_checkout.rb b/spec/acceptance/beaker/compression/negative/compression_negative_checkout.rb deleted file mode 100644 index ee98057..0000000 --- a/spec/acceptance/beaker/compression/negative/compression_negative_checkout.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3502 - checkout with compression -1' - -# Globals -repo_name = 'testrepo_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 with compression -1 with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => -1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify git repo was checked out' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - end - -end diff --git a/spec/acceptance/beaker/create/create_bare_repo_that_already_exists.rb b/spec/acceptance/beaker/create/create_bare_repo_that_already_exists.rb deleted file mode 100644 index 663c758..0000000 --- a/spec/acceptance/beaker/create/create_bare_repo_that_already_exists.rb +++ /dev/null @@ -1,35 +0,0 @@ -test_name 'C3472 - create bare repo that already exists' - -# Globals -repo_name = 'testrepo_bare_repo_already_exists.git' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create bare repo' do - install_package(host, 'git') - on(host, "mkdir #{tmpdir}/#{repo_name}") - on(host, "cd #{tmpdir}/#{repo_name} && git --bare init") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'create bare repo that already exists using puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => bare, - provider => git, - } - EOS - - apply_manifest_on(host, pp) - end - - step 'verify repo does not contain .git directory' do - on(host, "ls -al #{tmpdir}/#{repo_name}") do |res| - fail_test "found .git for #{repo_name}" if res.stdout.include? ".git" - end - end - -end diff --git a/spec/acceptance/beaker/create/create_repo_that_already_exists.rb b/spec/acceptance/beaker/create/create_repo_that_already_exists.rb deleted file mode 100644 index 7c28998..0000000 --- a/spec/acceptance/beaker/create/create_repo_that_already_exists.rb +++ /dev/null @@ -1,37 +0,0 @@ -test_name 'C3470 - create repo that already exists' - -# Globals -repo_name = 'testrepo_already_exists' - -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") - on(host, "cd #{tmpdir} && git clone file://#{tmpdir}/testrepo.git #{repo_name}") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'create repo that already exists using puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - provider => git, - } - EOS - - apply_manifest_on(host, pp) - end - - step 'verify repo is on master branch' do - on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - assert_match(/ref: refs\/heads\/master/, stdout, "Git checkout not on master on #{host}") - end - end - -end diff --git a/spec/acceptance/beaker/create/negative/create_bare_repo_specifying_revision.rb b/spec/acceptance/beaker/create/negative/create_bare_repo_specifying_revision.rb deleted file mode 100644 index 6a12c8c..0000000 --- a/spec/acceptance/beaker/create/negative/create_bare_repo_specifying_revision.rb +++ /dev/null @@ -1,34 +0,0 @@ -test_name 'C3473 - create bare repo specifying revision' - -# Globals -repo_name = 'testrepo_bare.git' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup' do - install_package(host, 'git') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'create bare repo specifying revision using puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => bare, - revision => master, - provider => git, - } - EOS - - apply_manifest_on(host, pp, :acceptable_exit_codes => [1]) - end - - step 'verify repo was NOT created' do - on(host, "ls -al #{tmpdir}") do |res| - fail_test "found #{repo_name}" if res.stdout.include? "#{repo_name}" - end - end - -end 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 diff --git a/spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb b/spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb new file mode 100644 index 0000000..626d807 --- /dev/null +++ b/spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb @@ -0,0 +1,44 @@ +test_name 'C3511 - clone over an existing repo with force' + +# Globals +repo_name = 'testrepo_already_exists' + +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") + on(host, "mkdir #{tmpdir}/#{repo_name}") + on(host, "cd #{tmpdir}/#{repo_name} && git init") + on(host, "cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'clone over existing repo with force using puppet' do + on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| + @existing_sha = res.stdout + end + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + force => true, + } + EOS + + apply_manifest_on(host, pp) + end + + step 'verify new repo has replaced old one' do + on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| + fail_test('original repo not replaced by force') if res.stdout.include? "#{@existing_sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb b/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb new file mode 100644 index 0000000..0a5a1a8 --- /dev/null +++ b/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb @@ -0,0 +1,42 @@ +test_name 'C3507 - clone repo with excludes in repo' + +# Globals +repo_name = 'testrepo_with_excludes_in_repo' +exclude1 = 'file1.txt' +exclude2 ='file2.txt' + +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 'clone repo with excludes in repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + excludes => [ '#{exclude1}', '#{exclude2}' ], + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify exludes are known to git' do + on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| + fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" + fail_test('exclude not found') unless res.stdout.include? "#{exclude2}" + end + end + +end diff --git a/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb b/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb new file mode 100644 index 0000000..c533aa5 --- /dev/null +++ b/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb @@ -0,0 +1,42 @@ +test_name 'C3508 - clone repo with excludes not in repo' + +# Globals +repo_name = 'testrepo_with_excludes_not_in_repo' +exclude1 = 'worh02o' +exclude2 ='ho398b' + +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 'clone repo with excludes not in repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + excludes => [ '#{exclude1}', '#{exclude2}' ], + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify exludes are known to git' do + on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| + fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" + fail_test('exclude not found') unless res.stdout.include? "#{exclude2}" + end + end + +end diff --git a/spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb b/spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb new file mode 100644 index 0000000..67fea06 --- /dev/null +++ b/spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb @@ -0,0 +1,43 @@ +test_name 'C3482 - clone over an existing repo' + +# Globals +repo_name = 'testrepo_already_exists' + +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") + on(host, "mkdir #{tmpdir}/#{repo_name}") + on(host, "cd #{tmpdir}/#{repo_name} && git init") + on(host, "cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'clone over existing repo using puppet' do + on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| + @existing_sha = res.stdout + end + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + } + EOS + + apply_manifest_on(host, pp) + end + + step 'verify original repo was not replaced' do + on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res| + fail_test('original repo was replaced without force') unless res.stdout.include? "#{@existing_sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/clone/negative/clone_repo_with_hostile_excludes.rb b/spec/acceptance/beaker/git/clone/negative/clone_repo_with_hostile_excludes.rb new file mode 100644 index 0000000..6331840 --- /dev/null +++ b/spec/acceptance/beaker/git/clone/negative/clone_repo_with_hostile_excludes.rb @@ -0,0 +1,40 @@ +test_name 'C3509 - clone repo with excludes not in repo' + +# Globals +repo_name = 'testrepo_with_excludes_not_in_repo' +exclude1 = 'rm -rf /tmp' + +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 'clone repo with excludes not in repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + excludes => [ '#{exclude1}' ], + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify excludes are known to git' do + on(host, "cat #{tmpdir}/#{repo_name}/.git/info/exclude") do |res| + fail_test('exclude not found') unless res.stdout.include? "#{exclude1}" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_0_checkout.rb b/spec/acceptance/beaker/git/compression/compression_0_checkout.rb new file mode 100644 index 0000000..ee5a171 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_0_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3495 - checkout with compression 0' + +# Globals +repo_name = 'testrepo_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 with compression 0 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 0, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_1_checkout.rb b/spec/acceptance/beaker/git/compression/compression_1_checkout.rb new file mode 100644 index 0000000..01478a1 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_1_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3496 - checkout with compression 1' + +# Globals +repo_name = 'testrepo_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 with compression 1 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_2_checkout.rb b/spec/acceptance/beaker/git/compression/compression_2_checkout.rb new file mode 100644 index 0000000..b3413ea --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_2_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3497 - checkout with compression 2' + +# Globals +repo_name = 'testrepo_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 with compression 2 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 2, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_3_checkout.rb b/spec/acceptance/beaker/git/compression/compression_3_checkout.rb new file mode 100644 index 0000000..b8459a5 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_3_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3498 - checkout with compression 3' + +# Globals +repo_name = 'testrepo_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 with compression 3 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 3, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_4_checkout.rb b/spec/acceptance/beaker/git/compression/compression_4_checkout.rb new file mode 100644 index 0000000..f6fb5ec --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_4_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3499 - checkout with compression 4' + +# Globals +repo_name = 'testrepo_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 with compression 4 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 4, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_5_checkout.rb b/spec/acceptance/beaker/git/compression/compression_5_checkout.rb new file mode 100644 index 0000000..a09507c --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_5_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3500 - checkout with compression 5' + +# Globals +repo_name = 'testrepo_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 with compression 5 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 5, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/compression_6_checkout.rb b/spec/acceptance/beaker/git/compression/compression_6_checkout.rb new file mode 100644 index 0000000..0a2d5d5 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/compression_6_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3501 - checkout with compression 6' + +# Globals +repo_name = 'testrepo_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 with compression 6 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 6, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/negative/compression_7_checkout.rb b/spec/acceptance/beaker/git/compression/negative/compression_7_checkout.rb new file mode 100644 index 0000000..a6be973 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/negative/compression_7_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3503 - checkout with compression 7' + +# Globals +repo_name = 'testrepo_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 with compression 7 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 7, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/negative/compression_alpha_checkout.rb b/spec/acceptance/beaker/git/compression/negative/compression_alpha_checkout.rb new file mode 100644 index 0000000..8acdb57 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/negative/compression_alpha_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3505 - checkout with compression alpha' + +# Globals +repo_name = 'testrepo_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 with compression alpha with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => abcde, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/negative/compression_eval_checkout.rb b/spec/acceptance/beaker/git/compression/negative/compression_eval_checkout.rb new file mode 100644 index 0000000..5597646 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/negative/compression_eval_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3504 - checkout with compression 10-5' + +# Globals +repo_name = 'testrepo_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 with compression 10-5 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => 10-5, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/negative/compression_exec_checkout.rb b/spec/acceptance/beaker/git/compression/negative/compression_exec_checkout.rb new file mode 100644 index 0000000..de95838 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/negative/compression_exec_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3506 - checkout with compression exec' + +# Globals +repo_name = 'testrepo_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 with compression exec with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => `exec rm -rf /tmp`, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/compression/negative/compression_negative_checkout.rb b/spec/acceptance/beaker/git/compression/negative/compression_negative_checkout.rb new file mode 100644 index 0000000..b89f6f6 --- /dev/null +++ b/spec/acceptance/beaker/git/compression/negative/compression_negative_checkout.rb @@ -0,0 +1,39 @@ +test_name 'C3502 - checkout with compression -1' + +# Globals +repo_name = 'testrepo_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 with compression -1 with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + compression => -1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify git repo was checked out' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + end + +end diff --git a/spec/acceptance/beaker/git/create/create_bare_repo_that_already_exists.rb b/spec/acceptance/beaker/git/create/create_bare_repo_that_already_exists.rb new file mode 100644 index 0000000..663c758 --- /dev/null +++ b/spec/acceptance/beaker/git/create/create_bare_repo_that_already_exists.rb @@ -0,0 +1,35 @@ +test_name 'C3472 - create bare repo that already exists' + +# Globals +repo_name = 'testrepo_bare_repo_already_exists.git' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup - create bare repo' do + install_package(host, 'git') + on(host, "mkdir #{tmpdir}/#{repo_name}") + on(host, "cd #{tmpdir}/#{repo_name} && git --bare init") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'create bare repo that already exists using puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => bare, + provider => git, + } + EOS + + apply_manifest_on(host, pp) + end + + step 'verify repo does not contain .git directory' do + on(host, "ls -al #{tmpdir}/#{repo_name}") do |res| + fail_test "found .git for #{repo_name}" if res.stdout.include? ".git" + end + end + +end diff --git a/spec/acceptance/beaker/git/create/create_repo_that_already_exists.rb b/spec/acceptance/beaker/git/create/create_repo_that_already_exists.rb new file mode 100644 index 0000000..b1cdeae --- /dev/null +++ b/spec/acceptance/beaker/git/create/create_repo_that_already_exists.rb @@ -0,0 +1,37 @@ +test_name 'C3470 - create repo that already exists' + +# Globals +repo_name = 'testrepo_already_exists' + +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") + on(host, "cd #{tmpdir} && git clone file://#{tmpdir}/testrepo.git #{repo_name}") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'create repo that already exists using puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + provider => git, + } + EOS + + apply_manifest_on(host, pp) + end + + step 'verify repo is on master branch' do + on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + assert_match(/ref: refs\/heads\/master/, stdout, "Git checkout not on master on #{host}") + end + end + +end diff --git a/spec/acceptance/beaker/git/create/negative/create_bare_repo_specifying_revision.rb b/spec/acceptance/beaker/git/create/negative/create_bare_repo_specifying_revision.rb new file mode 100644 index 0000000..6a12c8c --- /dev/null +++ b/spec/acceptance/beaker/git/create/negative/create_bare_repo_specifying_revision.rb @@ -0,0 +1,34 @@ +test_name 'C3473 - create bare repo specifying revision' + +# Globals +repo_name = 'testrepo_bare.git' + +hosts.each do |host| + tmpdir = host.tmpdir('vcsrepo') + step 'setup' do + install_package(host, 'git') + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'create bare repo specifying revision using puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => bare, + revision => master, + provider => git, + } + EOS + + apply_manifest_on(host, pp, :acceptable_exit_codes => [1]) + end + + step 'verify repo was NOT created' do + on(host, "ls -al #{tmpdir}") do |res| + fail_test "found #{repo_name}" if res.stdout.include? "#{repo_name}" + end + end + +end diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb new file mode 100644 index 0000000..6913bd5 --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb @@ -0,0 +1,49 @@ +test_name 'C3487 - checkout as a group (file protocol)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + end + + step 'checkout as a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end 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 new file mode 100644 index 0000000..6701dda --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb @@ -0,0 +1,49 @@ +test_name 'C3486 - checkout as a group (file path)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + end + + step 'checkout a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb new file mode 100644 index 0000000..4752e5d --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb @@ -0,0 +1,54 @@ +test_name 'C3485 - checkout as a group (git protocol)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 + + step 'setup - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + on(host, 'pkill -9 git-daemon') + apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + end + + step 'checkout a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb new file mode 100644 index 0000000..5c05baa --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb @@ -0,0 +1,61 @@ +test_name 'C3490 - checkout as a group (http protocol)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 + + step 'setup - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + 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, }") + end + + step 'checkout a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb new file mode 100644 index 0000000..4551aee --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb @@ -0,0 +1,68 @@ +test_name 'C3491 - checkout as a group (https protocol)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 + + step 'setup - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + 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, }") + end + + step 'checkout as a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end diff --git a/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb new file mode 100644 index 0000000..1255864 --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb @@ -0,0 +1,59 @@ +test_name 'C3489 - checkout as a group (ssh protocol)' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 + + step 'setup - create group' do + apply_manifest_on(host, "group { '#{group}': ensure => present, }") + 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, }") + end + + step 'checkout as a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is own by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" + end + end + +end 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 new file mode 100644 index 0000000..5bce264 --- /dev/null +++ b/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb @@ -0,0 +1,48 @@ +test_name 'C3484 - checkout as a group that is not on system' + +# Globals +repo_name = 'testrepo_group_checkout' +group = 'mygroup' + +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 - delete group' do + apply_manifest_on(host, "group { '#{group}': ensure => absent, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'checkout as a group with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + group => '#{group}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is NOT owned by group #{group}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by group') if res.stdout.include? ":#{group}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/negative/revision_checkout_not_exists.rb b/spec/acceptance/beaker/git/revision_checkout/negative/revision_checkout_not_exists.rb new file mode 100644 index 0000000..d1ee531 --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/negative/revision_checkout_not_exists.rb @@ -0,0 +1,43 @@ +test_name 'C3614 - checkout a revision that does not exist' + +# Globals +repo_name = 'testrepo_revision_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 revision that does not exist with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + revision => '11111111111111111', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify that master revision 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('revision not found') unless res.stdout.include? "ref: refs/heads/master" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file.rb new file mode 100644 index 0000000..3ff44ec --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file.rb @@ -0,0 +1,49 @@ +test_name 'C3452 - checkout a revision (file protocol)' + +# Globals +repo_name = 'testrepo_revision_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 'get revision sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + stop "verify repo is checked out to revision #{sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file_path.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file_path.rb new file mode 100644 index 0000000..cd92139 --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file_path.rb @@ -0,0 +1,49 @@ +test_name 'C3451 - checkout a revision (file path)' + +# Globals +repo_name = 'testrepo_revision_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 'get revision sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + stop "verify repo is checked out to revision #{sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_git.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_git.rb new file mode 100644 index 0000000..6979df3 --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_git.rb @@ -0,0 +1,54 @@ +test_name 'C3450 - checkout a revision (git protocol)' + +# Globals +repo_name = 'testrepo_revision_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 + 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 'get revision sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_http.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_http.rb new file mode 100644 index 0000000..40db6c9 --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_http.rb @@ -0,0 +1,61 @@ +test_name 'C3455 - checkout a revision (http protocol)' + +# Globals +repo_name = 'testrepo_revision_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 + + 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 'get revision sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_https.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_https.rb new file mode 100644 index 0000000..dc3dc7f --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_https.rb @@ -0,0 +1,69 @@ +test_name 'C3456 - checkout a revision (https protocol)' + +# Globals +repo_name = 'testrepo_revision_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 + 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 'get revision sha from repo' do + on(host, "git clone https://github.com/johnduarte/testrepo.git #{tmpdir}/foo") + on(host, "git --git-dir=#{tmpdir}/foo/.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_ssh.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_ssh.rb new file mode 100644 index 0000000..24b507e --- /dev/null +++ b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_ssh.rb @@ -0,0 +1,59 @@ +test_name 'C3454 - checkout a revision (ssh protocol)' + +# Globals +repo_name = 'testrepo_revision_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 + 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 'get revision sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a revision with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + revision => '#{@sha}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_hostile_depth.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_hostile_depth.rb new file mode 100644 index 0000000..0a4b467 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_hostile_depth.rb @@ -0,0 +1,39 @@ +test_name 'C3608 - shallow clone repo depth hostile input' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + depth => 'rm -rf /tmp', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is NOT shallow' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') if res.stdout.include? "shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_negative_depth.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_negative_depth.rb new file mode 100644 index 0000000..2ba1f0f --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_negative_depth.rb @@ -0,0 +1,39 @@ +test_name 'C3607 - shallow clone repo depth = -1' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + depth => -1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is NOT shallow' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') if res.stdout.include? "shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_overflow_depth.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_overflow_depth.rb new file mode 100644 index 0000000..55ff878 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_overflow_depth.rb @@ -0,0 +1,39 @@ +test_name 'C3606 - shallow clone repo depth overflow 64bit integer' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + depth => 18446744073709551616, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is NOT shallow' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') if res.stdout.include? "shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file.rb new file mode 100644 index 0000000..52eb3d2 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file.rb @@ -0,0 +1,43 @@ +test_name 'C3476 - shallow clone repo minimal depth = 1 (file protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file_path.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file_path.rb new file mode 100644 index 0000000..d9d18ce --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file_path.rb @@ -0,0 +1,43 @@ +test_name 'C3475 - shallow clone repo minimal depth = 1 (file path protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb new file mode 100644 index 0000000..8b3a16a --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb @@ -0,0 +1,48 @@ +test_name 'C3474 - shallow clone repo minimal depth = 1 (git protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_http.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_http.rb new file mode 100644 index 0000000..ad7e30e --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_http.rb @@ -0,0 +1,55 @@ +test_name 'C3479 - shallow clone repo minimal depth = 1 (http protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_https.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_https.rb new file mode 100644 index 0000000..e016e55 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_https.rb @@ -0,0 +1,62 @@ +test_name 'C3480 - shallow clone repo minimal depth = 1 (https protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_ssh.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_ssh.rb new file mode 100644 index 0000000..fda9bf4 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_ssh.rb @@ -0,0 +1,53 @@ +test_name 'C3477 - shallow clone repo minimal depth = 1 (ssh protocol)' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + depth => 1, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is shallow and of the correct depth' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow not found') unless res.stdout.include? "shallow" + end + + on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| + fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_zero_depth.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_zero_depth.rb new file mode 100644 index 0000000..6cec2a1 --- /dev/null +++ b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_zero_depth.rb @@ -0,0 +1,39 @@ +test_name 'C3404 - shallow clone repo depth = 0 non shallow' + +# Globals +repo_name = 'testrepo_shallow_clone' + +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 'shallow clone repo with puppet (zero depth means not shallow)' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + depth => 0, + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify checkout is NOT shallow' do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('shallow found') if res.stdout.include? "shallow" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/negative/tag_checkout_not_exists.rb b/spec/acceptance/beaker/git/tag_checkout/negative/tag_checkout_not_exists.rb new file mode 100644 index 0000000..5869513 --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/negative/tag_checkout_not_exists.rb @@ -0,0 +1,43 @@ +test_name 'C3612 - checkout a tag that does not exist' + +# Globals +repo_name = 'testrepo_tag_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 tag that does not exist with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + tag => '11111111111111111', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step 'verify that master tag 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('tag not found') unless res.stdout.include? "ref: refs/heads/master" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file.rb new file mode 100644 index 0000000..4ab8a6a --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file.rb @@ -0,0 +1,44 @@ +test_name 'C3445 - checkout a tag (file protocol)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file_path.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file_path.rb new file mode 100644 index 0000000..f73d4f9 --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file_path.rb @@ -0,0 +1,44 @@ +test_name 'C3444 - checkout a tag (file path)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_git.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_git.rb new file mode 100644 index 0000000..9ec124d --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_git.rb @@ -0,0 +1,55 @@ +test_name 'C3443 - checkout a tag (git protocol)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 'get tag sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_http.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_http.rb new file mode 100644 index 0000000..3a6d33f --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_http.rb @@ -0,0 +1,62 @@ +test_name 'C3448 - checkout a tag (http protocol)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 'get tag sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_https.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_https.rb new file mode 100644 index 0000000..b277d6d --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_https.rb @@ -0,0 +1,69 @@ +test_name 'C3449 - checkout a tag (https protocol)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 'get tag sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_ssh.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_ssh.rb new file mode 100644 index 0000000..f57f605 --- /dev/null +++ b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_ssh.rb @@ -0,0 +1,60 @@ +test_name 'C3447 - checkout a tag (ssh protocol)' + +# Globals +repo_name = 'testrepo_tag_checkout' +tag = '0.0.2' + +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 'get tag sha from repo' do + on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| + @sha = res.stdout.chomp + end + end + + step 'checkout a tag with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + revision => '#{tag}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify checkout out tag is #{tag}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| + fail_test('tag not found') unless res.stdout.include? "#{tag}" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/negative/user_checkout_file_non_existent_user.rb b/spec/acceptance/beaker/git/user_checkout/negative/user_checkout_file_non_existent_user.rb new file mode 100644 index 0000000..98099ee --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/negative/user_checkout_file_non_existent_user.rb @@ -0,0 +1,48 @@ +test_name 'C3483 - checkout as a user that is not on system' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 - delete user' do + apply_manifest_on(host, "user { '#{user}': ensure => absent, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + end + + step 'checkout as a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is NOT owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') if res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_file.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_file.rb new file mode 100644 index 0000000..9920b0b --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_file.rb @@ -0,0 +1,49 @@ +test_name 'C3459 - checkout as a user (file protocol)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + apply_manifest_on(host, "user { '#{user}': ensure => absent, }") + end + + step 'checkout as a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "file://#{tmpdir}/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_file_path.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_file_path.rb new file mode 100644 index 0000000..1817229 --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_file_path.rb @@ -0,0 +1,49 @@ +test_name 'C3458 - checkout as a user (file path)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + apply_manifest_on(host, "user { '#{user}': ensure => absent, }") + end + + step 'checkout a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "#{tmpdir}/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_git.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_git.rb new file mode 100644 index 0000000..d954a5f --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_git.rb @@ -0,0 +1,54 @@ +test_name 'C3457 - checkout as a user (git protocol)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 + + step 'setup - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + end + + teardown do + on(host, "rm -fr #{tmpdir}") + on(host, 'pkill -9 git-daemon') + apply_manifest_on(host, "user { '#{user}': ensure => absent, }") + end + + step 'checkout a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "git://#{host}/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_http.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_http.rb new file mode 100644 index 0000000..6faad95 --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_http.rb @@ -0,0 +1,61 @@ +test_name 'C3462 - checkout as a user (http protocol)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 + + step 'setup - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + 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, "user { '#{user}': ensure => absent, }") + end + + step 'checkout a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "http://#{host}:8000/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_https.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_https.rb new file mode 100644 index 0000000..28a17b8 --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_https.rb @@ -0,0 +1,68 @@ +test_name 'C3463 - checkout as a user (https protocol)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 + + step 'setup - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + 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, "user { '#{user}': ensure => absent, }") + end + + step 'checkout as a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "https://github.com/johnduarte/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/git/user_checkout/user_checkout_ssh.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_ssh.rb new file mode 100644 index 0000000..50c73f4 --- /dev/null +++ b/spec/acceptance/beaker/git/user_checkout/user_checkout_ssh.rb @@ -0,0 +1,59 @@ +test_name 'C3461 - checkout as a user (ssh protocol)' + +# Globals +repo_name = 'testrepo_user_checkout' +user = 'myuser' + +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 + + step 'setup - create user' do + apply_manifest_on(host, "user { '#{user}': ensure => present, }") + 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, "user { '#{user}': ensure => absent, }") + end + + step 'checkout as a user with puppet' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/#{repo_name}": + ensure => present, + source => "ssh://root@#{host}#{tmpdir}/testrepo.git", + provider => git, + owner => '#{user}', + } + EOS + + apply_manifest_on(host, pp) + apply_manifest_on(host, pp) + end + + step "verify git checkout is owned by user #{user}" do + on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| + fail_test('checkout not found') unless res.stdout.include? "HEAD" + end + + on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| + fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" + end + end + +end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_file.rb b/spec/acceptance/beaker/group_checkout/group_checkout_file.rb deleted file mode 100644 index 469fb07..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_file.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3487 - checkout as a group (file protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") - end - - step 'checkout as a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_file_path.rb b/spec/acceptance/beaker/group_checkout/group_checkout_file_path.rb deleted file mode 100644 index 07510e1..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_file_path.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3486 - checkout as a group (file path)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") - end - - step 'checkout a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_git.rb b/spec/acceptance/beaker/group_checkout/group_checkout_git.rb deleted file mode 100644 index df7ec09..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_git.rb +++ /dev/null @@ -1,54 +0,0 @@ -test_name 'C3485 - checkout as a group (git protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon') - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") - end - - step 'checkout a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_http.rb b/spec/acceptance/beaker/group_checkout/group_checkout_http.rb deleted file mode 100644 index 96e0205..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_http.rb +++ /dev/null @@ -1,61 +0,0 @@ -test_name 'C3490 - checkout as a group (http protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - 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, }") - end - - step 'checkout a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_https.rb b/spec/acceptance/beaker/group_checkout/group_checkout_https.rb deleted file mode 100644 index 7fe4e96..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_https.rb +++ /dev/null @@ -1,68 +0,0 @@ -test_name 'C3491 - checkout as a group (https protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - 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, }") - end - - step 'checkout as a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/group_checkout_ssh.rb b/spec/acceptance/beaker/group_checkout/group_checkout_ssh.rb deleted file mode 100644 index 2ede1ef..0000000 --- a/spec/acceptance/beaker/group_checkout/group_checkout_ssh.rb +++ /dev/null @@ -1,59 +0,0 @@ -test_name 'C3489 - checkout as a group (ssh protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }") - 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, }") - end - - step 'checkout as a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is own by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/group_checkout/negative/group_checkout_file_non_existent_group.rb b/spec/acceptance/beaker/group_checkout/negative/group_checkout_file_non_existent_group.rb deleted file mode 100644 index 85757aa..0000000 --- a/spec/acceptance/beaker/group_checkout/negative/group_checkout_file_non_existent_group.rb +++ /dev/null @@ -1,48 +0,0 @@ -test_name 'C3484 - checkout as a group that is not on system' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -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 - delete group' do - apply_manifest_on(host, "group { '#{group}': ensure => absent, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout as a group with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is NOT owned by group #{group}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by group') if res.stdout.include? ":#{group}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/negative/revision_checkout_not_exists.rb b/spec/acceptance/beaker/revision_checkout/negative/revision_checkout_not_exists.rb deleted file mode 100644 index e4af1b2..0000000 --- a/spec/acceptance/beaker/revision_checkout/negative/revision_checkout_not_exists.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3614 - checkout a revision that does not exist' - -# Globals -repo_name = 'testrepo_revision_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 revision that does not exist with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '11111111111111111', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify that master revision 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('revision not found') unless res.stdout.include? "ref: refs/heads/master" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_file.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_file.rb deleted file mode 100644 index 70af031..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_file.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3452 - checkout a revision (file protocol)' - -# Globals -repo_name = 'testrepo_revision_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 'get revision sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - stop "verify repo is checked out to revision #{sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_file_path.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_file_path.rb deleted file mode 100644 index b5fd70a..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_file_path.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3451 - checkout a revision (file path)' - -# Globals -repo_name = 'testrepo_revision_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 'get revision sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - stop "verify repo is checked out to revision #{sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_git.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_git.rb deleted file mode 100644 index b34dfdc..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_git.rb +++ /dev/null @@ -1,54 +0,0 @@ -test_name 'C3450 - checkout a revision (git protocol)' - -# Globals -repo_name = 'testrepo_revision_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 - 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 'get revision sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_http.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_http.rb deleted file mode 100644 index debbb01..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_http.rb +++ /dev/null @@ -1,61 +0,0 @@ -test_name 'C3455 - checkout a revision (http protocol)' - -# Globals -repo_name = 'testrepo_revision_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 - - 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 'get revision sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_https.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_https.rb deleted file mode 100644 index c062316..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_https.rb +++ /dev/null @@ -1,69 +0,0 @@ -test_name 'C3456 - checkout a revision (https protocol)' - -# Globals -repo_name = 'testrepo_revision_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 - 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 'get revision sha from repo' do - on(host, "git clone https://github.com/johnduarte/testrepo.git #{tmpdir}/foo") - on(host, "git --git-dir=#{tmpdir}/foo/.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/revision_checkout/revision_checkout_ssh.rb b/spec/acceptance/beaker/revision_checkout/revision_checkout_ssh.rb deleted file mode 100644 index 7a0991c..0000000 --- a/spec/acceptance/beaker/revision_checkout/revision_checkout_ssh.rb +++ /dev/null @@ -1,59 +0,0 @@ -test_name 'C3454 - checkout a revision (ssh protocol)' - -# Globals -repo_name = 'testrepo_revision_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 - 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 'get revision sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a revision with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout is set to revision #{@sha}" 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('revision not found') unless res.stdout.include? "#{@sha}" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_hostile_depth.rb b/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_hostile_depth.rb deleted file mode 100644 index 9c63716..0000000 --- a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_hostile_depth.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3608 - shallow clone repo depth hostile input' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 'rm -rf /tmp', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is NOT shallow' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') if res.stdout.include? "shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_negative_depth.rb b/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_negative_depth.rb deleted file mode 100644 index 10b0559..0000000 --- a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_negative_depth.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3607 - shallow clone repo depth = -1' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => -1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is NOT shallow' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') if res.stdout.include? "shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_overflow_depth.rb b/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_overflow_depth.rb deleted file mode 100644 index 6b34f5d..0000000 --- a/spec/acceptance/beaker/shallow_clone/negative/shallow_clone_overflow_depth.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3606 - shallow clone repo depth overflow 64bit integer' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 18446744073709551616, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is NOT shallow' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') if res.stdout.include? "shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_file.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_file.rb deleted file mode 100644 index 7e6f3a1..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_file.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3476 - shallow clone repo minimal depth = 1 (file protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_file_path.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_file_path.rb deleted file mode 100644 index fa3e278..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_file_path.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3475 - shallow clone repo minimal depth = 1 (file path protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_git.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_git.rb deleted file mode 100644 index a95716f..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_git.rb +++ /dev/null @@ -1,48 +0,0 @@ -test_name 'C3474 - shallow clone repo minimal depth = 1 (git protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_http.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_http.rb deleted file mode 100644 index b43e232..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_http.rb +++ /dev/null @@ -1,55 +0,0 @@ -test_name 'C3479 - shallow clone repo minimal depth = 1 (http protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_https.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_https.rb deleted file mode 100644 index 723c979..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_https.rb +++ /dev/null @@ -1,62 +0,0 @@ -test_name 'C3480 - shallow clone repo minimal depth = 1 (https protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_ssh.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_ssh.rb deleted file mode 100644 index 96f1973..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_ssh.rb +++ /dev/null @@ -1,53 +0,0 @@ -test_name 'C3477 - shallow clone repo minimal depth = 1 (ssh protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is shallow and of the correct depth' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow not found') unless res.stdout.include? "shallow" - end - - on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| - fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow" - end - end - -end diff --git a/spec/acceptance/beaker/shallow_clone/shallow_clone_zero_depth.rb b/spec/acceptance/beaker/shallow_clone/shallow_clone_zero_depth.rb deleted file mode 100644 index 264bcfc..0000000 --- a/spec/acceptance/beaker/shallow_clone/shallow_clone_zero_depth.rb +++ /dev/null @@ -1,39 +0,0 @@ -test_name 'C3404 - shallow clone repo depth = 0 non shallow' - -# Globals -repo_name = 'testrepo_shallow_clone' - -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 'shallow clone repo with puppet (zero depth means not shallow)' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 0, - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify checkout is NOT shallow' do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('shallow found') if res.stdout.include? "shallow" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/negative/tag_checkout_not_exists.rb b/spec/acceptance/beaker/tag_checkout/negative/tag_checkout_not_exists.rb deleted file mode 100644 index 28dd107..0000000 --- a/spec/acceptance/beaker/tag_checkout/negative/tag_checkout_not_exists.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3612 - checkout a tag that does not exist' - -# Globals -repo_name = 'testrepo_tag_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 tag that does not exist with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - tag => '11111111111111111', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step 'verify that master tag 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('tag not found') unless res.stdout.include? "ref: refs/heads/master" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_file.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_file.rb deleted file mode 100644 index 6d39a62..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_file.rb +++ /dev/null @@ -1,44 +0,0 @@ -test_name 'C3445 - checkout a tag (file protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_file_path.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_file_path.rb deleted file mode 100644 index ec0ac9a..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_file_path.rb +++ /dev/null @@ -1,44 +0,0 @@ -test_name 'C3444 - checkout a tag (file path)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_git.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_git.rb deleted file mode 100644 index dc83ad1..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_git.rb +++ /dev/null @@ -1,55 +0,0 @@ -test_name 'C3443 - checkout a tag (git protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 'get tag sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_http.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_http.rb deleted file mode 100644 index 5db0035..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_http.rb +++ /dev/null @@ -1,62 +0,0 @@ -test_name 'C3448 - checkout a tag (http protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 'get tag sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_https.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_https.rb deleted file mode 100644 index b4d1a2f..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_https.rb +++ /dev/null @@ -1,69 +0,0 @@ -test_name 'C3449 - checkout a tag (https protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 'get tag sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/tag_checkout/tag_checkout_ssh.rb b/spec/acceptance/beaker/tag_checkout/tag_checkout_ssh.rb deleted file mode 100644 index a92c7d4..0000000 --- a/spec/acceptance/beaker/tag_checkout/tag_checkout_ssh.rb +++ /dev/null @@ -1,60 +0,0 @@ -test_name 'C3447 - checkout a tag (ssh protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -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 'get tag sha from repo' do - on(host, "git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1") do |res| - @sha = res.stdout.chomp - end - end - - step 'checkout a tag with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify checkout out tag is #{tag}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host,"git --git-dir=#{tmpdir}/#{repo_name}/.git name-rev HEAD") do |res| - fail_test('tag not found') unless res.stdout.include? "#{tag}" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/negative/user_checkout_file_non_existent_user.rb b/spec/acceptance/beaker/user_checkout/negative/user_checkout_file_non_existent_user.rb deleted file mode 100644 index f4c301d..0000000 --- a/spec/acceptance/beaker/user_checkout/negative/user_checkout_file_non_existent_user.rb +++ /dev/null @@ -1,48 +0,0 @@ -test_name 'C3483 - checkout as a user that is not on system' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - delete user' do - apply_manifest_on(host, "user { '#{user}': ensure => absent, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout as a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is NOT owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') if res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_file.rb b/spec/acceptance/beaker/user_checkout/user_checkout_file.rb deleted file mode 100644 index e2b9582..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_file.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3459 - checkout as a user (file protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }") - end - - step 'checkout as a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_file_path.rb b/spec/acceptance/beaker/user_checkout/user_checkout_file_path.rb deleted file mode 100644 index 50592a2..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_file_path.rb +++ /dev/null @@ -1,49 +0,0 @@ -test_name 'C3458 - checkout as a user (file path)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }") - end - - step 'checkout a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_git.rb b/spec/acceptance/beaker/user_checkout/user_checkout_git.rb deleted file mode 100644 index a7ddfd0..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_git.rb +++ /dev/null @@ -1,54 +0,0 @@ -test_name 'C3457 - checkout as a user (git protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon') - apply_manifest_on(host, "user { '#{user}': ensure => absent, }") - end - - step 'checkout a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_http.rb b/spec/acceptance/beaker/user_checkout/user_checkout_http.rb deleted file mode 100644 index 3ffb377..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_http.rb +++ /dev/null @@ -1,61 +0,0 @@ -test_name 'C3462 - checkout as a user (http protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - 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, "user { '#{user}': ensure => absent, }") - end - - step 'checkout a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_https.rb b/spec/acceptance/beaker/user_checkout/user_checkout_https.rb deleted file mode 100644 index e76a93d..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_https.rb +++ /dev/null @@ -1,68 +0,0 @@ -test_name 'C3463 - checkout as a user (https protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - 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, "user { '#{user}': ensure => absent, }") - end - - step 'checkout as a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end diff --git a/spec/acceptance/beaker/user_checkout/user_checkout_ssh.rb b/spec/acceptance/beaker/user_checkout/user_checkout_ssh.rb deleted file mode 100644 index 8de2bc3..0000000 --- a/spec/acceptance/beaker/user_checkout/user_checkout_ssh.rb +++ /dev/null @@ -1,59 +0,0 @@ -test_name 'C3461 - checkout as a user (ssh protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -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 - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }") - 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, "user { '#{user}': ensure => absent, }") - end - - step 'checkout as a user with puppet' do - pp = <<-EOS - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - EOS - - apply_manifest_on(host, pp) - apply_manifest_on(host, pp) - end - - step "verify git checkout is owned by user #{user}" do - on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| - fail_test('checkout not found') unless res.stdout.include? "HEAD" - end - - on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res| - fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:" - end - end - -end -- cgit v1.2.3