@@ -52,14 +52,28 @@ def target_platform
5252 '6.23.0'
5353 when %r{osx-12}
5454 '6.27.1'
55+ when %r{ubuntu-22.04}
56+ 'latest'
5557 else
5658 '6.17.0'
5759 end
5860
61+ # platforms that only have nightly builds available
62+ case target_platform
63+ when %r{ubuntu-22.04}
64+ puppet_6_collection = 'puppet6-nightly'
65+ puppet_7_collection = 'puppet7-nightly'
66+ else
67+ puppet_6_collection = 'puppet6'
68+ puppet_7_collection = 'puppet7'
69+ end
70+
5971 # we can only tests puppet 6.x -> 6.y upgrades if there multiple versions
6072 multiple_puppet6_versions = case target_platform
6173 when %r{osx-12}
6274 false
75+ when %r{ubuntu-22.04}
76+ false
6377 else
6478 true
6579 end
@@ -76,22 +90,21 @@ def target_platform
7690 end
7791
7892 # Try to install an older puppet6 version
79- results = if %r{ubuntu-22.04} . match? ( target_platform )
80- run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet6-nightly' ,
81- 'version' => puppet_6_version ,
82- 'stop_service' => true } )
83- else
84- run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet6' ,
85- 'version' => puppet_6_version ,
86- 'stop_service' => true } )
87- end
93+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_6_collection ,
94+ 'version' => puppet_6_version ,
95+ 'stop_service' => true } )
96+
8897 expect ( results ) . to all ( include ( 'status' => 'success' ) )
8998
9099 # It installed a version older than latest puppet6
91100 results = run_task ( 'puppet_agent::version' , 'target' , { } )
92101 results . each do |res |
93102 expect ( res ) . to include ( 'status' => 'success' )
94- expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
103+ if puppet_6_version == 'latest'
104+ expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^6\. \d +\. \d +} )
105+ else
106+ expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
107+ end
95108 expect ( res [ 'value' ] [ 'source' ] ) . to be
96109 end
97110
@@ -106,7 +119,8 @@ def target_platform
106119
107120 # Try to upgrade with no specific version given in parameter
108121 # Expect nothing to happen and receive a message regarding this
109- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet6' } )
122+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_6_collection } )
123+
110124 results . each do |res |
111125 expect ( res ) . to include ( 'status' => 'success' )
112126 expect ( res [ 'value' ] [ '_output' ] ) . to match ( %r{Version parameter not defined and agent detected. Nothing to do.} )
@@ -116,7 +130,11 @@ def target_platform
116130 results = run_task ( 'puppet_agent::version' , 'target' , { } )
117131 results . each do |res |
118132 expect ( res ) . to include ( 'status' => 'success' )
119- expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
133+ if puppet_6_version == 'latest'
134+ expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^6\. \d +\. \d +} )
135+ else
136+ expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
137+ end
120138 expect ( res [ 'value' ] [ 'source' ] ) . to be
121139 end
122140
@@ -154,7 +172,7 @@ def target_platform
154172 end
155173
156174 # Succesfully upgrade from puppet6 to puppet7
157- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet7' , 'version' => 'latest' } )
175+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection , 'version' => 'latest' } )
158176 expect ( results ) . to all ( include ( 'status' => 'success' ) )
159177
160178 # Verify that it upgraded
@@ -170,7 +188,8 @@ def target_platform
170188
171189 # Try installing the same version again
172190 # Expect nothing to happen and receive a message regarding this
173- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet7' , 'version' => installed_version } )
191+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection , 'version' => installed_version } )
192+
174193 results . each do |res |
175194 expect ( res ) . to include ( 'status' => 'success' )
176195 expect ( res [ 'value' ] [ '_output' ] ) . to match ( %r{Puppet Agent #{ installed_version } detected. Nothing to do.} )
0 commit comments