Debian Codegraph @

spec/acceptance/beaker/git/group_checkout/group_checkout_git.rb

raw
1 test_name 'C3485 - checkout as a group (git protocol)'
2
3 # Globals
4 repo_name = 'testrepo_group_checkout'
5 group = 'mygroup'
6
7 hosts.each do |host|
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 step 'setup - start git daemon' do
20 install_package(host, 'git-daemon') unless host['platform'] =~ /debian|ubuntu/
21 on(host, "git daemon --base-path=#{tmpdir} --export-all --reuseaddr --verbose --detach")
22 end
23
24 step 'setup - create group' do
25 apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true)
26 end
27
28 teardown do
29 on(host, "rm -fr #{tmpdir}")
30 on(host, 'pkill -9 git-daemon ; sleep 1')
31 apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true)
32 end
33
34 step 'checkout a group with puppet' do
35 pp = <<-EOS
36 vcsrepo { "#{tmpdir}/#{repo_name}":
37 ensure => present,
38 source => "git://#{host}/testrepo.git",
39 provider => git,
40 group => '#{group}',
41 }
42 EOS
43
44 apply_manifest_on(host, pp, :catch_failures => true)
45 apply_manifest_on(host, pp, :catch_changes => true)
46 end
47
48 step "verify git checkout is own by group #{group}" do
49 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
50 fail_test('checkout not found') unless res.stdout.include? "HEAD"
51 end
52
53 on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res|
54 fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}"
55 end
56 end
57
58 end