summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-08-15 17:07:51 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-15 19:37:56 -0700
commit2297899e76dd3b65787768f2e4bf6b74b95a3d66 (patch)
tree50689afe77e431a173da5581d5b3d15fb005a41c /spec/integration
parent1ce2973e8af2300aff2b042257d8181855cf887d (diff)
downloadpuppet-2297899e76dd3b65787768f2e4bf6b74b95a3d66.tar.gz
puppet-2297899e76dd3b65787768f2e4bf6b74b95a3d66.tar.xz
puppet-2297899e76dd3b65787768f2e4bf6b74b95a3d66.zip
Do not leak indirector state from apply tests
Since the indirector state persists across tests, we were seeing order dependent test failures with tests that assumed the default indirector settings. Specifically, if the following tests were run in order, the first would cause failures in the second two: spec/unit/application/apply_spec.rb spec/unit/node_spec.rb spec/integration/node_spec.rb To protect against this state leakage, we now: - reset the Puppet::Node terminus before each test in spec/integration/node_spec.rb to ensure we are testing a clean environment. - reset the Puppet::Node, and Puppet::Node::Facts terminus, and cache class after each test in spec/unit/application/apply_spec.rb to prevent leakage into other tests. Since the cache class has the same state leakage problem as the terminus class, but does not have the same ability to lazily populate the default when set to nil, we remove the test. Testing the default for the cache class would require running the test before all other tests to ensure there is no state pollution.n
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/node_spec.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb
index 4ea6142e2..b81a1fdc3 100755
--- a/spec/integration/node_spec.rb
+++ b/spec/integration/node_spec.rb
@@ -10,6 +10,9 @@ require 'puppet/node'
describe Puppet::Node do
describe "when delegating indirection calls" do
before do
+ Puppet::Node.indirection.reset_terminus_class
+ Puppet::Node.indirection.cache_class = nil
+
@name = "me"
@node = Puppet::Node.new(@name)
end