Debian Codegraph @

spec/acceptance/beaker/git/branch_checkout/branch_checkout_file_path.rb

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