diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-03-16 14:25:10 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-03-16 17:22:24 -0700 |
commit | f4401d34c106654d8af1f774d0b0bba27c5d4445 (patch) | |
tree | 3110fdbfbef5c60443ac2fa6d7b611090764f64d /spec | |
parent | b40021ba4bb1bc328abd54eb2eb7cae7ee82f7cf (diff) | |
download | puppet-f4401d34c106654d8af1f774d0b0bba27c5d4445.tar.gz puppet-f4401d34c106654d8af1f774d0b0bba27c5d4445.tar.xz puppet-f4401d34c106654d8af1f774d0b0bba27c5d4445.zip |
(#6722) load all functions before testing...
We historically had a state-dependency across tests in the parser function
support area; the first test caused the function to be loaded, and other tests
would then fail as a consequence of that.
We now autoload all functions at the top of each test suite, allowing us to
correctly and sensibly test on them as we should.
This theoretically prevents us from testing the autoloader implicitly in these
tests, but that should be tested independently.
Paired-With: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/parser/functions/defined_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/extlookup_spec.rb | 5 | ||||
-rwxr-xr-x[-rw-r--r--] | spec/unit/parser/functions/fqdn_rand_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/generate_spec.rb | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | spec/unit/parser/functions/include_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/inline_template_spec.rb | 5 | ||||
-rwxr-xr-x | spec/unit/parser/functions/realize_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/regsubst_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/require_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/shellquote_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/split_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/sprintf_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/tag_spec.rb | 3 | ||||
-rwxr-xr-x | spec/unit/parser/functions/template_spec.rb | 5 | ||||
-rwxr-xr-x | spec/unit/parser/functions/versioncmp_spec.rb | 3 |
15 files changed, 47 insertions, 4 deletions
diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index 0dd1dadb8..0113c3233 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'defined' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do Puppet::Node::Environment.stubs(:current).returns(nil) diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index a476dc844..46cd3cc27 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -4,12 +4,13 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'tempfile' describe "the extlookup function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new - @scope.stubs(:environment).returns(Puppet::Node::Environment.new('production')) - Puppet::Parser::Functions.function("extlookup") end it "should exist" do diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index 151ebac9a..be2e6fa76 100644..100755 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the fqdn_rand function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 12f454210..d25015b56 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the generate function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb index 67227e7d9..cfaadfbb6 100644..100755 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'include' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do Puppet::Node::Environment.stubs(:current).returns(nil) diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 36d53778d..712c68c69 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the inline_template function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new @@ -56,4 +59,4 @@ describe "the inline_template function" do lambda { @scope.function_inline_template("1") }.should raise_error(Puppet::ParseError) end -end
\ No newline at end of file +end diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 899f69b01..3106c42b6 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the realize function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @collector = stub_everything 'collector' diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 09aa92d28..1fb8e410c 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the regsubst function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 4afbd5a63..edcbc4ae6 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the require function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @catalog = stub 'catalog' diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index c8b0d650d..55302b97b 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the shellquote function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index 39710003b..b892a5c2a 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the split function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 4f29012b3..69fbb5e97 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the sprintf function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index e9b5122c7..b6bb45252 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'tag' function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 9dd5cc947..7eaf3554d 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the template function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new @@ -59,4 +62,4 @@ describe "the template function" do lambda { @scope.function_template("1") }.should raise_error(Puppet::ParseError) end -end
\ No newline at end of file +end diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 2bc7be801..ddc79cd85 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -3,6 +3,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the versioncmp function" do + before :all do + Puppet::Parser::Functions.autoloader.loadall + end before :each do @scope = Puppet::Parser::Scope.new |