From 56f25d57dfa26de618416e9bdd4a853296ffcbc1 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Fri, 26 Dec 2014 15:27:20 -0800 Subject: MODULES-1596 - Repository repeatedly destroyed/created with force The `retrieve` method was calling `create` and `destroy` on every run with `force => true`. Retrieve should not be making any changes to the system, so removed that code, and updated `working_copy_exists` to make sure that the directory not only contains a `.git` directory, but also if `source` is specified it also matches `#{path}/.git/config` so that it will overwrite a git repo with a different source. Updated tests to not check for the old broken behavior. Added a regression test. --- spec/unit/puppet/provider/vcsrepo/git_spec.rb | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'spec/unit/puppet') diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index 122eb62..edc7202 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -175,28 +175,6 @@ branches provider.expects(:git).with('checkout', '--force', resource.value(:revision)) provider.create end - it "should warn about destroying it using force and noop attribute" do - resource[:force] = true - resource[:noop] = true - resource.delete(:revision) - provider.expects(:working_copy_exists?).returns(true) - - provider.expects(:destroy).never - provider.expects(:create).never - Puppet::Type::Vcsrepo::Ensure.any_instance.expects(:send_log).with(:notice, "Noop Mode - Would have deleted repository and re-created from latest") - provider.resource.retrieve - end - it "should warn about destroying it using force and global noop" do - resource[:force] = true - Puppet[:noop] = true - resource.delete(:revision) - provider.expects(:working_copy_exists?).returns(true) - - provider.expects(:destroy).never - provider.expects(:create).never - Puppet::Type::Vcsrepo::Ensure.any_instance.expects(:send_log).with(:notice, "Noop Mode - Would have deleted repository and re-created from latest") - provider.resource.retrieve - end end context "when the path is not empty and not a repository" do -- cgit v1.2.3