From 318dcfaec6ba6d0e4af1e32e55ea20b721679537 Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Tue, 14 Mar 2017 11:16:07 +0000 Subject: (MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat `Puppet.version.to_f` on Puppet 4.10.0 will evaluate to `4.1`, causing test and behavioural changes when conditionals check that the version is equal or greater than versions such as `4.3`. Version comparisons that are vulnerable to this have been changed to use Puppet's versioncmp implementation, while most others only check for for major version boundaries which is safe. --- spec/aliases/string_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/string_spec.rb') diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb index 8a93585..d8fb885 100644 --- a/spec/aliases/string_spec.rb +++ b/spec/aliases/string_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -if Puppet.version.to_f >= 4.5 +if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 describe 'test::string', type: :class do describe 'accepts strings' do [ -- cgit v1.2.3 From da75bdfa7c067049b4be362fb2a6fad719e6fc3e Mon Sep 17 00:00:00 2001 From: Dominic Cleal Date: Tue, 21 Mar 2017 10:52:20 +0000 Subject: Update alias spec error message expectation for PUP-7371 The fix for PUP-7371 adds the missing `Undef` into the error message being tested in type aliases specs, fixing the following failure against Puppet's master branch: test::string rejects other values [] should fail to compile and raise an error matching /parameter 'value' expects a String/ Failure/Error: it { is_expected.to compile.and_raise_error(/parameter 'value' expects a String/) } error during compilation: Evaluation Error: Error while evaluating a Resource Statement, Class[Test::String]: parameter 'value' expects a value of type Undef or String, got Array at line 2:1 on node example # ./spec/aliases/string_spec.rb:27:in `block (5 levels) in ' --- spec/aliases/string_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/string_spec.rb') diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb index d8fb885..3ea1967 100644 --- a/spec/aliases/string_spec.rb +++ b/spec/aliases/string_spec.rb @@ -24,7 +24,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 ].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a String/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?String/) } end end end -- cgit v1.2.3 From 33922a4ec7a8c204a17e0c3017eea21faa220f39 Mon Sep 17 00:00:00 2001 From: tphoney Date: Fri, 14 Jul 2017 10:14:04 +0100 Subject: FM-6239 clean up for puppet 5.tests/deprecation --- spec/aliases/string_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/aliases/string_spec.rb') diff --git a/spec/aliases/string_spec.rb b/spec/aliases/string_spec.rb index 3ea1967..4fc8ce6 100644 --- a/spec/aliases/string_spec.rb +++ b/spec/aliases/string_spec.rb @@ -24,7 +24,7 @@ if Puppet::Util::Package.versioncmp(Puppet.version, '4.5.0') >= 0 ].each do |value| describe value.inspect do let(:params) {{ value: value }} - it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?String/) } + it { is_expected.to compile.and_raise_error(/parameter 'value' expects a (?:value of type Undef or )?.*String/) } end end end -- cgit v1.2.3