| 1 |
test_name 'C3480 - shallow clone repo minimal depth = 1 (https protocol)' |
| 2 |
skip_test 'Not currently supported. See FM-1286' |
| 3 |
|
| 4 |
# Globals |
| 5 |
repo_name = 'testrepo_shallow_clone' |
| 6 |
|
| 7 |
hosts.each do |host| |
| 8 |
ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby' |
| 9 |
tmpdir = host.tmpdir('vcsrepo') |
| 10 |
step 'setup - create repo' do |
| 11 |
git_pkg = 'git' |
| 12 |
if host['platform'] =~ /ubuntu-10/ |
| 13 |
git_pkg = 'git-core' |
| 14 |
end |
| 15 |
install_package(host, git_pkg) |
| 16 |
my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) |
| 17 |
scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir) |
| 18 |
on(host, "cd #{tmpdir} && ./create_git_repo.sh") |
| 19 |
end |
| 20 |
step 'setup - start https server' do |
| 21 |
https_daemon =<<-EOF |
| 22 |
require 'webrick' |
| 23 |
require 'webrick/https' |
| 24 |
server = WEBrick::HTTPServer.new( |
| 25 |
:Port => 8443, |
| 26 |
:DocumentRoot => "#{tmpdir}", |
| 27 |
:SSLEnable => true, |
| 28 |
:SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE, |
| 29 |
:SSLCertificate => OpenSSL::X509::Certificate.new( File.open("#{tmpdir}/server.crt").read), |
| 30 |
:SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("#{tmpdir}/server.key").read), |
| 31 |
:SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ]) |
| 32 |
WEBrick::Daemon.start |
| 33 |
server.start |
| 34 |
EOF |
| 35 |
create_remote_file(host, '/tmp/https_daemon.rb', https_daemon) |
| 36 |
#on(host, "#{ruby} /tmp/https_daemon.rb") |
| 37 |
end |
| 38 |
|
| 39 |
teardown do |
| 40 |
on(host, "rm -fr #{tmpdir}") |
| 41 |
on(host, 'ps ax | grep "#{ruby} /tmp/https_daemon.rb" | grep -v grep | awk \'{print "kill -9 " $1}\' | sh ; sleep 1') |
| 42 |
end |
| 43 |
|
| 44 |
step 'shallow clone repo with puppet' do |
| 45 |
pp = <<-EOS |
| 46 |
vcsrepo { "#{tmpdir}/#{repo_name}": |
| 47 |
ensure => present, |
| 48 |
source => "https://github.com/johnduarte/testrepo.git", |
| 49 |
provider => git, |
| 50 |
depth => 1, |
| 51 |
} |
| 52 |
EOS |
| 53 |
|
| 54 |
apply_manifest_on(host, pp, :catch_failures => true) |
| 55 |
apply_manifest_on(host, pp, :catch_changes => true) |
| 56 |
end |
| 57 |
|
| 58 |
step 'verify checkout is shallow and of the correct depth' do |
| 59 |
on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| |
| 60 |
fail_test('shallow not found') unless res.stdout.include? "shallow" |
| 61 |
end |
| 62 |
|
| 63 |
on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res| |
| 64 |
fail_test('shallow not found') unless res.stdout.include? "1 #{tmpdir}/#{repo_name}/.git/shallow" |
| 65 |
end |
| 66 |
end |
| 67 |
|
| 68 |
end |