diff options
author | John Duarte <john.duarte@puppetlabs.com> | 2014-05-12 14:58:35 -0700 |
---|---|---|
committer | John Duarte <john.duarte@puppetlabs.com> | 2014-05-12 14:58:35 -0700 |
commit | 35ba3c859c83df6c725579986b8681d3aaa3813f (patch) | |
tree | 9bad6f269c36f1321dcdc4f5d480c1688d28a474 /spec/acceptance | |
parent | 46588aa62d444c5f0a538cccec357a80cd191b93 (diff) | |
download | puppet-vcsrepo-35ba3c859c83df6c725579986b8681d3aaa3813f.tar.gz puppet-vcsrepo-35ba3c859c83df6c725579986b8681d3aaa3813f.tar.bz2 |
Add test for ensure latest with branch specified
Diffstat (limited to 'spec/acceptance')
-rw-r--r-- | spec/acceptance/clone_repo_spec.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/acceptance/clone_repo_spec.rb b/spec/acceptance/clone_repo_spec.rb index 4e2db19..3ebbcfa 100644 --- a/spec/acceptance/clone_repo_spec.rb +++ b/spec/acceptance/clone_repo_spec.rb @@ -121,14 +121,36 @@ describe 'clones a remote repo' do end end - context 'ensure latest' do + context 'ensure latest with branch specified' do + it 'clones a repo' do + pp = <<-EOS + vcsrepo { "#{tmpdir}/testrepo_latest": + ensure => latest, + provider => git, + source => "file://#{tmpdir}/testrepo.git", + revision => 'a_branch', + } + EOS + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + it 'verifies the HEAD commit SHA on remote and local match' do + remote_commit = shell("git ls-remote file://#{tmpdir}/testrepo_latest HEAD | head -1").stdout + local_commit = shell("git --git-dir=#{tmpdir}/testrepo_latest/.git rev-parse HEAD").stdout.chomp + expect(remote_commit).to include(local_commit) + end + end + + context 'ensure latest with branch unspecified' do it 'clones a repo' do pp = <<-EOS vcsrepo { "#{tmpdir}/testrepo_latest": ensure => latest, provider => git, source => "file://#{tmpdir}/testrepo.git", - revision => 'master', } EOS |