@@ -43,55 +43,44 @@ def log_output_errors(result)
4343 # OS, you'll typically want to specify 'latest' to install from nightlies, since
4444 # official packages won't be released until later. During the N+1 release, you'll
4545 # want to change `target_platform` to be the first version (N) that added the OS.
46- puppet_6_version = case target_platform
46+ puppet_7_version = case target_platform
4747 when %r{debian-11}
48- '6.24 .0'
48+ '7.9 .0'
4949 when %r{el-9}
50- '6.26.0'
51- when %r{fedora-30}
52- '6.19.1'
53- when %r{fedora-31}
54- '6.20.0'
55- when %r{osx-10.14}
56- '6.18.0'
57- when %r{osx-10.15}
58- '6.15.0'
59- when %r{osx-11}
60- '6.23.0'
61- when %r{osx-12-x86_64}
62- '6.27.1'
63- when %r{osx-12-arm} , %r{ubuntu-22.04}
64- '6.28.0'
50+ '7.14.0'
6551 when %r{fedora-36}
66- 'latest'
52+ '7.19.0'
53+ when %r{osx-11}
54+ '7.7.0'
55+ when %r{osx-12} , %r{ubuntu-22.04}
56+ '7.18.0'
6757 else
68- '6.17 .0'
58+ '7.18 .0'
6959 end
7060
71- # platforms that only have nightly builds available. Once a platform
61+ # Platforms that only have nightly builds available. Once a platform
7262 # is released, it should be removed from this list.
73- case target_platform
74- when %r{fedora-36}
75- puppet_6_collection = 'puppet6-nightly'
76- puppet_7_collection = 'puppet7-nightly'
77- else
78- puppet_6_collection = 'puppet6'
79- puppet_7_collection = 'puppet7'
80- end
81-
82- # we can only tests puppet 6.x -> 6.y upgrades if there multiple versions
83- # Once there a platform has been released more than once, it can be removed
84- # from this list.
85- multiple_puppet6_versions = case target_platform
86- when %r{osx-12-arm}
87- false
88- when %r{ubuntu-22.04}
89- false
90- when %r{fedora-36}
91- false
92- else
93- true
94- end
63+ # case target_platform
64+ # when %r{fedora-36}
65+ # puppet_7_collection = 'puppet7-nightly'
66+ # puppet_8_collection = 'puppet8-nightly'
67+ # else
68+ puppet_7_collection = 'puppet7'
69+ # We currently only have nightly builds of puppet8 available. Update
70+ # this to the normal collection once we have a release.
71+ puppet_8_collection = 'puppet8-nightly'
72+ # end
73+
74+ # We can only test puppet 7 -> 7 upgrades if multiple Puppet releases
75+ # have supported a given platform. Once a platform has been supported
76+ # by multiple Puppet releases, it can be removed from this list.
77+ # multiple_puppet7_versions = case target_platform
78+ # when %r{osx-12-arm}
79+ # false
80+ # else
81+ # true
82+ # end
83+ multiple_puppet7_versions = true
9584
9685 # extra request is needed on windows hosts
9786 # this will fail with "execution expired"
@@ -104,9 +93,9 @@ def log_output_errors(result)
10493 expect ( res [ 'value' ] [ 'version' ] ) . to eq ( nil )
10594 end
10695
107- # Try to install an older puppet6 version
108- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_6_collection ,
109- 'version' => puppet_6_version ,
96+ # Try to install an older puppet7 version
97+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection ,
98+ 'version' => puppet_7_version ,
11099 'stop_service' => true } )
111100
112101 results . each do |result |
@@ -116,14 +105,14 @@ def log_output_errors(result)
116105
117106 expect ( results ) . to all ( include ( 'status' => 'success' ) )
118107
119- # It installed a version older than latest puppet6
108+ # It installed a version older than latest puppet7
120109 results = run_task ( 'puppet_agent::version' , 'target' , { } )
121110 results . each do |res |
122111 expect ( res ) . to include ( 'status' => 'success' )
123- if puppet_6_version == 'latest'
124- expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^6 \. \d +\. \d +} )
112+ if puppet_7_version == 'latest'
113+ expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^7 \. \d +\. \d +} )
125114 else
126- expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
115+ expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_7_version )
127116 end
128117 expect ( res [ 'value' ] [ 'source' ] ) . to be
129118 end
@@ -139,7 +128,7 @@ def log_output_errors(result)
139128
140129 # Try to upgrade with no specific version given in parameter
141130 # Expect nothing to happen and receive a message regarding this
142- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_6_collection } )
131+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection } )
143132
144133 results . each do |result |
145134 logger . info ( "Ensuring installed puppet-agent on #{ result [ 'target' ] } : #{ result [ 'status' ] } " )
@@ -155,23 +144,23 @@ def log_output_errors(result)
155144 results = run_task ( 'puppet_agent::version' , 'target' , { } )
156145 results . each do |res |
157146 expect ( res ) . to include ( 'status' => 'success' )
158- if puppet_6_version == 'latest'
159- expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^6 \. \d +\. \d +} )
147+ if puppet_7_version == 'latest'
148+ expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^7 \. \d +\. \d +} )
160149 else
161- expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_6_version )
150+ expect ( res [ 'value' ] [ 'version' ] ) . to eq ( puppet_7_version )
162151 end
163152 expect ( res [ 'value' ] [ 'source' ] ) . to be
164153 end
165154
166- # An OS needs to be supported for more than one 6 .x release to test the
167- # upgrade from puppet_6_version to latest
168- if multiple_puppet6_versions
155+ # An OS needs to be supported for more than one 7 .x release to test the
156+ # upgrade from puppet_7_version to latest
157+ if multiple_puppet7_versions
169158
170- # Upgrade to latest puppet6 version
171- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet6 ' , 'version' => 'latest' } )
159+ # Upgrade to latest puppet7 version
160+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => 'puppet7 ' , 'version' => 'latest' } )
172161
173162 results . each do |result |
174- logger . info ( "Upgraded puppet-agent to latest puppet6 on #{ result [ 'target' ] } : #{ result [ 'status' ] } " )
163+ logger . info ( "Upgraded puppet-agent to latest puppet7 on #{ result [ 'target' ] } : #{ result [ 'status' ] } " )
175164 log_output_errors ( result )
176165 end
177166
@@ -181,8 +170,8 @@ def log_output_errors(result)
181170 results = run_task ( 'puppet_agent::version' , 'target' , { } )
182171 results . each do |res |
183172 expect ( res ) . to include ( 'status' => 'success' )
184- expect ( res [ 'value' ] [ 'version' ] ) . not_to eq ( puppet_6_version )
185- expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^6 \. \d +\. \d +} )
173+ expect ( res [ 'value' ] [ 'version' ] ) . not_to eq ( puppet_7_version )
174+ expect ( res [ 'value' ] [ 'version' ] ) . to match ( %r{^7 \. \d +\. \d +} )
186175 expect ( res [ 'value' ] [ 'source' ] ) . to be
187176 end
188177 end
@@ -202,30 +191,46 @@ def log_output_errors(result)
202191 expect ( output ) . to match ( %r{ensure\s +=> 'stopped'} )
203192 end
204193
205- # Succesfully upgrade from puppet6 to puppet7
206- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection , 'version' => 'latest' } )
194+ # Succesfully upgrade from puppet7 to puppet8
195+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_8_collection , 'version' => 'latest' } )
207196
208197 results . each do |result |
209- logger . info ( "Upgraded puppet-agent to puppet7 on #{ result [ 'target' ] } : #{ result [ 'status' ] } " )
198+ logger . info ( "Upgraded puppet-agent to puppet8 on #{ result [ 'target' ] } : #{ result [ 'status' ] } " )
210199 log_output_errors ( result )
211200 end
212201
213202 expect ( results ) . to all ( include ( 'status' => 'success' ) )
214203
215204 # Verify that it upgraded
216205 installed_version = nil
217- results = run_task ( 'puppet_agent::version' , 'target' , { } )
206+ # With prerelease puppet8, the puppet_agent::version task returns the wrong
207+ # output. To temporarily work around this, we'll run puppet --version.
208+ # Revert this change once Puppet 8.0.0 has been released.
209+ # results = run_task('puppet_agent::version', 'target', {})
210+ results = if %r{win} . match? ( target_platform )
211+ run_command ( 'c:/"program files"/"puppet labs"/puppet/bin/puppet --version' , 'target' )
212+ else
213+ run_command ( '/opt/puppetlabs/bin/puppet --version' , 'target' )
214+ end
218215 results . each do |res |
219216 expect ( res ) . to include ( 'status' => 'success' )
217+ installed_version = res [ 'value' ] [ 'stdout' ]
218+ expect ( installed_version ) . not_to match ( %r{^7\. \d +\. \d +} )
219+ expect ( installed_version ) . to match ( %r{^8\. \d +\. \d +} )
220+ # We don't get the expected output with prerelease puppet8
221+ # expect(res['value']['source']).to be
222+ end
223+
224+ # More prerelease puppet8 workarounds, this block can also be deleted
225+ # once Puppet 8.0.0 has been released.
226+ results = run_task ( 'puppet_agent::version' , 'target' , { } )
227+ results . each do |res |
220228 installed_version = res [ 'value' ] [ 'version' ]
221- expect ( installed_version ) . not_to match ( %r{^6\. \d +\. \d +} )
222- expect ( installed_version ) . to match ( %r{^7\. \d +\. \d +} )
223- expect ( res [ 'value' ] [ 'source' ] ) . to be
224229 end
225230
226231 # Try installing the same version again
227232 # Expect nothing to happen and receive a message regarding this
228- results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_7_collection , 'version' => installed_version } )
233+ results = run_task ( 'puppet_agent::install' , 'target' , { 'collection' => puppet_8_collection , 'version' => installed_version } )
229234
230235 results . each do |res |
231236 expect ( res ) . to include ( 'status' => 'success' )
0 commit comments