Skip to content

Commit

Permalink
Fix issues with tests
Browse files Browse the repository at this point in the history
* Leftover legacy formats in tests removed.
* A typo in the ESM repositories fixed.
* Use correct test specs.
  • Loading branch information
towo committed Nov 3, 2021
1 parent 2d03650 commit aea305f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 40 deletions.
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$origins = [
'origin=${distro_id},suite=${distro_codename}', #lint:ignore:single_quote_string_with_variables
'origin=${distro_id},suite=${distro_codename}-security', #lint:ignore:single_quote_string_with_variables
'origin=${distro_id},suite=${distro_codename}-apps-security', #lint:ignore:single_quote_string_with_variables
'origin=${distro_id}ESMApps,suite=${distro_codename}-apps-security', #lint:ignore:single_quote_string_with_variables
'origin=${distro_id}ESM,suite=${distro_codename}-infra-security', #lint:ignore:single_quote_string_with_variables
]
}
Expand Down
10 changes: 5 additions & 5 deletions spec/classes/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
when 'Ubuntu'
it do
is_expected.to create_file(file_unattended).with_content(
/Unattended-Upgrade::Allowed-Origins\ {\n
\t"\${distro_id}\:\${distro_codename}";\n
\t"\${distro_id}\:\${distro_codename}-security";\n
\t"\${distro_id}ESMApps\:\${distro_codename}-apps-security";\n
\t"\${distro_id}ESM\:\${distro_codename}-infra-security";\n
/Unattended-Upgrade::Origins-Pattern\ {\n
\t"origin=\${distro_id},suite=\${distro_codename}";\n
\t"origin=\${distro_id},suite=\${distro_codename}-security";\n
\t"origin=\${distro_id}ESMApps,suite=\${distro_codename}-apps-security";\n
\t"origin=\${distro_id}ESM,suite=\${distro_codename}-infra-security";\n
};/x
)
end
Expand Down
31 changes: 0 additions & 31 deletions spec/classes/other_debians_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,4 @@
)
end
end

context 'with defaults on Linux Mint 18 Sarah' do
let(:facts) do
{
os: {
name: 'LinuxMint',
family: 'Debian',
release: {
full: '18'
}
},
osfamily: 'Debian',
lsbdistid: 'LinuxMint',
lsbdistcodename: 'sarah',
lsbdistrelease: '18',
lsbmajdistrelease: '18'
}
end

it do
is_expected.to create_file(file_unattended).with(
'owner' => 'root',
'group' => 'root'
).with_content(
# This is the only section that's different for Ubuntu compared to Debian
%r{\Unattended-Upgrade::Allowed-Origins\ {\n
\t"Ubuntu\:xenial-security";\n
};}x
)
end
end
end
4 changes: 2 additions & 2 deletions spec/classes/unattended_upgrades_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'reboot_time' => '03:00'
},
verbose: 1,
origins: %w[bananas],
origins: %w[codename=bananas],
blacklist: %w[foo bar],
whitelist: %w[foo bar],
minimal_steps: false,
Expand Down Expand Up @@ -118,7 +118,7 @@
owner: 'root',
group: 'root'
).with_content(
/Unattended-Upgrade::Allowed-Origins {\n\t"bananas";\n};/
/Unattended-Upgrade::Origins-Pattern {\n\t"codename=bananas";\n};/
).with_content(
/Unattended-Upgrade::Package-Blacklist {\n\t"foo";\n\t"bar";\n};/
).with_content(
Expand Down
2 changes: 1 addition & 1 deletion types/origin.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
type Unattended_upgrades::Origin = Pattern[/^(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+(,?(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+)*/]
type Unattended_upgrades::Origin = Pattern[/^(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+(,(origin|codename|label|site|suite|component|archive|[oalcn])=[^,]+)*/]

0 comments on commit aea305f

Please sign in to comment.