diff options
author | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-05-19 08:09:43 -0700 |
---|---|---|
committer | Ashley Penney <ashley.penney@puppetlabs.com> | 2014-05-19 08:09:43 -0700 |
commit | c3b2793cff608128739769018e331cbf6437634a (patch) | |
tree | 7e6ddf0a792dbe206166dd91aa26b1a9db470f1e /spec | |
parent | f6864f446f4137499586a930cb7514b2dcb82b6d (diff) | |
parent | 35ba3c859c83df6c725579986b8681d3aaa3813f (diff) | |
download | puppet-vcsrepo-c3b2793cff608128739769018e331cbf6437634a.tar.gz puppet-vcsrepo-c3b2793cff608128739769018e331cbf6437634a.tar.bz2 |
Merge pull request #137 from johnduarte/git_ensure_latest
Add test for ensure latest with branch specified
Diffstat (limited to 'spec')
-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 1797c64..e76f4bc 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 |