1 test_name 'C3459 - checkout as a user (file protocol)'
4 repo_name = 'testrepo_user_checkout'
8 tmpdir = host.tmpdir('vcsrepo')
9 step 'setup - create repo' do
10 install_package(host, 'git')
11 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
12 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
13 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
16 step 'setup - create user' do
17 apply_manifest_on(host, "user { '#{user}': ensure => present, }")
21 on(host, "rm -fr #{tmpdir}")
22 apply_manifest_on(host, "user { '#{user}': ensure => absent, }")
25 step 'checkout as a user with puppet' do
27 vcsrepo { "#{tmpdir}/#{repo_name}":
29 source => "file://#{tmpdir}/testrepo.git",
35 apply_manifest_on(host, pp)
36 apply_manifest_on(host, pp)
39 step "verify git checkout is owned by user #{user}" do
40 on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
41 fail_test('checkout not found') unless res.stdout.include? "HEAD"
44 on(host, "stat --format '%U:%G' #{tmpdir}/#{repo_name}/.git/HEAD") do |res|
45 fail_test('checkout not owned by user') unless res.stdout.include? "#{user}:"