diff options
author | Luke Kanies <luke@madstop.com> | 2008-05-20 23:12:06 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-05-20 23:12:06 -0500 |
commit | 400bab9fcf167bc76710a260822e0b0e114c98fa (patch) | |
tree | 42e7294cf4a56664a56adac8062468e39535f9bc /spec | |
parent | d235f26cb7be5b24d63f7f9a57aabdcf86fb16b4 (diff) | |
download | facter-400bab9fcf167bc76710a260822e0b0e114c98fa.tar.gz facter-400bab9fcf167bc76710a260822e0b0e114c98fa.tar.xz facter-400bab9fcf167bc76710a260822e0b0e114c98fa.zip |
Adding a timeout to fact retrieval, fixing #56.
The timeout is currently 0.5 seconds, which should generally
be enough time.
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/util/fact.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/util/fact.rb b/spec/unit/util/fact.rb index 1652032..cee70b9 100755 --- a/spec/unit/util/fact.rb +++ b/spec/unit/util/fact.rb @@ -121,6 +121,13 @@ describe Facter::Util::Fact do @fact.value.should be_nil end + + it "should timeout after 0.5 seconds" do + @fact.expects(:warn) + @fact.add { setcode { sleep 2; raise "This is a test" } } + + @fact.value.should be_nil + end end it "should have a method for flushing the cached fact" do |