[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Daniel Pittman
daniel at rimspace.net
Tue May 10 08:05:55 UTC 2011
The following commit has been merged in the experimental branch:
commit 9a1c3b5ad48a254ff2a6becc72f54feb37bb3de1
Author: Daniel Pittman <daniel at rimspace.net>
Date: Mon Mar 7 18:44:28 2011 -0800
maint: spec/integration/configurer has races in time checking.
This code depended on the time written by the configurer, and Time.now about
half a dozen lines later, being the same integer value. This would work
almost all the time, because our code is pretty fast, but can race.
We now capture the time on both sides of the call, and verify that the emitted
time was in that range; this actually tests the whole purpose much better, and
more thoroughly.
Reviewed-by: Paul Berry <paul at puppetlabs.com>
diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb
index 825b632..05b3d61 100755
--- a/spec/integration/configurer_spec.rb
+++ b/spec/integration/configurer_spec.rb
@@ -50,7 +50,12 @@ describe Puppet::Configurer do
Puppet[:lastrunfile] = tmpfile("lastrunfile")
Puppet[:report] = true
+ # We only record integer seconds in the timestamp, and truncate
+ # backwards, so don't use a more accurate timestamp in the test.
+ # --daniel 2011-03-07
+ t1 = Time.now.tv_sec
@configurer.run :catalog => @catalog, :report => report
+ t2 = Time.now.tv_sec
summary = nil
File.open(Puppet[:lastrunfile], "r") do |fd|
@@ -62,7 +67,7 @@ describe Puppet::Configurer do
summary.should be_key(key)
end
summary["time"].should be_key("notify")
- summary["time"]["last_run"].should >= Time.now.tv_sec
+ summary["time"]["last_run"].should be_between(t1, t2)
end
end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list