diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-21 17:08:54 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-21 17:08:54 -0700 |
commit | 7591de7e4ef20726a9a174ec8728bec4119d751c (patch) | |
tree | 455d4807676f2be3ee5d4dc88f3153dc9301bda9 /spec/unit/parser/compiler_spec.rb | |
parent | 3c22e770625f3cc788b0d138c8101e259a534736 (diff) | |
download | puppet-7591de7e4ef20726a9a174ec8728bec4119d751c.tar.gz puppet-7591de7e4ef20726a9a174ec8728bec4119d751c.tar.xz puppet-7591de7e4ef20726a9a174ec8728bec4119d751c.zip |
maint: fix a race in catalog compilation versioning.
The implementation has a whole pile of time dependencies in our comparisons,
we had a whole pile of races across the code.
We could try and fix the comparisons to work better, but that is actually
harder than it sounds thanks to the architecture.
Instead, freeze time for each test, ensuring that we consistently get the
result expected.
Diffstat (limited to 'spec/unit/parser/compiler_spec.rb')
-rwxr-xr-x | spec/unit/parser/compiler_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index ced760b76..f4cf8b3a1 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -40,6 +40,13 @@ describe Puppet::Parser::Compiler do end before :each do + # Push me faster, I wanna go back in time! (Specifically, freeze time + # across the test since we have a bunch of version == timestamp code + # hidden away in the implementation and we keep losing the race.) + # --daniel 2011-04-21 + now = Time.now + Time.stubs(:now).returns(now) + @node = Puppet::Node.new "testnode" @known_resource_types = Puppet::Resource::TypeCollection.new "development" @compiler = Puppet::Parser::Compiler.new(@node) |