Code Review
/
puppet-modules
/
puppetlabs-apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge pull request #1079 from puppetlabs/bugfix-bump_minimum_puppet_version
[puppet-modules/puppetlabs-apt.git]
/
spec
/
classes
/
apt_backports_spec.rb
diff --git
a/spec/classes/apt_backports_spec.rb
b/spec/classes/apt_backports_spec.rb
index 052883166cd1d48c3dd4239258bc83ecaddfe493..6f6d5309217c2129edd665dd24fdbae098fa80c5 100644
(file)
--- a/
spec/classes/apt_backports_spec.rb
+++ b/
spec/classes/apt_backports_spec.rb
@@
-1,37
+1,51
@@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'apt::backports', type: :class do
require 'spec_helper'
describe 'apt::backports', type: :class do
- let
(:pre_condition) { "class{ '::apt': }" }
+ let(:pre_condition) { "class{ '::apt': }" }
describe 'debian/ubuntu tests' do
describe 'debian/ubuntu tests' do
- context 'defaults on deb' do
+ context '
with
defaults on deb' do
let(:facts) do
{
let(:facts) do
{
- os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
- lsbdistid: 'Debian',
- osfamily: 'Debian',
- lsbdistcodename: 'wheezy',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'Debian',
+ release: {
+ major: '9',
+ full: '9.0',
+ },
+ distro: {
+ codename: 'stretch',
+ id: 'Debian',
+ },
+ },
}
end
it {
is_expected.to contain_apt__source('backports').with(location: 'http://deb.debian.org/debian',
}
end
it {
is_expected.to contain_apt__source('backports').with(location: 'http://deb.debian.org/debian',
- key: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
repos: 'main contrib non-free',
repos: 'main contrib non-free',
- release: '
wheezy
-backports',
- pin: { 'priority' => 200, 'release' => '
wheezy
-backports' })
+ release: '
stretch
-backports',
+ pin: { 'priority' => 200, 'release' => '
stretch
-backports' })
}
end
}
end
- context 'defaults on ubuntu' do
+ context '
with
defaults on ubuntu' do
let(:facts) do
{
let(:facts) do
{
- os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
- lsbdistid: 'Ubuntu',
- osfamily: 'Debian',
- lsbdistcodename: 'trusty',
- lsbdistrelease: '14.04',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'Ubuntu',
+ release: {
+ major: '18',
+ full: '18.04',
+ },
+ distro: {
+ codename: 'bionac',
+ id: 'Ubuntu',
+ },
+ },
}
end
}
end
@@
-39,19
+53,25
@@
describe 'apt::backports', type: :class do
is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
repos: 'main universe multiverse restricted',
is_expected.to contain_apt__source('backports').with(location: 'http://archive.ubuntu.com/ubuntu',
key: '630239CC130E1A7FD81A27B140976EAF437D05B5',
repos: 'main universe multiverse restricted',
- release: '
trusty
-backports',
- pin: { 'priority' => 200, 'release' => '
trusty
-backports' })
+ release: '
bionac
-backports',
+ pin: { 'priority' => 200, 'release' => '
bionac
-backports' })
}
end
}
end
- context '
set everything
' do
+ context '
with everything set
' do
let(:facts) do
{
let(:facts) do
{
- os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
- lsbdistid: 'Ubuntu',
- osfamily: 'Debian',
- lsbdistcodename: 'trusty',
- lsbdistrelease: '14.04',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'Ubuntu',
+ release: {
+ major: '18',
+ full: '18.04',
+ },
+ distro: {
+ codename: 'bionac',
+ id: 'Ubuntu',
+ },
+ },
}
end
let(:params) do
}
end
let(:params) do
@@
-72,15
+92,21
@@
describe 'apt::backports', type: :class do
pin: { 'priority' => 90, 'release' => 'vivid' })
}
end
pin: { 'priority' => 90, 'release' => 'vivid' })
}
end
- context 'set things with hashes' do
+ context '
when
set things with hashes' do
let(:facts) do
{
let(:facts) do
{
- os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
- lsbdistid: 'Ubuntu',
- osfamily: 'Debian',
- lsbdistcodename: 'trusty',
- lsbdistrelease: '14.04',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'Ubuntu',
+ release: {
+ major: '18',
+ full: '18.04',
+ },
+ distro: {
+ codename: 'bionac',
+ id: 'Ubuntu',
+ },
+ },
}
end
let(:params) do
}
end
let(:params) do
@@
-103,15
+129,22
@@
describe 'apt::backports', type: :class do
describe 'mint tests' do
let(:facts) do
{
describe 'mint tests' do
let(:facts) do
{
- os: { family: 'Debian', name: 'Linuxmint', release: { major: '17', full: '17' } },
- lsbdistid: 'linuxmint',
- osfamily: 'Debian',
- lsbdistcodename: 'qiana',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'LinuxMint',
+ release: {
+ major: '17',
+ full: '17',
+ },
+ distro: {
+ codename: 'qiana',
+ id: 'LinuxMint',
+ },
+ },
}
end
}
end
- context '
sets all the needed things
' do
+ context '
with all the needed things set
' do
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
@@
-129,7
+162,7
@@
describe 'apt::backports', type: :class do
pin: { 'priority' => 200, 'release' => 'trusty-backports' })
}
end
pin: { 'priority' => 200, 'release' => 'trusty-backports' })
}
end
- context 'missing location' do
+ context '
with
missing location' do
let(:params) do
{
release: 'trusty-backports',
let(:params) do
{
release: 'trusty-backports',
@@
-139,12
+172,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
+ is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
end
end
- context 'missing release' do
+ context '
with
missing release' do
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
@@
-154,12
+185,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
+ is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
end
end
- context 'missing repos' do
+ context '
with
missing repos' do
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
@@
-169,12
+198,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
+ is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
end
end
- context 'missing key' do
+ context '
with
missing key' do
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
let(:params) do
{
location: 'http://archive.ubuntu.com/ubuntu',
@@
-184,25
+211,29
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
+ is_expected.to raise_error(Puppet::Error, %r{If not on Debian or Ubuntu, you must explicitly pass location, release, repos, and key})
end
end
end
describe 'validation' do
let(:facts) do
{
end
end
end
describe 'validation' do
let(:facts) do
{
- os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
- lsbdistid: 'Ubuntu',
- osfamily: 'Debian',
- lsbdistcodename: 'trusty',
- lsbdistrelease: '14.04',
- puppetversion: Puppet.version,
+ os: {
+ family: 'Debian',
+ name: 'Ubuntu',
+ release: {
+ major: '18',
+ full: '18.04',
+ },
+ distro: {
+ codename: 'bionac',
+ id: 'Ubuntu',
+ },
+ },
}
end
}
end
- context 'invalid location' do
+ context '
with
invalid location' do
let(:params) do
{
location: true,
let(:params) do
{
location: true,
@@
-210,12
+241,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{expects a})
+ is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
end
- context 'invalid release' do
+ context '
with
invalid release' do
let(:params) do
{
release: true,
let(:params) do
{
release: true,
@@
-223,12
+252,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{expects a})
+ is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
end
- context 'invalid repos' do
+ context '
with
invalid repos' do
let(:params) do
{
repos: true,
let(:params) do
{
repos: true,
@@
-236,12
+263,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{expects a})
+ is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
end
- context 'invalid key' do
+ context '
with
invalid key' do
let(:params) do
{
key: true,
let(:params) do
{
key: true,
@@
-249,12
+274,10
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{expects a})
+ is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
end
- context 'invalid pin' do
+ context '
with
invalid pin' do
let(:params) do
{
pin: true,
let(:params) do
{
pin: true,
@@
-262,9
+285,7
@@
describe 'apt::backports', type: :class do
end
it do
end
it do
- expect {
- subject.call
- }.to raise_error(Puppet::Error, %r{expects a})
+ is_expected.to raise_error(Puppet::Error, %r{expects a})
end
end
end
end
end
end