Debian Codegraph @

spec/acceptance/beaker/git/shallow_clone/shallow_clone_git.rb

raw
1 test_name 'C3474 - shallow clone repo minimal depth = 1 (git protocol)'
2
3 # Globals
4 repo_name = 'testrepo_shallow_clone'
5
6 hosts.each do |host|
7 tmpdir = host.tmpdir('vcsrepo')
8 step 'setup - create repo' do
9 git_pkg = 'git'
10 if host['platform'] =~ /ubuntu-10/
11 git_pkg = 'git-core'
12 end
13 install_package(host, git_pkg)
14 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
15 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
16 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
17 end
18 step 'setup - start git daemon' do
19 install_package(host, 'git-daemon') unless host['platform'] =~ /debian|ubuntu/
20 on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach")
21 end
22
23 teardown do
24 on(host, "rm -fr #{tmpdir}")
25 on(host, 'pkill -9 git-daemon ; sleep 1')
26 end
27
28 step 'shallow clone repo with puppet' do
29 pp = <<-EOS
30 vcsrepo { "#{tmpdir}/#{repo_name}":
31 ensure => present,
32 source => "git://#{host}/testrepo.git",
33 provider => git,
34 depth => 1,
35 }
36 EOS
37
38 apply_manifest_on(host, pp, :catch_failures => true)
39 apply_manifest_on(host, pp, :catch_changes => true)
40 end
41
42 step 'verify checkout is shallow and of the correct depth' do
43 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
44 fail_test('shallow not found') unless res.stdout.include? "shallow"
45 end
46
47 on(host, "wc -l #{tmpdir}/#{repo_name}/.git/shallow") do |res|
48 fail_test('shallow not found') unless res.stdout.include? "1 #{tmpdir}/#{repo_name}/.git/shallow"
49 end
50 end
51
52 end