File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ # @return [Boolean] true if the version is supported, raise error otherwise
2+ # @param [String] the version number to check
13function peadm::validate_version(
24 String $version ,
3- ) {
5+ ) >> Boolean {
46 $supported = ($version =~ SemVerRange(' >= 2019.7.0 <= 2019.9.0' ))
57
68 unless $supported {
@@ -15,4 +17,5 @@ function peadm::validate_version(
1517
1618 | REASON
1719 }
20+ $supported
1821}
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+ require 'spec_helper'
3+
4+ describe 'peadm::validate_version' do
5+ it '2020.3.0' do
6+ is_expected . to run . with_params ( '2020.3.0' ) . and_raise_error ( Puppet ::ParseError , /This\ version\ of\ the/ )
7+ end
8+
9+ it '2019.9.0' do
10+ is_expected . to run . with_params ( '2019.9.0' ) . and_return ( true )
11+ end
12+
13+ it '2019.8.4' do
14+ is_expected . to run . with_params ( '2019.8.4' ) . and_return ( true )
15+ end
16+
17+ it '2019.8.0' do
18+ is_expected . to run . with_params ( '2019.8.0' ) . and_return ( true )
19+ end
20+
21+ it '2019.7.1' do
22+ is_expected . to run . with_params ( '2019.7.1' ) . and_return ( true )
23+ end
24+
25+ it '2018.1' do
26+ is_expected . to run . with_params ( '2018.1' ) . and_raise_error ( Puppet ::ParseError , /This\ version\ of\ the/ )
27+ end
28+ end
You can’t perform that action at this time.
0 commit comments