diff options
Diffstat (limited to 'spec/unit/agent/locker.rb')
-rwxr-xr-x | spec/unit/agent/locker.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/agent/locker.rb b/spec/unit/agent/locker.rb index aae7c0c7b..1477c824e 100755 --- a/spec/unit/agent/locker.rb +++ b/spec/unit/agent/locker.rb @@ -11,12 +11,21 @@ end describe Puppet::Agent::Locker do before do @locker = LockerTester.new + @locker.stubs(:lockfile_path).returns "/my/lock" end it "should use a Pidlock instance as its lockfile" do @locker.lockfile.should be_instance_of(Puppet::Util::Pidlock) end + it "should use 'lockfile_path' to determine its lockfile path" do + @locker.expects(:lockfile_path).returns "/my/lock" + lock = Puppet::Util::Pidlock.new("/my/lock") + Puppet::Util::Pidlock.expects(:new).with("/my/lock").returns lock + + @locker.lockfile + end + it "should reuse the same lock file each time" do @locker.lockfile.should equal(@locker.lockfile) end @@ -83,4 +92,9 @@ describe Puppet::Agent::Locker do lambda { @locker.lock { raise "foo" } }.should raise_error(RuntimeError) end + + it "should be considered running if the lockfile is locked" do + @locker.lockfile.expects(:locked?).returns true + @locker.should be_running + end end |