Skip to content

Commit 34a0fc0

Browse files
Merge pull request #1267 from puppetlabs/MODULES-11641
(MODULES-11641) Add support for ubuntu-24.04
2 parents 677b2b3 + b4a56d9 commit 34a0fc0

File tree

6 files changed

+155
-106
lines changed

6 files changed

+155
-106
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM puppet/pdk:latest
1+
FROM docker.io/puppet/pdk:latest
22

33
# [Optional] Uncomment this section to install additional packages.
44
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"operatingsystemrelease": [
2727
"18.04",
2828
"20.04",
29-
"22.04"
29+
"22.04",
30+
"24.04"
3031
]
3132
}
3233
],

provision.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ docker_ub_6:
1818
images:
1919
- litmusimage/ubuntu:18.04
2020
- litmusimage/ubuntu:20.04
21+
- litmusimage/ubuntu:22.04
22+
- litmusimage/ubuntu:24.04
2123
docker_el7:
2224
provisioner: docker
2325
images: []
@@ -28,10 +30,14 @@ release_checks_6:
2830
- debian-10-x86_64
2931
- ubuntu-1804-x86_64
3032
- ubuntu-2004-x86_64
33+
- ubuntu-2204-x86_64
34+
- ubuntu-2404-x86_64
3135
release_checks_7:
3236
provisioner: abs
3337
images:
3438
- debian-9-x86_64
3539
- debian-10-x86_64
3640
- ubuntu-1804-x86_64
3741
- ubuntu-2004-x86_64
42+
- ubuntu-2204-x86_64
43+
- ubuntu-2404-x86_64

