1 test_name 'C3480 - shallow clone repo minimal depth = 1 (https protocol)'
2 skip_test 'Not currently supported. See FM-1286'
5 repo_name = 'testrepo_shallow_clone'
8 ruby = (host.is_pe? && '/opt/puppet/bin/ruby') || 'ruby'
9 tmpdir = host.tmpdir('vcsrepo')
10 step 'setup - create repo' do
11 install_package(host, 'git')
12 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
13 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
14 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
16 step 'setup - start https server' do
19 require 'webrick/https'
20 server = WEBrick::HTTPServer.new(
22 :DocumentRoot => "#{tmpdir}",
24 :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
25 :SSLCertificate => OpenSSL::X509::Certificate.new( File.open("#{tmpdir}/server.crt").read),
26 :SSLPrivateKey => OpenSSL::PKey::RSA.new( File.open("#{tmpdir}/server.key").read),
27 :SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ])
31 create_remote_file(host, '/tmp/https_daemon.rb', https_daemon)
32 #on(host, "#{ruby} /tmp/https_daemon.rb")
36 on(host, "rm -fr #{tmpdir}")
37 on(host, 'ps ax | grep "#{ruby} /tmp/https_daemon.rb" | grep -v grep | awk \'{print "kill -9 " $1}\' | sh ; sleep 1')
40 step 'shallow clone repo with puppet' do
42 vcsrepo { "#{tmpdir}/#{repo_name}":
44 source => "https://github.com/johnduarte/testrepo.git",
50 apply_manifest_on(host, pp, :catch_failures => true)
51 apply_manifest_on(host, pp, :catch_changes => true)
54 step 'verify checkout is shallow and of the correct depth' do
55 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
56 fail_test('shallow not found') unless res.stdout.include? "shallow"
59 on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res|
60 fail_test('shallow not found') unless res.stdout.include? "2 #{tmpdir}/#{repo_name}/.git/shallow"