diff --git a/spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_http.rb b/spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_http.rb deleted file mode 100644 index be1a95c..0000000 --- a/spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_http.rb +++ /dev/null @@ -1,68 +0,0 @@ -test_name 'C3492 - checkout with basic auth (http protocol)' -skip_test 'HTTP not supported yet for basic auth using git. See FM-1331' - -# Globals -repo_name = 'testrepo_checkout' -user = 'foo' -password = 'bar' -http_server_script = 'basic_auth_http_daemon.rb' - -hosts.each do |host| - ruby = host.is_pe? ? '/opt/puppet/bin/ruby' : 'ruby' - gem = host.is_pe? ? '/opt/puppet/bin/gem' : 'gem' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - script = <<-MANIFEST - require 'sinatra' - - set :bind, '0.0.0.0' - set :static, true - set :public_folder, '#{tmpdir}' - - - use Rack::Auth::Basic do |username, password| - username == '#{user}' && password == '#{password}' - end - MANIFEST - create_remote_file(host, "#{tmpdir}/#{http_server_script}", script) - on(host, "#{gem} install sinatra") - on(host, "#{ruby} #{tmpdir}/#{http_server_script} &") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - end - - step 'checkout with puppet using basic auth' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:4567/testrepo.git", - provider => git, - basic_auth_username => '#{user}', - basic_auth_password => '#{password}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout' 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/basic_auth/basic_auth_checkout_https.rb b/spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_https.rb deleted file mode 100644 index 5b1c0b9..0000000 --- a/spec/acceptance/beaker/git/basic_auth/basic_auth_checkout_https.rb +++ /dev/null @@ -1,76 +0,0 @@ -test_name 'C3493 - checkout with basic auth (https protocol)' -skip_test 'waiting for CA trust solution' - -# Globals -repo_name = 'testrepo_checkout' -user = 'foo' -password = 'bar' -http_server_script = 'basic_auth_https_daemon.rb' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start https server' do - script = <<-MANIFEST - require 'webrick' - require 'webrick/https' - - authenticate = Proc.new do |req, res| - WEBrick::HTTPAuth.basic_auth(req, res, '') do |user, password| - user == '#{user}' && password == '#{password}' - end - end - - server = WEBrick::HTTPServer.new( - :Port => 8443, - :DocumentRoot => "#{tmpdir}", - :DocumentRootOptions=> {:HandlerCallback => authenticate}, - :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 - MANIFEST - create_remote_file(host, "#{tmpdir}/#{http_server_script}", script) - on(host, "#{ruby} #{tmpdir}/#{http_server_script}") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} #{tmpdir}/#{http_server_script}' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - end - - step 'checkout with puppet using basic auth' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8443/testrepo.git", - provider => git, - basic_auth_username => '#{user}', - basic_auth_password => '#{password}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout' 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/basic_auth/negative/basic_auth_checkout_git.rb b/spec/acceptance/beaker/git/basic_auth/negative/basic_auth_checkout_git.rb deleted file mode 100644 index 5ebd738..0000000 --- a/spec/acceptance/beaker/git/basic_auth/negative/basic_auth_checkout_git.rb +++ /dev/null @@ -1,51 +0,0 @@ -test_name 'C3494 - checkout with basic auth (git protocol)' - -# Globals -repo_name = 'testrepo_checkout' -user = 'foo' -password = 'bar' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - end - - step 'checkout with puppet using basic auth' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - basic_auth_username => '#{user}', - basic_auth_password => '#{password}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout (silent error for basic auth using git protocol)' 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/branch_checkout/branch_checkout_file.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb deleted file mode 100644 index 8189f45..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file.rb +++ /dev/null @@ -1,47 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index d968e12..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb +++ /dev/null @@ -1,47 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index e2c8a80..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_git.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index d7950e9..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_http.rb +++ /dev/null @@ -1,60 +0,0 @@ -test_name 'C3441 - checkout a branch (http protocol)' - -# Globals -repo_name = 'testrepo_branch_checkout' -branch = 'a_branch' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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 ; sleep 1") - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index ecaa8ef..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_https.rb +++ /dev/null @@ -1,66 +0,0 @@ -test_name 'C3442 - checkout a branch (https protocol)' - -# Globals -repo_name = 'testrepo_branch_checkout' -branch = 'a_branch' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - create_remote_file(host, '/tmp/https_daemon.rb', https_daemon) - 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 ; sleep 1") - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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_scp.rb b/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb deleted file mode 100644 index 88512e5..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_scp.rb +++ /dev/null @@ -1,58 +0,0 @@ -test_name 'C3439 - checkout a branch (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_branch_checkout' -branch = 'a_branch' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index 238d1ad..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/branch_checkout_ssh.rb +++ /dev/null @@ -1,58 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'checkout a branch with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - revision => '#{branch}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify checkout is on the #{branch} branch" do - 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 deleted file mode 100644 index df84d25..0000000 --- a/spec/acceptance/beaker/git/branch_checkout/negative/branch_checkout_not_exists.rb +++ /dev/null @@ -1,45 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout branch that does not exist with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => 'non_existent_branch', - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - 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_file.rb b/spec/acceptance/beaker/git/clone/clone_file.rb deleted file mode 100644 index f92b74d..0000000 --- a/spec/acceptance/beaker/git/clone/clone_file.rb +++ /dev/null @@ -1,45 +0,0 @@ -test_name 'C3427 - clone (file protocol)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_file_path.rb b/spec/acceptance/beaker/git/clone/clone_file_path.rb deleted file mode 100644 index 3931a5f..0000000 --- a/spec/acceptance/beaker/git/clone/clone_file_path.rb +++ /dev/null @@ -1,45 +0,0 @@ -test_name 'C3426 - clone (file path)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_git.rb b/spec/acceptance/beaker/git/clone/clone_git.rb deleted file mode 100644 index 9241025..0000000 --- a/spec/acceptance/beaker/git/clone/clone_git.rb +++ /dev/null @@ -1,50 +0,0 @@ -test_name 'C3425 - clone (git protocol)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_http.rb b/spec/acceptance/beaker/git/clone/clone_http.rb deleted file mode 100644 index 4255771..0000000 --- a/spec/acceptance/beaker/git/clone/clone_http.rb +++ /dev/null @@ -1,58 +0,0 @@ -test_name 'C3430 - clone (http protocol)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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 ; sleep 1") - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_https.rb b/spec/acceptance/beaker/git/clone/clone_https.rb deleted file mode 100644 index ac69f56..0000000 --- a/spec/acceptance/beaker/git/clone/clone_https.rb +++ /dev/null @@ -1,65 +0,0 @@ -test_name 'C3431 - clone (https protocol)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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 ; sleep 1") - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master 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 deleted file mode 100644 index f25ae8b..0000000 --- a/spec/acceptance/beaker/git/clone/clone_over_different_exiting_repo_with_force.rb +++ /dev/null @@ -1,48 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - force => true, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index ed01b1c..0000000 --- a/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_in_repo.rb +++ /dev/null @@ -1,45 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone repo with excludes in repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}', '#{exclude2}' ], - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - fail_test('exclude not found') unless res.stdout.include? exclude2.to_s - 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 deleted file mode 100644 index 0516641..0000000 --- a/spec/acceptance/beaker/git/clone/clone_repo_with_excludes_not_in_repo.rb +++ /dev/null @@ -1,45 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone repo with excludes not in repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}', '#{exclude2}' ], - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - fail_test('exclude not found') unless res.stdout.include? exclude2.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_scp.rb b/spec/acceptance/beaker/git/clone/clone_scp.rb deleted file mode 100644 index 3199457..0000000 --- a/spec/acceptance/beaker/git/clone/clone_scp.rb +++ /dev/null @@ -1,56 +0,0 @@ -test_name 'C3428 - clone (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - end - end -end diff --git a/spec/acceptance/beaker/git/clone/clone_ssh.rb b/spec/acceptance/beaker/git/clone/clone_ssh.rb deleted file mode 100644 index b8bf9aa..0000000 --- a/spec/acceptance/beaker/git/clone/clone_ssh.rb +++ /dev/null @@ -1,56 +0,0 @@ -test_name 'C3429 - clone (ssh protocol)' - -# Globals -repo_name = 'testrepo_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'clone with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify checkout is on the master 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('master not found') unless res.stdout.include? 'ref: refs/heads/master' - 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 deleted file mode 100644 index 88c46f4..0000000 --- a/spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb +++ /dev/null @@ -1,46 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - 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.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/clone/negative/clone_repo_with_exec_excludes.rb b/spec/acceptance/beaker/git/clone/negative/clone_repo_with_exec_excludes.rb deleted file mode 100644 index 1164db2..0000000 --- a/spec/acceptance/beaker/git/clone/negative/clone_repo_with_exec_excludes.rb +++ /dev/null @@ -1,44 +0,0 @@ -test_name 'C3509 - clone repo with excludes not in repo' -skip_test 'expectations not defined' - -# Globals -repo_name = 'testrepo_with_excludes_not_in_repo' -exclude1 = '`exec "rm -rf /tmp"`' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'clone repo with excludes not in repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - excludes => [ '#{exclude1}' ], - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index f52164e..0000000 --- a/spec/acceptance/beaker/git/compression/compression_0_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 0 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 0, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 91642a2..0000000 --- a/spec/acceptance/beaker/git/compression/compression_1_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 1 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index e6921e0..0000000 --- a/spec/acceptance/beaker/git/compression/compression_2_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 2 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 2, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 10ab099..0000000 --- a/spec/acceptance/beaker/git/compression/compression_3_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 3 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 3, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index bf6c520..0000000 --- a/spec/acceptance/beaker/git/compression/compression_4_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 4 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 4, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index b4943df..0000000 --- a/spec/acceptance/beaker/git/compression/compression_5_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 5 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 5, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 5a4679c..0000000 --- a/spec/acceptance/beaker/git/compression/compression_6_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 6 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 6, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index aa63a47..0000000 --- a/spec/acceptance/beaker/git/compression/negative/compression_7_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 7 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 7, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 2a4ce5b..0000000 --- a/spec/acceptance/beaker/git/compression/negative/compression_alpha_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression alpha with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => abcde, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 307ac15..0000000 --- a/spec/acceptance/beaker/git/compression/negative/compression_eval_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression 10-5 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => 10-5, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 26899cd..0000000 --- a/spec/acceptance/beaker/git/compression/negative/compression_exec_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression exec with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => "exec 'rm -rf /tmp'", - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 20d352f..0000000 --- a/spec/acceptance/beaker/git/compression/negative/compression_negative_checkout.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout with compression -1 with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - compression => -1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 72682b6..0000000 --- a/spec/acceptance/beaker/git/create/create_bare_repo_that_already_exists.rb +++ /dev/null @@ -1,39 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => bare, - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 87ee685..0000000 --- a/spec/acceptance/beaker/git/create/create_repo_that_already_exists.rb +++ /dev/null @@ -1,41 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'verify repo is on master branch' do - on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |_res| - assert_match(%r{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 deleted file mode 100644 index 3574f45..0000000 --- a/spec/acceptance/beaker/git/create/negative/create_bare_repo_specifying_revision.rb +++ /dev/null @@ -1,37 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'create bare repo specifying revision using puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => bare, - revision => master, - provider => git, - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - end - - step 'verify repo does not contain .git directory' do - on(host, "ls -al #{tmpdir}") do |res| - fail_test "found repo for #{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 deleted file mode 100644 index 0f9183c..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_file.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index 47e53af..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_file_path.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index 90a8a2b..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb +++ /dev/null @@ -1,57 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index d0b03f5..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_http.rb +++ /dev/null @@ -1,65 +0,0 @@ -test_name 'C3490 - checkout as a group (http protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index 115ea4b..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_https.rb +++ /dev/null @@ -1,72 +0,0 @@ -test_name 'C3491 - checkout as a group (https protocol)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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_scp.rb b/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb deleted file mode 100644 index d355d64..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_scp.rb +++ /dev/null @@ -1,63 +0,0 @@ -test_name 'C3488 - checkout as a group (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_group_checkout' -group = 'mygroup' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a group with puppet (scp syntax)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index d42e040..0000000 --- a/spec/acceptance/beaker/git/group_checkout/group_checkout_ssh.rb +++ /dev/null @@ -1,63 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - step 'setup - create group' do - apply_manifest_on(host, "group { '#{group}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "verify git checkout is own by group #{group}" do - 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 deleted file mode 100644 index f4962fa..0000000 --- a/spec/acceptance/beaker/git/group_checkout/negative/group_checkout_file_non_existent_group.rb +++ /dev/null @@ -1,50 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - delete group' do - apply_manifest_on(host, "group { '#{group}': ensure => absent, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout as a group with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - group => '#{group}', - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - 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 deleted file mode 100644 index 78b414d..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/negative/revision_checkout_not_exists.rb +++ /dev/null @@ -1,45 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout revision that does not exist with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '11111111111111111', - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - 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 deleted file mode 100644 index bcdfe27..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "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.to_s - 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 deleted file mode 100644 index 25c8fec..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_file_path.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step "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.to_s - 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 deleted file mode 100644 index 0a443ea..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_git.rb +++ /dev/null @@ -1,57 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 3b6fd68..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_http.rb +++ /dev/null @@ -1,65 +0,0 @@ -test_name 'C3455 - checkout a revision (http protocol)' - -# Globals -repo_name = 'testrepo_revision_checkout' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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 ; sleep 1") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 391a74f..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_https.rb +++ /dev/null @@ -1,73 +0,0 @@ -test_name 'C3456 - checkout a revision (https protocol)' - -# Globals -repo_name = 'testrepo_revision_checkout' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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 ; sleep 1") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_scp.rb b/spec/acceptance/beaker/git/revision_checkout/revision_checkout_scp.rb deleted file mode 100644 index e89a178..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_scp.rb +++ /dev/null @@ -1,63 +0,0 @@ -test_name 'C3453 - checkout a revision (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_revision_checkout' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: 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 (scp syntax)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index df6ba96..0000000 --- a/spec/acceptance/beaker/git/revision_checkout/revision_checkout_ssh.rb +++ /dev/null @@ -1,63 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - revision => '#{@sha}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_exec_depth.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_exec_depth.rb deleted file mode 100644 index 2dda492..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_exec_depth.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => "exec 'rm -rf /tmp'", - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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_file_path.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_file_path.rb deleted file mode 100644 index 45722b2..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_file_path.rb +++ /dev/null @@ -1,43 +0,0 @@ -test_name 'C3475 - shallow clone repo minimal depth = 1 (file path protocol)' -skip_test 'Not currently supported. See FM-1285' - -# Globals -repo_name = 'testrepo_shallow_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - end - - step 'git does not support shallow clone via file path: verify checkout is NOT created' do - on(host, "ls #{tmpdir}") do |res| - fail_test('checkout found') if res.stdout.include? repo_name.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_http.rb b/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_http.rb deleted file mode 100644 index b0767cc..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_http.rb +++ /dev/null @@ -1,54 +0,0 @@ -test_name 'C3479 - shallow clone repo minimal depth = 1 (http protocol)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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 ; sleep 1'") - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - end - - step 'git does not support shallow clone via HTTP: verify checkout is NOT created' do - on(host, "ls #{tmpdir}") do |res| - fail_test('checkout found') if res.stdout.include? repo_name.to_s - 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 deleted file mode 100644 index ffaa999..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_negative_depth.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => -1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index fdd957c..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/negative/shallow_clone_overflow_depth.rb +++ /dev/null @@ -1,44 +0,0 @@ -test_name 'C3606 - shallow clone repo depth overflow 64bit integer' - -# Globals -repo_name = 'testrepo_shallow_clone' - -pending_test("The overflow can't be handled on some git versions") - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet (bad input ignored, full clone checkedout)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 18446744073709551616, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index f9f286a..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_file.rb +++ /dev/null @@ -1,46 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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? "1 #{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 deleted file mode 100644 index 208561c..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb +++ /dev/null @@ -1,51 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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? "1 #{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 deleted file mode 100644 index 6c60ea3..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_https.rb +++ /dev/null @@ -1,68 +0,0 @@ -test_name 'C3480 - shallow clone repo minimal depth = 1 (https protocol)' -skip_test 'Not currently supported. See FM-1286' - -# Globals -repo_name = 'testrepo_shallow_clone' - -hosts.each do |host| - # ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - ruby = host.is_pe? ? '/opt/puppet/bin/ruby' : 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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 ; sleep 1") - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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? "1 #{tmpdir}/#{repo_name}/.git/shallow" - end - end -end diff --git a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_scp.rb b/spec/acceptance/beaker/git/shallow_clone/shallow_clone_scp.rb deleted file mode 100644 index 480b159..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_scp.rb +++ /dev/null @@ -1,57 +0,0 @@ -test_name 'C3478 - shallow clone repo minimal depth = 1 (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_shallow_clone' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'shallow clone repo with puppet (scp syntax)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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? "1 #{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 deleted file mode 100644 index bcf5d2f..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_ssh.rb +++ /dev/null @@ -1,57 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - end - - step 'shallow clone repo with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - depth => 1, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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? "1 #{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 deleted file mode 100644 index 1db7aa8..0000000 --- a/spec/acceptance/beaker/git/shallow_clone/shallow_clone_zero_depth.rb +++ /dev/null @@ -1,42 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'shallow clone repo with puppet (zero depth means not shallow)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - depth => 0, - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 0f77d0d..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/negative/tag_checkout_not_exists.rb +++ /dev/null @@ -1,46 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout tag that does not exist with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - tag => '11111111111111111', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 00b84e5..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file.rb +++ /dev/null @@ -1,47 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout a tag with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 5d32733..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_file_path.rb +++ /dev/null @@ -1,47 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout a tag with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index deef3ec..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_git.rb +++ /dev/null @@ -1,58 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 2b9ac7c..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_http.rb +++ /dev/null @@ -1,66 +0,0 @@ -test_name 'C3448 - checkout a tag (http protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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 ; sleep 1") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 968b6b3..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_https.rb +++ /dev/null @@ -1,73 +0,0 @@ -test_name 'C3449 - checkout a tag (https protocol)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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 ; sleep 1") - 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - end - end -end diff --git a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_scp.rb b/spec/acceptance/beaker/git/tag_checkout/tag_checkout_scp.rb deleted file mode 100644 index 1820b45..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_scp.rb +++ /dev/null @@ -1,64 +0,0 @@ -test_name 'C3446 - checkout a tag (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_tag_checkout' -tag = '0.0.2' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: 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 (scp syntax)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 9d68520..0000000 --- a/spec/acceptance/beaker/git/tag_checkout/tag_checkout_ssh.rb +++ /dev/null @@ -1,64 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: 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 = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - revision => '#{tag}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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.to_s - 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 deleted file mode 100644 index 459018a..0000000 --- a/spec/acceptance/beaker/git/user_checkout/negative/user_checkout_file_non_existent_user.rb +++ /dev/null @@ -1,50 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - delete user' do - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - end - - step 'checkout as a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, expect_failures: true) - 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 deleted file mode 100644 index c44697c..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_file.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "file://#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index c650d39..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_file_path.rb +++ /dev/null @@ -1,52 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index de35de7..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_git.rb +++ /dev/null @@ -1,57 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start git daemon' do - install_package(host, 'git-daemon') unless host['platform'] =~ %r{debian|ubuntu} - on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach") - end - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, 'pkill -9 git-daemon ; sleep 1') - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "git://#{host}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 1e30845..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_http.rb +++ /dev/null @@ -1,65 +0,0 @@ -test_name 'C3462 - checkout as a user (http protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - - step 'setup - start http server' do - http_daemon = <<-MANIFEST - require 'webrick' - server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") - WEBrick::Daemon.start - server.start - MANIFEST - 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, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/http_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "http://#{host}:8000/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 66c12c5..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_https.rb +++ /dev/null @@ -1,72 +0,0 @@ -test_name 'C3463 - checkout as a user (https protocol)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -hosts.each do |host| - ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - start https server' do - https_daemon = <<-MANIFEST - 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 - MANIFEST - 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, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - on(host, "ps ax | grep '#{ruby} /tmp/https_daemon.rb' | grep -v grep | awk '{print \"kill -9 \" $1}' | sh ; sleep 1") - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "https://github.com/johnduarte/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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_scp.rb b/spec/acceptance/beaker/git/user_checkout/user_checkout_scp.rb deleted file mode 100644 index 5720fd0..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_scp.rb +++ /dev/null @@ -1,63 +0,0 @@ -test_name 'C3460 - checkout as a user (ssh protocol, scp syntax)' - -# Globals -repo_name = 'testrepo_user_checkout' -user = 'myuser' - -hosts.each do |host| - tmpdir = host.tmpdir('vcsrepo') - step 'setup - create repo' do - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a user with puppet (scp syntax)' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "root@#{host}:#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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 deleted file mode 100644 index 2e9b072..0000000 --- a/spec/acceptance/beaker/git/user_checkout/user_checkout_ssh.rb +++ /dev/null @@ -1,63 +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 - git_pkg = 'git' - if host['platform'] =~ %r{ubuntu-10} - git_pkg = 'git-core' - end - install_package(host, git_pkg) - my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - on(host, "cd #{tmpdir} && ./create_git_repo.sh") - end - step 'setup - establish ssh keys' do - # create ssh keys - on(host, 'yes | ssh-keygen -q -t rsa -f /root/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - on(host, 'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys') - on(host, 'echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config') - on(host, 'chown -R root:root /root/.ssh') - end - - step 'setup - create user' do - apply_manifest_on(host, "user { '#{user}': ensure => present, }", catch_failures: true) - end - - teardown do - on(host, "rm -fr #{tmpdir}") - apply_manifest_on(host, "file{'/root/.ssh/id_rsa': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "file{'/root/.ssh/id_rsa.pub': ensure => absent, force => true }", catch_failures: true) - apply_manifest_on(host, "user { '#{user}': ensure => absent, }", catch_failures: true) - end - - step 'checkout as a user with puppet' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/#{repo_name}": - ensure => present, - source => "ssh://root@#{host}#{tmpdir}/testrepo.git", - provider => git, - owner => '#{user}', - } - MANIFEST - - apply_manifest_on(host, pp, catch_failures: true) - apply_manifest_on(host, pp, catch_changes: true) - 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_helper.rb b/spec/acceptance/beaker_helper.rb deleted file mode 100644 index 80f4699..0000000 --- a/spec/acceptance/beaker_helper.rb +++ /dev/null @@ -1,51 +0,0 @@ -test_name 'Installing Puppet and vcsrepo module' do - step 'install puppet' do - if @options[:provision] - # This will fail if puppet is already installed, ie --no-provision - if hosts.first.is_pe? - install_pe - else - install_puppet - on hosts, "mkdir -p #{hosts.first['distmoduledir']}" - end - end - end - - step 'Ensure we can install our module' do - hosts.each do |host| - # We ask the host to interpolate it's distmoduledir because we don't - # actually know it on Windows until we've let it redirect us (depending - # on whether we're running as a 32/64 bit process on 32/64 bit Windows - moduledir = on(host, "echo #{host['distmoduledir']}").stdout.chomp - on host, "mkdir -p #{moduledir}" - end - end - - step 'install module' do - hosts.each do |host| - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) - - # This require beaker 1.15 - copy_module_to(host, source: proj_root, module_name: 'vcsrepo') - - case fact_on(host, 'osfamily') - when 'RedHat' - install_package(host, 'git') - when 'Debian' - install_package(host, 'git-core') - else - unless check_for_package(host, 'git') - puts 'Git package is required for this module' - exit - end - end - - gitconfig = <<-MANIFEST - [user] - email = root@localhost - name = root - MANIFEST - create_remote_file(host, '/root/.gitconfig', gitconfig) - end - end -end diff --git a/spec/acceptance/clone_repo_spec.rb b/spec/acceptance/clone_repo_spec.rb index 11a84d3..573c3f4 100644 --- a/spec/acceptance/clone_repo_spec.rb +++ b/spec/acceptance/clone_repo_spec.rb @@ -1,568 +1,550 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'clones a remote repo' do before(:all) do my_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) shell("mkdir -p #{tmpdir}") # win test scp_to(default, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) shell("cd #{tmpdir} && ./create_git_repo.sh") end after(:all) do shell("rm -rf #{tmpdir}/testrepo.git") end context 'with get the current master HEAD' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo/.git") do it { is_expected.to be_directory } end describe file("#{tmpdir}/testrepo/.git/HEAD") do it { is_expected.to contain 'ref: refs/heads/master' } end end context 'with using a https source on github', unless: only_supports_weak_encryption do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/httpstestrepo": ensure => present, provider => git, source => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/httpstestrepo/.git") do it { is_expected.to be_directory } end describe file("#{tmpdir}/httpstestrepo/.git/HEAD") do it { is_expected.to contain 'ref: refs/heads/master' } end end context 'with using a commit SHA' do let(:sha) do shell("git --git-dir=#{tmpdir}/testrepo.git rev-list HEAD | tail -1").stdout.chomp end after(:all) do shell("rm -rf #{tmpdir}/testrepo_sha") end it 'clones a repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_sha": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", revision => "#{sha}", } MANIFEST # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_sha/.git") do it { is_expected.to be_directory } end describe file("#{tmpdir}/testrepo_sha/.git/HEAD") do it { is_expected.to contain sha } end end context 'with using a tag' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_tag": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", revision => '0.0.2', } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_tag/.git") do it { is_expected.to be_directory } end it 'has the tag as the HEAD' do shell("git --git-dir=#{tmpdir}/testrepo_tag/.git name-rev HEAD | grep '0.0.2'") end end context 'with using a branch name' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_branch": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", revision => 'a_branch', } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_branch/.git") do it { is_expected.to be_directory } end describe file("#{tmpdir}/testrepo_branch/.git/HEAD") do it { is_expected.to contain 'ref: refs/heads/a_branch' } end end context 'with ensure latest with branch specified' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_latest": ensure => latest, provider => git, source => "file://#{tmpdir}/testrepo.git", revision => 'a_branch', } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end it 'verifies the HEAD commit SHA on remote and local match' do remote_commit = shell("git ls-remote file://#{tmpdir}/testrepo_latest HEAD | head -1").stdout local_commit = shell("git --git-dir=#{tmpdir}/testrepo_latest/.git rev-parse HEAD").stdout.chomp expect(remote_commit).to include(local_commit) end end context 'with ensure latest with branch unspecified' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_latest": ensure => latest, provider => git, source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end it 'verifies the HEAD commit SHA on remote and local match' do remote_commit = shell("git ls-remote file://#{tmpdir}/testrepo_latest HEAD | head -1").stdout local_commit = shell("git --git-dir=#{tmpdir}/testrepo_latest/.git rev-parse HEAD").stdout.chomp expect(remote_commit).to include(local_commit) end end context 'with with shallow clone' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_shallow": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", depth => '1', } MANIFEST it 'does a shallow clone' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_shallow/.git/shallow") do it { is_expected.to be_file } end end context 'with path is not empty and not a repository' do before(:all) do shell("mkdir #{tmpdir}/not_a_repo", acceptable_exit_codes: [0, 1]) shell("touch #{tmpdir}/not_a_repo/file1.txt", acceptable_exit_codes: [0, 1]) end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/not_a_repo": ensure => present, provider => git source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'raises an exception' do apply_manifest(pp, expect_failures: true) end end context 'with with an owner' do pp = <<-MANIFEST user { 'vagrant': ensure => present, } MANIFEST apply_manifest(pp, catch_failures: true) pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_owner": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", owner => 'vagrant', } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_owner") do it { is_expected.to be_directory } it { is_expected.to be_owned_by 'vagrant' } end end context 'with with a group' do pp = <<-MANIFEST group { 'vagrant': ensure => present, } MANIFEST apply_manifest(pp, catch_failures: true) pp = <<-MANIFEST vcsrepo { "/#{tmpdir}/testrepo_group": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", group => 'vagrant', } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_group") do it { is_expected.to be_directory } it { is_expected.to be_grouped_into 'vagrant' } end end context 'with with excludes' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_excludes": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", excludes => ['exclude1.txt', 'exclude2.txt'], } MANIFEST it 'clones a repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_excludes/.git/info/exclude") do subject { super().content } it { is_expected.to match %r{exclude1.txt} } end describe file("#{tmpdir}/testrepo_excludes/.git/info/exclude") do subject { super().content } it { is_expected.to match %r{exclude2.txt} } end end context 'with with force' do before(:all) do shell("mkdir -p #{tmpdir}/testrepo_force/folder") shell("touch #{tmpdir}/testrepo_force/temp.txt") end it 'applies the manifest' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_force": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", force => true, } MANIFEST # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_force/folder") do it { is_expected.not_to be_directory } end describe file("#{tmpdir}/testrepo_force/temp.txt") do it { is_expected.not_to be_file } end describe file("#{tmpdir}/testrepo_force/.git") do it { is_expected.to be_directory } end context 'with and noop' do before(:all) do shell("mkdir #{tmpdir}/testrepo_already_exists") shell("cd #{tmpdir}/testrepo_already_exists && git init") shell("cd #{tmpdir}/testrepo_already_exists && touch a && git add a && git commit -m 'a'") end after(:all) do shell("rm -rf #{tmpdir}/testrepo_already_exists") end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_already_exists": ensure => present, source => "file://#{tmpdir}/testrepo.git", provider => git, force => true, noop => true, } MANIFEST it 'applies the manifest' do apply_manifest(pp, catch_changes: true) end end end context 'with as a user' do before(:all) do shell("chmod 707 #{tmpdir}") pp = <<-MANIFEST group { 'testuser': ensure => present, } user { 'testuser': ensure => present, groups => 'testuser', } MANIFEST apply_manifest(pp, catch_failures: true) end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_user": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", user => 'testuser', } MANIFEST it 'applies the manifest' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_user") do it { is_expected.to be_directory } it { is_expected.to be_owned_by 'testuser' } end describe file("#{tmpdir}/testrepo_user") do it { is_expected.to be_directory } it { is_expected.to be_grouped_into 'testuser' } end after(:all) do pp = 'user { "testuser": ensure => absent }' apply_manifest(pp, catch_failures: true) end end context 'with non-origin remote name' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_remote": ensure => present, provider => git, source => "file://#{tmpdir}/testrepo.git", remote => 'testorigin', } MANIFEST it 'applies the manifest' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end it 'remote name is "testorigin"' do shell("git --git-dir=#{tmpdir}/testrepo_remote/.git remote | grep 'testorigin'") end end - context 'with as a user with ssh' do + context 'with as a user with ssh - includes special characters' do before(:all) do # create user pp = <<-MANIFEST group { 'testuser-ssh': ensure => present, } user { 'testuser-ssh': ensure => present, groups => 'testuser-ssh', managehome => true, } MANIFEST apply_manifest(pp, catch_failures: true) # create ssh keys shell('mkdir -p /home/testuser-ssh/.ssh') shell('ssh-keygen -q -t rsa -f /home/testuser-ssh/.ssh/id_rsa -N ""') # copy public key to authorized_keys shell('cat /home/testuser-ssh/.ssh/id_rsa.pub > /home/testuser-ssh/.ssh/authorized_keys') shell('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser-ssh/.ssh/config') shell('chown -R testuser-ssh:testuser-ssh /home/testuser-ssh/.ssh') end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_user_ssh": ensure => present, provider => git, - source => "testuser-ssh@localhost:#{tmpdir}/testrepo.git", + source => "git+ssh://testuser-ssh@localhost#{tmpdir}/testrepo.git", user => 'testuser-ssh', } MANIFEST it 'applies the manifest' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end after(:all) do pp = <<-MANIFEST user { 'testuser-ssh': ensure => absent, managehome => true, } MANIFEST apply_manifest(pp, catch_failures: true) end end context 'with using an identity file' do before(:all) do # create user pp = <<-MANIFEST user { 'testuser-ssh': ensure => present, managehome => true, } MANIFEST apply_manifest(pp, catch_failures: true) # create ssh keys shell('mkdir -p /home/testuser-ssh/.ssh') shell('ssh-keygen -q -t rsa -f /home/testuser-ssh/.ssh/id_rsa -N ""') # copy public key to authorized_keys shell('cat /home/testuser-ssh/.ssh/id_rsa.pub > /home/testuser-ssh/.ssh/authorized_keys') shell('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser-ssh/.ssh/config') shell('chown -R testuser-ssh:testuser-ssh /home/testuser-ssh/.ssh') end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_user_ssh_id": ensure => present, provider => git, source => "testuser-ssh@localhost:#{tmpdir}/testrepo.git", identity => '/home/testuser-ssh/.ssh/id_rsa', } MANIFEST it 'applies the manifest' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end end context 'with bare repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_bare_repo": ensure => bare, provider => git, source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'creates a bare repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_bare_repo/config") do it { is_expected.to contain 'bare = true' } end describe file("#{tmpdir}/testrepo_bare_repo/.git") do it { is_expected.not_to be_directory } end describe file("#{tmpdir}/testrepo_bare_repo/HEAD") do it { is_expected.to contain 'ref: refs/heads/master' } end end context 'with mirror repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_mirror_repo": ensure => mirror, provider => git, source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'creates a mirror repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_mirror_repo/config") do it { is_expected.to contain 'bare = true' } it { is_expected.to contain 'mirror = true' } end describe file("#{tmpdir}/testrepo_mirror_repo/.git") do it { is_expected.not_to be_directory } end describe file("#{tmpdir}/testrepo_mirror_repo/HEAD") do it { is_expected.to contain 'ref: refs/heads/master' } end end end diff --git a/spec/acceptance/create_repo_spec.rb b/spec/acceptance/create_repo_spec.rb index 29f19fa..3f5f17b 100644 --- a/spec/acceptance/create_repo_spec.rb +++ b/spec/acceptance/create_repo_spec.rb @@ -1,101 +1,98 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'create a repo' do context 'with without a source' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_blank_repo": ensure => present, provider => git, } MANIFEST it 'creates a blank repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_blank_repo/") do it 'has zero files' do shell("ls -1 #{tmpdir}/testrepo_blank_repo | wc -l") do |r| expect(r.stdout).to match(%r{^0\n$}) end end end describe file("#{tmpdir}/testrepo_blank_repo/.git") do it { is_expected.to be_directory } end end context 'with no source but revision provided' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_blank_with_revision_repo": ensure => present, provider => git, revision => 'master' } MANIFEST it 'does not fail (MODULES-2125)' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end end context 'with bare repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_bare_repo": ensure => bare, provider => git, } MANIFEST it 'creates a bare repo' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/testrepo_bare_repo/config") do it { is_expected.to contain 'bare = true' } end describe file("#{tmpdir}/testrepo_bare_repo/.git") do it { is_expected.not_to be_directory } end end context 'with bare repo with a revision' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_bare_repo_rev": ensure => bare, provider => git, revision => 'master', } MANIFEST it 'does not create a bare repo when a revision is defined' do apply_manifest(pp, expect_failures: true) end describe file("#{tmpdir}/testrepo_bare_repo_rev") do it { is_expected.not_to be_directory } end end context 'with mirror repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_mirror_repo": ensure => mirror, provider => git, } MANIFEST it 'does not create a mirror repo' do apply_manifest(pp, expect_failures: true) end describe file("#{tmpdir}/testrepo_mirror_repo") do it { is_expected.not_to be_directory } end end end diff --git a/spec/acceptance/modules_1596_spec.rb b/spec/acceptance/modules_1596_spec.rb deleted file mode 100644 index 2b6f459..0000000 --- a/spec/acceptance/modules_1596_spec.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'spec_helper_acceptance' - -tmpdir = default.tmpdir('vcsrepo') - -describe 'clones a remote repo', unless: only_supports_weak_encryption do - before(:all) do - File.expand_path(File.join(File.dirname(__FILE__), '..')) - shell("mkdir -p #{tmpdir}") # win test - end - - after(:all) do - shell("rm -rf #{tmpdir}/vcsrepo") - end - - context 'with force with a remote' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/vcsrepo": - ensure => present, - provider => git, - source => 'https://github.com/puppetlabs/puppetlabs-vcsrepo', - force => true, - } - MANIFEST - it 'clones from remote' do - # Run it twice to test for idempotency - apply_manifest(pp, catch_failures: true) - # need to create a file to make sure we aren't destroying the repo - # because fun fact, if you call destroy/create in 'retrieve' puppet won't - # register that any changes happen, because that method isn't supposed to - # be making any changes. - shell("touch #{tmpdir}/vcsrepo/foo") - apply_manifest(pp, catch_changes: true) - end - - describe file("#{tmpdir}/vcsrepo/foo") do - it { is_expected.to be_file } - end - end - - context 'with force over an existing repo' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/vcsrepo": - ensure => present, - provider => git, - source => 'https://github.com/puppetlabs/puppetlabs-vcsrepo', - force => true, - } - MANIFEST - - pp2 = <<-MANIFEST - vcsrepo { "#{tmpdir}/vcsrepo": - ensure => present, - provider => git, - source => 'https://github.com/puppetlabs/puppetlabs-stdlib', - force => true, - } - MANIFEST - it 'clones from remote' do - apply_manifest(pp, catch_failures: true) - # create a file to make sure we're destroying the repo - shell("touch #{tmpdir}/vcsrepo/foo") - apply_manifest(pp2, catch_failures: true) - end - - describe file("#{tmpdir}/vcsrepo/foo") do - it { is_expected.not_to be_file } - end - end -end diff --git a/spec/acceptance/modules_1800_spec.rb b/spec/acceptance/modules_1800_spec.rb deleted file mode 100644 index b269cf2..0000000 --- a/spec/acceptance/modules_1800_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require 'spec_helper_acceptance' - -tmpdir = default.tmpdir('vcsrepo') - -describe 'clones a remote repo', unless: only_supports_weak_encryption do - before(:all) do - File.expand_path(File.join(File.dirname(__FILE__), '..')) - shell("mkdir -p #{tmpdir}") # win test - end - - after(:all) do - shell("rm -rf #{tmpdir}/vcsrepo") - end - - context 'with ensure latest with no revision' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/vcsrepo": - ensure => present, - provider => git, - source => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", - } - MANIFEST - it 'clones from default remote' do - apply_manifest(pp, catch_failures: true) - shell("cd #{tmpdir}/vcsrepo; /usr/bin/git reset --hard HEAD~2") - end - - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/vcsrepo": - ensure => latest, - provider => git, - source => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", - } - MANIFEST - it 'updates' do - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - end -end diff --git a/spec/acceptance/modules_2326_spec.rb b/spec/acceptance/modules_2326_spec.rb deleted file mode 100644 index 5e06ee8..0000000 --- a/spec/acceptance/modules_2326_spec.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'spec_helper_acceptance' - -tmpdir = default.tmpdir('vcsrepo') - -describe 'clones with special characters' do - before(:all) do - my_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - shell("mkdir -p #{tmpdir}") # win test - scp_to(default, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) - shell("cd #{tmpdir} && ./create_git_repo.sh") - end - - after(:all) do - shell("rm -rf #{tmpdir}/testrepo.git") - end - - context 'when as a user with ssh' do - before(:all) do - # create user - pp = <<-MANIFEST - group { 'testuser-ssh': - ensure => present, - } - user { 'testuser-ssh': - ensure => present, - groups => 'testuser-ssh', - managehome => true, - } - MANIFEST - apply_manifest(pp, catch_failures: true) - - # create ssh keys - shell('mkdir -p /home/testuser-ssh/.ssh') - shell('echo -e \'y\n\'|ssh-keygen -q -t rsa -f /home/testuser-ssh/.ssh/id_rsa -N ""') - - # copy public key to authorized_keys - shell('cat /home/testuser-ssh/.ssh/id_rsa.pub > /home/testuser-ssh/.ssh/authorized_keys') - shell('echo -e "Host localhost\n\tStrictHostKeyChecking no\n" > /home/testuser-ssh/.ssh/config') - shell('chown -R testuser-ssh:testuser-ssh /home/testuser-ssh/.ssh') - shell("chown testuser-ssh:testuser-ssh #{tmpdir}") - end - - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/testrepo_user_ssh": - ensure => present, - provider => git, - source => "git+ssh://testuser-ssh@localhost#{tmpdir}/testrepo.git", - user => 'testuser-ssh', - } - MANIFEST - it 'applies the manifest' do - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - after(:all) do - pp = <<-MANIFEST - user { 'testuser-ssh': - ensure => absent, - managehome => true, - } - MANIFEST - apply_manifest(pp, catch_failures: true) - end - end -end diff --git a/spec/acceptance/modules_753_spec.rb b/spec/acceptance/multiple_remotes_spec.rb similarity index 97% rename from spec/acceptance/modules_753_spec.rb rename to spec/acceptance/multiple_remotes_spec.rb index 4db969c..9388b1e 100644 --- a/spec/acceptance/modules_753_spec.rb +++ b/spec/acceptance/multiple_remotes_spec.rb @@ -1,65 +1,65 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'clones a remote repo', unless: only_supports_weak_encryption do before(:all) do File.expand_path(File.join(File.dirname(__FILE__), '..')) shell("mkdir -p #{tmpdir}") # win test end after(:all) do shell("rm -rf #{tmpdir}/vcsrepo") end context 'with clone with single remote' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/vcsrepo": ensure => present, provider => git, source => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", } MANIFEST it 'clones from default remote' do apply_manifest(pp, catch_failures: true) end it 'git config output should contain the remote' do shell("/usr/bin/git config -l -f #{tmpdir}/vcsrepo/.git/config") do |r| expect(r.stdout).to match(%r{remote.origin.url=https://github.com/puppetlabs/puppetlabs-vcsrepo.git}) end end after(:all) do shell("rm -rf #{tmpdir}/vcsrepo") end end context 'with clone with multiple remotes' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/vcsrepo": ensure => present, provider => git, source => {"origin" => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git", "test1" => "https://github.com/puppetlabs/puppetlabs-vcsrepo.git"}, } MANIFEST it 'clones from default remote and adds 2 remotes to config file' do - apply_manifest(pp, catch_failures: true) + idempotent_apply(default, pp) end it 'git config output should contain the remotes - origin' do shell("/usr/bin/git config -l -f #{tmpdir}/vcsrepo/.git/config") do |r| expect(r.stdout).to match(%r{remote.origin.url=https://github.com/puppetlabs/puppetlabs-vcsrepo.git}) end end it 'git config output should contain the remotes - test1' do shell("/usr/bin/git config -l -f #{tmpdir}/vcsrepo/.git/config") do |r| expect(r.stdout).to match(%r{remote.test1.url=https://github.com/puppetlabs/puppetlabs-vcsrepo.git}) end end after(:all) do shell("rm -rf #{tmpdir}/vcsrepo") end end end diff --git a/spec/acceptance/remove_repo_spec.rb b/spec/acceptance/remove_repo_spec.rb index 66b8e65..7c3ec4c 100644 --- a/spec/acceptance/remove_repo_spec.rb +++ b/spec/acceptance/remove_repo_spec.rb @@ -1,29 +1,48 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'remove a repo' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_deleted": ensure => present, provider => git, } MANIFEST - it 'creates a blank repo' do # rubocop:disable RSpec/RepeatedExample : Examples are not the same, difference comes from the pp variable + it 'creates a blank repo' do apply_manifest(pp, catch_failures: true) end - pp = <<-MANIFEST + pp_noop_remove = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo_deleted": - ensure => absent, + ensure => absent, provider => git, + force => true, } MANIFEST - it 'removes a repo' do # rubocop:disable RSpec/RepeatedExample : Examples are not the same, difference comes from the pp variable - apply_manifest(pp, catch_failures: true) + context 'when ran with noop' do + it 'does not remove a repo' do + apply_manifest(pp_noop_remove, catch_failures: true, noop: true, verbose: false) + end + + describe file("#{tmpdir}/testrepo_deleted") do + it { is_expected.to be_directory } + end end - describe file("#{tmpdir}/testrepo_deleted") do - it { is_expected.not_to be_directory } + pp_remove = <<-MANIFEST + vcsrepo { "#{tmpdir}/testrepo_deleted": + ensure => absent, + provider => git, + } + MANIFEST + context 'when ran without noop' do + it 'removes a repo' do + apply_manifest(pp_remove, catch_failures: true) + end + + describe file("#{tmpdir}/testrepo_deleted") do + it { is_expected.not_to be_directory } + end end end diff --git a/spec/acceptance/remove_repo_spec_noop.rb b/spec/acceptance/remove_repo_spec_noop.rb deleted file mode 100644 index 83249e9..0000000 --- a/spec/acceptance/remove_repo_spec_noop.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper_acceptance' - -tmpdir = default.tmpdir('vcsrepo') - -describe 'does not remove a repo if noop' do - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/testrepo_noop_deleted": - ensure => present, - provider => git, - } - MANIFEST - it 'creates a blank repo' do - apply_manifest(pp, catch_failures: true) - end - - pp = <<-MANIFEST - vcsrepo { "#{tmpdir}/testrepo_noop_deleted": - ensure => absent, - provider => git, - force => true, - } - MANIFEST - it 'does not remove a repo if noop' do - apply_manifest(pp, catch_failures: true, noop: true, verbose: false) - end - - describe file("#{tmpdir}/testrepo_noop_deleted") do - it { is_expected.to be_directory } - end -end diff --git a/spec/acceptance/modules_660_spec.rb b/spec/acceptance/revision_spec.rb similarity index 88% rename from spec/acceptance/modules_660_spec.rb rename to spec/acceptance/revision_spec.rb index a0df796..9bbb748 100644 --- a/spec/acceptance/modules_660_spec.rb +++ b/spec/acceptance/revision_spec.rb @@ -1,91 +1,88 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') -describe 'MODULES-660' do +describe 'changing revision' do before(:all) do # Create testrepo.git my_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) shell("mkdir -p #{tmpdir}") # win test scp_to(default, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) shell("cd #{tmpdir} && ./create_git_repo.sh") # Configure testrepo.git as upstream of testrepo pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo": ensure => present, provider => git, revision => 'a_branch', source => "file://#{tmpdir}/testrepo.git", } MANIFEST apply_manifest(pp, catch_failures: true) end after(:all) do shell("rm -rf #{tmpdir}/testrepo.git") end shared_examples 'switch to branch/tag/sha' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo": ensure => latest, provider => git, revision => 'a_branch', source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'pulls the new branch commits' do - apply_manifest(pp, expect_changes: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo": ensure => latest, provider => git, revision => '0.0.3', source => "file://#{tmpdir}/testrepo.git", } MANIFEST it 'checks out the tag' do - apply_manifest(pp, expect_changes: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end it 'checks out the sha' do sha = shell("cd #{tmpdir}/testrepo && git rev-parse origin/master").stdout.chomp pp = <<-MANIFEST vcsrepo { "#{tmpdir}/testrepo": ensure => latest, provider => git, revision => '#{sha}', source => "file://#{tmpdir}/testrepo.git", } MANIFEST - apply_manifest(pp, expect_changes: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end end context 'when on branch' do before :each do shell("cd #{tmpdir}/testrepo && git checkout a_branch") shell("cd #{tmpdir}/testrepo && git reset --hard 0.0.2") end it_behaves_like 'switch to branch/tag/sha' end context 'when on tag' do before :each do shell("cd #{tmpdir}/testrepo && git checkout 0.0.1") end it_behaves_like 'switch to branch/tag/sha' end context 'when on detached head' do before :each do shell("cd #{tmpdir}/testrepo && git checkout 0.0.2") shell("cd #{tmpdir}/testrepo && git checkout HEAD~1") end it_behaves_like 'switch to branch/tag/sha' end end diff --git a/spec/acceptance/svn_paths_spec.rb b/spec/acceptance/svn_paths_spec.rb index feb450b..b14da86 100644 --- a/spec/acceptance/svn_paths_spec.rb +++ b/spec/acceptance/svn_paths_spec.rb @@ -1,286 +1,278 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'subversion :includes tests on SVN version >= 1.7', unless: ( # rubocop:disable RSpec/MultipleDescribes : The # test's on this page must be kept seperate as they are for different operating systems. - (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') =~ %r{^(5|6)$}) || - (fact('osfamily') == 'SLES') + (os[:family] == 'redhat' && os[:release].start_with?('5', '6')) || + (os[:family] == 'sles') ) do before(:all) do shell("mkdir -p #{tmpdir}") # win test end after(:all) do shell("rm -rf #{tmpdir}/svnrepo") end context 'with include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can checkout specific paths from svn' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/difftools") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/difftools/README") do its(:md5sum) { is_expected.to eq '540241e9d5d4740d0ef3d27c3074cf93' } end describe file("#{tmpdir}/svnrepo/difftools/pics") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/obsolete-notes") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/obsolete-notes/draft-korn-vcdiff-01.txt") do its(:md5sum) { is_expected.to eq '37019f808e1af64864853a67526cfe19' } end describe file("#{tmpdir}/svnrepo/obsolete-notes/vcdiff-karlnotes") do its(:md5sum) { is_expected.to eq '26e23ff6a156de14aebd1099e23ac2d8' } end describe file("#{tmpdir}/svnrepo/guis") do it { is_expected.not_to exist } end end context 'with add include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes', 'guis/pics', 'difftools/pics/README'], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can add paths to includes' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/guis/pics/README") do its(:md5sum) { is_expected.to eq '62bdc9180684042fe764d89c9beda40f' } end describe file("#{tmpdir}/svnrepo/difftools/pics/README") do its(:md5sum) { is_expected.to eq 'bad02dfc3cb96bf5cadd59bf4fe3e00e' } end end context 'with remove include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/pics/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can remove paths (and empty parent directories) from includes' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/guis/pics/README") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/guis/pics") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/guis") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/difftools/pics/README") do its(:md5sum) { is_expected.to eq 'bad02dfc3cb96bf5cadd59bf4fe3e00e' } end describe file("#{tmpdir}/svnrepo/difftools/README") do it { is_expected.not_to exist } end end context 'with changing revisions' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1700000, } MANIFEST it 'can change revisions' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe command("svn info #{tmpdir}/svnrepo") do its(:stdout) { is_expected.to match(%r{.*Revision: 1700000.*}) } end describe command("svn info #{tmpdir}/svnrepo/difftools/README") do its(:stdout) { is_expected.to match(%r{.*Revision: 1700000.*}) } end end end describe 'subversion :includes tests on SVN version == 1.6', if: ( - (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') =~ %r{^(5|6)$}) + (os[:family] == 'redhat' && os[:release].start_with?('5', '6')) ) do after(:all) do shell("rm -rf #{tmpdir}/svnrepo") end context 'with include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can checkout specific paths from svn' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/difftools") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/difftools/README") do its(:md5sum) { is_expected.to eq '540241e9d5d4740d0ef3d27c3074cf93' } end describe file("#{tmpdir}/svnrepo/difftools/pics") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/obsolete-notes") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/obsolete-notes/draft-korn-vcdiff-01.txt") do its(:md5sum) { is_expected.to eq '37019f808e1af64864853a67526cfe19' } end describe file("#{tmpdir}/svnrepo/obsolete-notes/vcdiff-karlnotes") do its(:md5sum) { is_expected.to eq '26e23ff6a156de14aebd1099e23ac2d8' } end describe file("#{tmpdir}/svnrepo/guis") do it { is_expected.not_to exist } end end context 'with add include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes', 'guis/pics', 'difftools/pics/README'], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can add paths to includes' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/guis/pics/README") do its(:md5sum) { is_expected.to eq '62bdc9180684042fe764d89c9beda40f' } end describe file("#{tmpdir}/svnrepo/difftools/pics/README") do its(:md5sum) { is_expected.to eq 'bad02dfc3cb96bf5cadd59bf4fe3e00e' } end end context 'with remove include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/pics/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can remove directory paths (and empty parent directories) from includes, but not files with siblings' do - # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) end describe file("#{tmpdir}/svnrepo/guis/pics/README") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/guis/pics") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/guis") do it { is_expected.not_to exist } end describe file("#{tmpdir}/svnrepo/difftools/pics/README") do its(:md5sum) { is_expected.to eq 'bad02dfc3cb96bf5cadd59bf4fe3e00e' } end describe file("#{tmpdir}/svnrepo/difftools/README") do its(:md5sum) { is_expected.to eq '540241e9d5d4740d0ef3d27c3074cf93' } end end context 'with changing revisions' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1700000, } MANIFEST it 'can change revisions' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe command("svn info #{tmpdir}/svnrepo") do its(:stdout) { is_expected.to match(%r{.*Revision: 1700000.*}) } end describe command("svn info #{tmpdir}/svnrepo/difftools/README") do its(:stdout) { is_expected.to match(%r{.*Revision: 1700000.*}) } end end end -describe 'subversion :includes tests on SVN version < 1.6', if: (fact('osfamily') == 'SLES') do +describe 'subversion :includes tests on SVN version < 1.6', if: (os[:family] == 'sles') do context 'with include paths' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, includes => ['difftools/README', 'obsolete-notes',], source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'fails when SVN version < 1.6' do # Expect error when svn < 1.6 and includes is used apply_manifest(pp, expect_failures: true) do |r| expect(r.stderr).to match(%r{Includes option is not available for SVN versions < 1.6. Version installed:}) end end end end diff --git a/spec/acceptance/svn_spec.rb b/spec/acceptance/svn_spec.rb index d436224..a4cc13b 100644 --- a/spec/acceptance/svn_spec.rb +++ b/spec/acceptance/svn_spec.rb @@ -1,131 +1,127 @@ require 'spec_helper_acceptance' tmpdir = default.tmpdir('vcsrepo') describe 'subversion tests' do before(:each) do shell("mkdir -p #{tmpdir}") # win test end context 'with plain checkout' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, source => "http://svn.apache.org/repos/asf/subversion/svn-logos", } MANIFEST it 'can checkout svn' do # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end describe file("#{tmpdir}/svnrepo/.svn") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/images/tyrus-svn2.png") do its(:md5sum) { is_expected.to eq '6b20cbc4a793913190d1548faad1ae80' } end after(:all) do shell("rm -rf #{tmpdir}/svnrepo") end end context 'with handles revisions' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1000000, } MANIFEST it 'can checkout a specific revision of svn' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/.svn") do it { is_expected.to be_directory } end describe command("svn info #{tmpdir}/svnrepo") do its(:stdout) { is_expected.to match(%r{.*Revision: 1000000.*}) } end describe file("#{tmpdir}/svnrepo/difftools/README") do its(:md5sum) { is_expected.to eq '540241e9d5d4740d0ef3d27c3074cf93' } end end context 'with handles revisions' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, source => "http://svn.apache.org/repos/asf/subversion/developer-resources", revision => 1700000, } MANIFEST it 'can switch revisions' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/.svn") do it { is_expected.to be_directory } end describe command("svn info #{tmpdir}/svnrepo") do its(:stdout) { is_expected.to match(%r{.*Revision: 1700000.*}) } end after(:all) do shell("rm -rf #{tmpdir}/svnrepo") end end context 'with switching sources' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, source => "http://svn.apache.org/repos/asf/subversion/tags/1.9.0", } MANIFEST it 'can checkout tag=1.9.0' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/.svn") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/STATUS") do its(:md5sum) { is_expected.to eq '286708a30aea43d78bc2b11f3ac57fff' } end end context 'with switching sources' do pp = <<-MANIFEST vcsrepo { "#{tmpdir}/svnrepo": ensure => present, provider => svn, source => "http://svn.apache.org/repos/asf/subversion/tags/1.9.4", } MANIFEST it 'can switch to tag=1.9.4' do # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) + idempotent_apply(default, pp) end describe file("#{tmpdir}/svnrepo/.svn") do it { is_expected.to be_directory } end describe file("#{tmpdir}/svnrepo/STATUS") do its(:md5sum) { is_expected.to eq '7f072a1c0e2ba37ca058f65e554de95e' } end end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 41e4ed8..1f2d30b 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,61 +1,75 @@ require 'beaker-pe' require 'beaker-puppet' require 'beaker-rspec' require 'beaker/puppet_install_helper' require 'beaker/module_install_helper' run_puppet_install_helper configure_type_defaults_on(hosts) install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i install_module_on(hosts) install_module_dependencies_on(hosts) RSpec.configure do |c| # Readable test descriptions c.formatter = :documentation # Configure all nodes in nodeset c.before :suite do # ensure test dependencies are available on all hosts hosts.each do |host| case fact_on(host, 'osfamily') when 'RedHat' if fact_on(host, 'operatingsystemmajrelease') == '5' will_install_git = on(host, 'which git', acceptable_exit_codes: [0, 1]).exit_code == 1 if will_install_git on host, puppet('module install stahnma-epel') apply_manifest_on(host, 'include epel') end end install_package(host, 'git') install_package(host, 'subversion') when 'Debian' install_package(host, 'git-core') install_package(host, 'subversion') else unless check_for_package(host, 'git') puts 'Git package is required for this module' exit end unless check_for_package(host, 'subversion') puts 'Subversion package is required for this module' exit end end on host, 'git config --global user.email "root@localhost"' on host, 'git config --global user.name "root"' end end end +def idempotent_apply(hosts, manifest, opts = {}, &block) + block_on hosts, opts do |host| + file_path = host.tmpfile('apply_manifest.pp') + create_remote_file(host, file_path, manifest + "\n") + + puppet_apply_opts = { :verbose => nil, 'detailed-exitcodes' => nil } + on_options = { acceptable_exit_codes: [0, 2] } + on host, puppet('apply', file_path, puppet_apply_opts), on_options, &block + puppet_apply_opts2 = { :verbose => nil, 'detailed-exitcodes' => nil } + on_options2 = { acceptable_exit_codes: [0] } + on host, puppet('apply', file_path, puppet_apply_opts2), on_options2, &block + end +end + # git with 3.18 changes the maximum enabled TLS protocol version, older OSes will fail these tests def only_supports_weak_encryption - return_val = (fact('osfamily') == 'RedHat' && fact('operatingsystemmajrelease') == '5') || - (fact('operatingsystem') == 'OracleLinux' && fact('operatingsystemmajrelease') == '6') + return_val = (os[:family] == 'redhat' && os[:release].start_with?('5') || + (host_inventory['facter']['os']['name'] == 'OracleLinux' && os[:release].start_with?('6'))) return_val end