Debian Codegraph @

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

raw
1 test_name 'C3487 - checkout as a group (file 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
20 step 'setup - create group' do
21 apply_manifest_on(host, "group { '#{group}': ensure => present, }", :catch_failures => true)
22 end
23
24 teardown do
25 on(host, "rm -fr #{tmpdir}")
26 apply_manifest_on(host, "group { '#{group}': ensure => absent, }", :catch_failures => true)
27 end
28
29 step 'checkout as a group with puppet' do
30 pp = <<-EOS
31 vcsrepo { "#{tmpdir}/#{repo_name}":
32 ensure => present,
33 source => "file://#{tmpdir}/testrepo.git",
34 provider => git,
35 group => '#{group}',
36 }
37 EOS
38
39 apply_manifest_on(host, pp, :catch_failures => true)
40 apply_manifest_on(host, pp, :catch_changes => true)
41 end
42
43 step "verify git checkout is own by group #{group}" do
44 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
45 fail_test('checkout not found') unless res.stdout.include? "HEAD"
46 end
47
48 on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res|
49 fail_test('checkout not owned by group') unless res.stdout.include? ":#{group}"
50 end
51 end
52
53 end