Fix unit tests broken since Debian version bump

Now Bookworm is supported instead of Bullseye.

The hard-coded name is replaced by a fact value so that we don't have
to update the value every time when we update the supported version.

Change-Id: Ide9e4a9531f7aab2746722dbf9bc76fdf26345c7
This commit is contained in:
Takashi Kajinami 2023-12-10 23:57:14 +09:00
parent 65ce98e870
commit 510fa59002
2 changed files with 78 additions and 76 deletions

View File

@ -58,14 +58,14 @@ apt-get update
end end
it { should contain_apt__source('debian-openstack-backports').with( it { should contain_apt__source('debian-openstack-backports').with(
:location => 'http://bullseye-bobcat.debian.net/debian', :location => "http://#{facts[:os]['distro']['codename']}-bobcat.debian.net/debian",
:release => 'bullseye-bobcat-backports', :release => "#{facts[:os]['distro']['codename']}-bobcat-backports",
:repos => 'main', :repos => 'main',
)} )}
it { should contain_apt__source('debian-openstack-backports-nochange').with( it { should contain_apt__source('debian-openstack-backports-nochange').with(
:location => 'http://bullseye-bobcat.debian.net/debian', :location => "http://#{facts[:os]['distro']['codename']}-bobcat.debian.net/debian",
:release => 'bullseye-bobcat-backports-nochange', :release => "#{facts[:os]['distro']['codename']}-bobcat-backports-nochange",
:repos => 'main' :repos => 'main'
)} )}
@ -78,21 +78,21 @@ apt-get update
end end
it { should contain_apt__source('debian-openstack-backports').with( it { should contain_apt__source('debian-openstack-backports').with(
:location => 'http://bullseye-pike.debian.net/debian', :location => "http://#{facts[:os]['distro']['codename']}-pike.debian.net/debian",
:release => 'bullseye-pike-backports', :release => "#{facts[:os]['distro']['codename']}-pike-backports",
:repos => 'main', :repos => 'main',
)} )}
it { should contain_apt__source('debian-openstack-backports-nochange').with( it { should contain_apt__source('debian-openstack-backports-nochange').with(
:location => 'http://bullseye-pike.debian.net/debian', :location => "http://#{facts[:os]['distro']['codename']}-pike.debian.net/debian",
:release => 'bullseye-pike-backports-nochange', :release => "#{facts[:os]['distro']['codename']}-pike-backports-nochange",
:repos => 'main' :repos => 'main'
)} )}
it { should contain_exec('installing openstack-backports-archive-keyring') } it { should contain_exec('installing openstack-backports-archive-keyring') }
end end
context 'when not managing bullseye repo' do context 'when not managing openstack repo' do
let :params do let :params do
default_params.merge!({ :manage_deb => false }) default_params.merge!({ :manage_deb => false })
end end
@ -102,23 +102,22 @@ apt-get update
context 'with overridden source hash' do context 'with overridden source hash' do
let :params do let :params do
default_params.merge!({ :source_hash => { default_params.merge!({
'debian_unstable' => { :source_hash => {
'location' => 'http://mymirror/debian/', 'debian_unstable' => {
'repos' => 'main', 'location' => 'http://mymirror/debian/',
'release' => 'unstable' 'repos' => 'main',
}, 'release' => 'unstable'
'puppetlabs' => { },
'location' => 'http://apt.puppetlabs.com', 'puppetlabs' => {
'repos' => 'main', 'location' => 'http://apt.puppetlabs.com',
'release' => 'bullseye', 'repos' => 'main',
'key' => { 'release' => facts[:os]['distro']['codename'],
'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' 'key' => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' }
} }
} },
} :use_extrepo => false
}) })
default_params.merge!({ :use_extrepo => false })
end end
it { should contain_apt__source('debian_unstable').with( it { should contain_apt__source('debian_unstable').with(
@ -130,7 +129,7 @@ apt-get update
it { should contain_apt__source('puppetlabs').with( it { should contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com', :location => 'http://apt.puppetlabs.com',
:repos => 'main', :repos => 'main',
:release => 'bullseye', :release => facts[:os]['distro']['codename'],
:key => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' }, :key => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' },
)} )}
@ -139,19 +138,19 @@ apt-get update
context 'with overridden source default' do context 'with overridden source default' do
let :params do let :params do
default_params.merge!({ :source_hash => { default_params.merge!({
'debian_unstable' => { :source_hash => {
'location' => 'http://mymirror/debian/', 'debian_unstable' => {
'repos' => 'main', 'location' => 'http://mymirror/debian/',
'release' => 'unstable' 'repos' => 'main',
}, 'release' => 'unstable'
} },
}) },
default_params.merge!({ :source_defaults => { :source_defaults => {
'include' => { 'src' => true } 'include' => { 'src' => true }
} },
}) :use_extrepo => false
default_params.merge!({ :use_extrepo => false }) })
end end
it { should contain_apt__source('debian_unstable').with( it { should contain_apt__source('debian_unstable').with(

View File

@ -28,7 +28,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
it { should contain_apt__source('ubuntu-cloud-archive').with( it { should contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
:release => 'jammy-updates/bobcat', :release => "#{facts[:os]['distro']['codename']}-updates/bobcat",
:repos => 'main', :repos => 'main',
)} )}
@ -42,7 +42,7 @@ describe 'openstack_extras::repo::debian::ubuntu' do
it { should contain_apt__source('ubuntu-cloud-archive').with( it { should contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu', :location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
:release => 'jammy-updates/juno', :release => "#{facts[:os]['distro']['codename']}-updates/juno",
:repos => 'main', :repos => 'main',
)} )}
@ -59,33 +59,34 @@ describe 'openstack_extras::repo::debian::ubuntu' do
context 'with overridden source hash' do context 'with overridden source hash' do
let :params do let :params do
default_params.merge!({ :source_hash => { default_params.merge!({
'local_mirror' => { :source_hash => {
'location' => 'http://mymirror/ubuntu/', 'local_mirror' => {
'repos' => 'main', 'location' => 'http://mymirror/ubuntu/',
'release' => 'jammy' 'repos' => 'main',
}, 'release' => facts[:os]['distro']['codename'],
'puppetlabs' => { },
'location' => 'http://apt.puppetlabs.com', 'puppetlabs' => {
'repos' => 'main', 'location' => 'http://apt.puppetlabs.com',
'release' => 'jammy', 'repos' => 'main',
'key' => { 'release' => facts[:os]['distro']['codename'],
'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' 'key' => {
} 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu'
} }
} }
}) }
})
end end
it { should contain_apt__source('local_mirror').with( it { should contain_apt__source('local_mirror').with(
:location => 'http://mymirror/ubuntu/', :location => 'http://mymirror/ubuntu/',
:release => 'jammy', :release => facts[:os]['distro']['codename'],
:repos => 'main' :repos => 'main'
)} )}
it { should contain_apt__source('puppetlabs').with( it { should contain_apt__source('puppetlabs').with(
:location => 'http://apt.puppetlabs.com', :location => 'http://apt.puppetlabs.com',
:release => 'jammy', :release => facts[:os]['distro']['codename'],
:repos => 'main', :repos => 'main',
:key => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' } :key => { 'id' => '4BD6EC30', 'server' => 'pgp.mit.edu' }
)} )}
@ -95,24 +96,24 @@ describe 'openstack_extras::repo::debian::ubuntu' do
context 'with overridden source default' do context 'with overridden source default' do
let :params do let :params do
default_params.merge!({ :source_hash => { default_params.merge!({
'local_mirror' => { :source_hash => {
'location' => 'http://mymirror/ubuntu/', 'local_mirror' => {
'repos' => 'main', 'location' => 'http://mymirror/ubuntu/',
'release' => 'jammy' 'repos' => 'main',
} 'release' => facts[:os]['distro']['codename']
} }
}) },
default_params.merge!({ :source_defaults => { :source_defaults => {
'include' => { 'src' => true } 'include' => { 'src' => true }
} }
}) })
end end
it { should contain_apt__source('local_mirror').with( it { should contain_apt__source('local_mirror').with(
:include => { 'src' => true }, :include => { 'src' => true },
:location => 'http://mymirror/ubuntu/', :location => 'http://mymirror/ubuntu/',
:release => 'jammy', :release => facts[:os]['distro']['codename'],
:repos => 'main', :repos => 'main',
)} )}
@ -121,13 +122,15 @@ describe 'openstack_extras::repo::debian::ubuntu' do
context 'with overridden uca repo name' do context 'with overridden uca repo name' do
let :params do let :params do
default_params.merge!({ :repo => 'proposed', default_params.merge!({
:uca_location => 'http://mirror.dfw.rax.openstack.org/ubuntu-cloud-archive' }) :repo => 'proposed',
:uca_location => 'http://mirror.dfw.rax.openstack.org/ubuntu-cloud-archive'
})
end end
it { should contain_apt__source('ubuntu-cloud-archive').with( it { should contain_apt__source('ubuntu-cloud-archive').with(
:location => 'http://mirror.dfw.rax.openstack.org/ubuntu-cloud-archive', :location => 'http://mirror.dfw.rax.openstack.org/ubuntu-cloud-archive',
:release => 'jammy-proposed/bobcat', :release => "#{facts[:os]['distro']['codename']}-proposed/bobcat",
:repos => 'main', :repos => 'main',
)} )}
end end