| 1 |
test_name 'C3427 - clone (file protocol)' |
| 2 |
|
| 3 |
# Globals |
| 4 |
repo_name = 'testrepo_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 |
|
| 19 |
teardown do |
| 20 |
on(host, "rm -fr #{tmpdir}") |
| 21 |
end |
| 22 |
|
| 23 |
step 'clone with puppet' do |
| 24 |
pp = <<-EOS |
| 25 |
vcsrepo { "#{tmpdir}/#{repo_name}": |
| 26 |
ensure => present, |
| 27 |
source => "file://#{tmpdir}/testrepo.git", |
| 28 |
provider => git, |
| 29 |
} |
| 30 |
EOS |
| 31 |
|
| 32 |
apply_manifest_on(host, pp, :catch_failures => true) |
| 33 |
apply_manifest_on(host, pp, :catch_changes => true) |
| 34 |
end |
| 35 |
|
| 36 |
step "verify checkout is on the master branch" do |
| 37 |
on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res| |
| 38 |
fail_test('checkout not found') unless res.stdout.include? "HEAD" |
| 39 |
end |
| 40 |
|
| 41 |
on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res| |
| 42 |
fail_test('master not found') unless res.stdout.include? "ref: refs/heads/master" |
| 43 |
end |
| 44 |
end |
| 45 |
|
| 46 |
end |