spec/acceptance/apt_key_provider_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def apply_manifest_twice(manifest_pp)
732732
context 'with nonexistant.key.server' do
733733
it 'fails' do
734734
apply_manifest(nonexistant_key_server_pp, expect_failures: true) do |r|
735-
expect(r.stderr).to match(%r{(Host not found|Couldn't resolve host|No name)})
735+
expect(r.stderr).to match(%r{(Host not found|Couldn't resolve host|No name|No keyserver available)})
736736
end
737737
end
738738
end

spec/classes/apt_backports_spec.rb

Lines changed: 117 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,20 @@
55
describe 'apt::backports', type: :class do
66
let(:pre_condition) { 'include apt' }
77

8-
describe 'debian/ubuntu tests' do
9-
context 'with defaults on debian' do
10-
let(:facts) do
11-
{
12-
os: {
13-
family: 'Debian',
14-
name: 'Debian',
15-
release: {
16-
full: '12.5',
17-
major: '12',
18-
minor: '5'
19-
},
20-
distro: {
21-
codename: 'bookworm',
22-
id: 'Debian'
23-
}
24-
}
25-
}
26-
end
27-
28-
it {
29-
expect(subject).to contain_apt__source('backports').with(
30-
location: 'http://deb.debian.org/debian',
31-
repos: 'main contrib non-free non-free-firmware',
32-
release: 'bookworm-backports',
33-
pin: {
34-
'priority' => 200,
35-
'codename' => 'bookworm-backports'
36-
},
37-
keyring: '/usr/share/keyrings/debian-archive-keyring.gpg',
38-
)
39-
}
40-
end
41-
42-
context 'with defaults on ubuntu' do
8+
# Shared examples for Ubuntu tests
9+
shared_examples 'ubuntu backports' do |release_major, release_full, codename|
10+
context "with defaults on ubuntu #{release_major}" do
4311
let(:facts) do
4412
{
4513
os: {
4614
family: 'Debian',
4715
name: 'Ubuntu',
4816
release: {
49-
major: '22.04',
50-
full: '22.04'
17+
major: release_major,
18+
full: release_full
5119
},
5220
distro: {
53-
codename: 'jammy',
21+
codename:,
5422
id: 'Ubuntu'
5523
}
5624
}
@@ -61,28 +29,28 @@
6129
expect(subject).to contain_apt__source('backports').with(
6230
location: 'http://archive.ubuntu.com/ubuntu',
6331
repos: 'main universe multiverse restricted',
64-
release: 'jammy-backports',
32+
release: "#{codename}-backports",
6533
pin: {
6634
'priority' => 200,
67-
'release' => 'jammy-backports'
35+
'release' => "#{codename}-backports"
6836
},
6937
keyring: '/usr/share/keyrings/ubuntu-archive-keyring.gpg',
7038
)
7139
}
7240
end
7341

74-
context 'with everything set' do
42+
context "with everything set on ubuntu #{release_major}" do
7543
let(:facts) do
7644
{
7745
os: {
7846
family: 'Debian',
7947
name: 'Ubuntu',
8048
release: {
81-
major: '22.04',
82-
full: '22.04'
49+
major: release_major,
50+
full: release_full
8351
},
8452
distro: {
85-
codename: 'jammy',
53+
codename:,
8654
id: 'Ubuntu'
8755
}
8856
}
@@ -109,18 +77,18 @@
10977
}
11078
end
11179

112-
context 'when set things with hashes' do
80+
context "when set things with hashes on ubuntu #{release_major}" do
11381
let(:facts) do
11482
{
11583
os: {
11684
family: 'Debian',
11785
name: 'Ubuntu',
11886
release: {
119-
major: '22.04',
120-
full: '22.04'
87+
major: release_major,
88+
full: release_full
12189
},
12290
distro: {
123-
codename: 'jammy',
91+
codename:,
12492
id: 'Ubuntu'
12593
}
12694
}
@@ -146,82 +114,128 @@
146114
end
147115
end
148116

149-
describe 'validation' do
150-
let(:facts) do
151-
{
152-
os: {
153-
family: 'Debian',
154-
name: 'Ubuntu',
155-
release: {
156-
major: '22.04',
157-
full: '22.04'
158-
},
159-
distro: {
160-
codename: 'jammy',
161-
id: 'Ubuntu'
162-
}
163-
}
164-
}
165-
end
166-
167-
context 'with invalid location' do
168-
let(:params) do
117+
# Shared examples for validation tests
118+
shared_examples 'validation tests' do |release_major, release_full, codename|
119+
describe "validation on ubuntu #{release_major}" do
120+
let(:facts) do
169121
{
170-
location: true
122+
os: {
123+
family: 'Debian',
124+
name: 'Ubuntu',
125+
release: {
126+
major: release_major,
127+
full: release_full
128+
},
129+
distro: {
130+
codename:,
131+
id: 'Ubuntu'
132+
}
133+
}
171134
}
172135
end
173136

174-
it do
175-
expect(subject).to raise_error(Puppet::Error, %r{expects a})
176-
end
177-
end
137+
context 'with invalid location' do
138+
let(:params) do
139+
{
140+
location: true
141+
}
142+
end
178143

179-
context 'with invalid release' do
180-
let(:params) do
181-
{
182-
release: true
183-
}
144+
it do
145+
expect(subject).to raise_error(Puppet::Error, %r{expects a})
146+
end
184147
end
185148

186-
it do
187-
expect(subject).to raise_error(Puppet::Error, %r{expects a})
188-
end
189-
end
149+
context 'with invalid release' do
150+
let(:params) do
151+
{
152+
release: true
153+
}
154+
end
190155

191-
context 'with invalid repos' do
192-
let(:params) do
193-
{
194-
repos: true
195-
}
156+
it do
157+
expect(subject).to raise_error(Puppet::Error, %r{expects a})
158+
end
196159
end
197160

198-
it do
199-
expect(subject).to raise_error(Puppet::Error, %r{expects a})
161+
context 'with invalid repos' do
162+
let(:params) do
163+
{
164+
repos: true
165+
}
166+
end
167+
168+
it do
169+
expect(subject).to raise_error(Puppet::Error, %r{expects a})
170+
end
200171
end
201-
end
202172

203-
context 'with invalid key' do
204-
let(:params) do
205-
{
206-
key: true
207-
}
173+
context 'with invalid key' do
174+
let(:params) do
175+
{
176+
key: true
177+
}
178+
end
179+
180+
it do
181+
expect(subject).to raise_error(Puppet::Error, %r{expects a})
182+
end
208183
end
209184

210-
it do
211-
expect(subject).to raise_error(Puppet::Error, %r{expects a})
185+
context 'with invalid pin' do
186+
let(:params) do
187+
{
188+
pin: true
189+
}
190+
end
191+
192+
it do
193+
expect(subject).to raise_error(Puppet::Error, %r{expects a})
194+
end
212195
end
213196
end
197+
end
214198

215-
context 'with invalid pin' do
216-
let(:params) do
199+
describe 'debian/ubuntu tests' do
200+
context 'with defaults on debian' do
201+
let(:facts) do
217202
{
218-
pin: true
203+
os: {
204+
family: 'Debian',
205+
name: 'Debian',
206+
release: {
207+
full: '12.5',
208+
major: '12',
209+
minor: '5'
210+
},
211+
distro: {
212+
codename: 'bookworm',
213+
id: 'Debian'
214+
}
215+
}
219216
}
220217
end
221218

222-
it do
223-
expect(subject).to raise_error(Puppet::Error, %r{expects a})
224-
end
219+
it {
220+
expect(subject).to contain_apt__source('backports').with(
221+
location: 'http://deb.debian.org/debian',
222+
repos: 'main contrib non-free non-free-firmware',
223+
release: 'bookworm-backports',
224+
pin: {
225+
'priority' => 200,
226+
'codename' => 'bookworm-backports'
227+
},
228+
keyring: '/usr/share/keyrings/debian-archive-keyring.gpg',
229+
)
230+
}
225231
end
232+
233+
# Include shared examples for Ubuntu versions
234+
include_examples 'ubuntu backports', '22.04', '22.04', 'jammy'
235+
include_examples 'ubuntu backports', '24.04', '24.04', 'noble'
226236
end
237+
238+
# Include shared validation examples for Ubuntu versions
239+
include_examples 'validation tests', '22.04', '22.04', 'jammy'
240+
include_examples 'validation tests', '24.04', '24.04', 'noble'
227241
end

spec/classes/apt_spec.rb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,34 @@
370370
}
371371
}
372372
},
373+
'Ubuntu 22.04' => {
374+
os: {
375+
family: 'Debian',
376+
name: 'Ubuntu',
377+
release: {
378+
major: '22.04',
379+
full: '22.04'
380+
},
381+
distro: {
382+
codename: 'jammy',
383+
id: 'Ubuntu'
384+
}
385+
}
386+
},
387+
'Ubuntu 24.04' => {
388+
os: {
389+
family: 'Debian',
390+
name: 'Ubuntu',
391+
release: {
392+
major: '24.04',
393+
full: '24.04'
394+
},
395+
distro: {
396+
codename: 'noble',
397+
id: 'Ubuntu'
398+
}
399+
}
400+
},
373401
'Debian 9.0' => {
374402
os: {
375403
family: 'Debian',

0 commit comments

Comments
 (0)