Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Teams often insists that you use the latest client and offers updates…
Browse files Browse the repository at this point in the history
… so I do that in the module to stop the users from seeing the messages. Wrong OS should fail.
  • Loading branch information
threepistons committed Jul 6, 2021
1 parent 6f0484c commit b9a98f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
}

~> package { 'teams':
ensure => installed,
ensure => latest,
require => Apt::Source['teams'],
}

}
default: {
notify { 'Unsupported architecture': }
fail('Teams only runs on AMD64, your architecture is unsupported.')
}
}
}
default: {
notify { 'Unsupported OS': }
fail('The Teams installer module only works with Debian derivatives, your distribution is unsupported.')
}
}
}
22 changes: 22 additions & 0 deletions spec/classes/teams_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,26 @@
it { is_expected.to contain_package('teams').with('require' => 'Apt::Source[teams]') }
end
end
context 'should fail on Pis' do
let(:facts) do
{
'os' => {
'architecture' => 'armv7l',
},
}
end

it { is_expected.not_to compile } # this is how to test for the 'fail' built-in function because 'fail' results in a compilation error
end # end of the Pi context
context 'should fail on RedHat-like OSes' do
let(:facts) do
{
'os' => {
'operatingsystem' => 'CentOS',
},
}
end

it { is_expected.not_to compile } # this is how to test for the 'fail' built-in function because 'fail' results in a compilation error
end # end of the Pi context
end

0 comments on commit b9a98f3

Please # to comment.