1 test_name 'C3511 - clone over an existing repo with force'
4 repo_name = 'testrepo_already_exists'
7 tmpdir = host.tmpdir('vcsrepo')
8 step 'setup - create repo' do
9 install_package(host, 'git')
10 my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..'))
11 scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
12 on(host, "cd #{tmpdir} && ./create_git_repo.sh")
13 on(host, "mkdir #{tmpdir}/#{repo_name}")
14 on(host, "cd #{tmpdir}/#{repo_name} && git init")
15 on(host, "cd #{tmpdir}/#{repo_name} && touch a && git add a && git commit -m 'a'")
19 on(host, "rm -fr #{tmpdir}")
22 step 'clone over existing repo with force using puppet' do
23 on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res|
24 @existing_sha = res.stdout
27 vcsrepo { "#{tmpdir}/#{repo_name}":
29 source => "file://#{tmpdir}/testrepo.git",
35 apply_manifest_on(host, pp)
38 step 'verify new repo has replaced old one' do
39 on(host, "cd #{tmpdir}/#{repo_name} && git log --pretty=format:\"%h\"") do |res|
40 fail_test('original repo not replaced by force') if res.stdout.include? "#{@existing_sha}"