summaryrefslogtreecommitdiff
path: root/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb
diff options
context:
space:
mode:
authorJohn Duarte <john.duarte@puppetlabs.com>2014-05-10 10:00:28 -0700
committerJohn Duarte <john.duarte@puppetlabs.com>2014-05-18 11:38:19 -0700
commitcd553d04e8a456cf7b76dba5f6a047242d09c03e (patch)
tree9a4dc8163c5275b8f22c12f47341850d6d625b1b /spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb
parent35fd8b137fa83d34eb90df400ccd1da78a947b18 (diff)
downloadpuppet-vcsrepo-cd553d04e8a456cf7b76dba5f6a047242d09c03e.tar.gz
puppet-vcsrepo-cd553d04e8a456cf7b76dba5f6a047242d09c03e.tar.bz2
Add beaker test for git branch checkout
Diffstat (limited to 'spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb')
-rw-r--r--spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb b/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb
new file mode 100644
index 0000000..9870daa
--- /dev/null
+++ b/spec/acceptance/beaker/branch_checkout/branch_checkout_file_path.rb
@@ -0,0 +1,44 @@
+test_name 'C3437 - checkout a branch (file path)'
+
+# Globals
+repo_name = 'testrepo_branch_checkout'
+branch = 'a_branch'
+
+hosts.each do |host|
+ tmpdir = host.tmpdir('vcsrepo')
+ step 'setup - create repo' do
+ install_package(host, 'git')
+ my_root = File.expand_path(File.join(File.dirname(__FILE__), '../../..'))
+ scp_to(host, "#{my_root}/acceptance/files/create_git_repo.sh", tmpdir)
+ on(host, "cd #{tmpdir} && ./create_git_repo.sh")
+ end
+
+ teardown do
+ on(host, "rm -fr #{tmpdir}")
+ end
+
+ step 'checkout a branch with puppet' do
+ pp = <<-EOS
+ vcsrepo { "#{tmpdir}/#{repo_name}":
+ ensure => present,
+ source => "#{tmpdir}/testrepo.git",
+ provider => git,
+ revision => '#{branch}',
+ }
+ EOS
+
+ apply_manifest_on(host, pp)
+ apply_manifest_on(host, pp)
+ end
+
+ step "verify checkout is on the #{branch} branch" do
+ on(host, "ls #{tmpdir}/#{repo_name}/.git/") do |res|
+ fail_test('checkout not found') unless res.stdout.include? "HEAD"
+ end
+
+ on(host, "cat #{tmpdir}/#{repo_name}/.git/HEAD") do |res|
+ fail_test('branch not found') unless res.stdout.include? "ref: refs/heads/#{branch}"
+ end
+ end
+
+end