| 1 |
test_name 'C3479 - shallow clone repo minimal depth = 1 (http protocol)' |
| 2 |
|
| 3 |
# Globals |
| 4 |
repo_name = 'testrepo_shallow_clone' |
| 5 |
|
| 6 |
hosts.each do |host| |
| 7 |
ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' |
| 8 |
tmpdir = host.tmpdir('vcsrepo') |
| 9 |
step 'setup - create repo' do |
| 10 |
git_pkg = 'git' |
| 11 |
if host['platform'] =~ /ubuntu-10/ |
| 12 |
git_pkg = 'git-core' |
| 13 |
end |
| 14 |
install_package(host, git_pkg) |
| 15 |
my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../../..')) |
| 16 |
scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) |
| 17 |
on(host, "cd #{tmpdir} && ./create_git_repo.sh") |
| 18 |
end |
| 19 |
|
| 20 |
step 'setup - start http server' do |
| 21 |
http_daemon =<<-EOF |
| 22 |
require 'webrick' |
| 23 |
server = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => "#{tmpdir}") |
| 24 |
WEBrick::Daemon.start |
| 25 |
server.start |
| 26 |
EOF |
| 27 |
create_remote_file(host, '/tmp/http_daemon.rb', http_daemon) |
| 28 |
on(host, "#{ruby} /tmp/http_daemon.rb") |
| 29 |
end |
| 30 |
|
| 31 |
teardown do |
| 32 |
on(host, "rm -fr #{tmpdir}") |
| 33 |
on(host, 'ps ax | grep "#{ruby} /tmp/http_daemon.rb" | grep -v grep | awk \'{print "kill -9 " $1}\' | sh ; sleep 1') |
| 34 |
end |
| 35 |
|
| 36 |
step 'shallow clone repo with puppet' do |
| 37 |
pp = <<-EOS |
| 38 |
vcsrepo { "#{tmpdir}/#{repo_name}": |
| 39 |
ensure => present, |
| 40 |
source => "http://#{host}:8000/testrepo.git", |
| 41 |
provider => git, |
| 42 |
depth => 1, |
| 43 |
} |
| 44 |
EOS |
| 45 |
|
| 46 |
apply_manifest_on(host, pp, :expect_failures => true) |
| 47 |
end |
| 48 |
|
| 49 |
step 'git does not support shallow clone via HTTP: verify checkout is NOT created' do |
| 50 |
on(host, "ls #{tmpdir}") do |res| |
| 51 |
fail_test('checkout found') if res.stdout.include? "#{repo_name}" |
| 52 |
end |
| 53 |
end |
| 54 |
|
| 55 |
end |