Add rake test and rspec for aegir::hostmaster
This commit is contained in:
parent
f3ef1c7be3
commit
55b530f564
|
@ -0,0 +1,10 @@
|
|||
fixtures:
|
||||
symlinks:
|
||||
"aegir": "#{source_dir}"
|
||||
forge_modules:
|
||||
"apt":
|
||||
repo: "puppetlabs/apt"
|
||||
ref: "4.5.1"
|
||||
"stdlib":
|
||||
repo: "puppetlabs/stdlib"
|
||||
ref: "4.16.0"
|
|
@ -0,0 +1 @@
|
|||
spec/fixtures
|
|
@ -0,0 +1,23 @@
|
|||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
|
||||
defaults = [:validate, :spec]
|
||||
begin
|
||||
if Gem::Specification::find_by_name('metadata-json-lint')
|
||||
defaults = defaults.insert(0, :metadata_lint)
|
||||
end
|
||||
if Gem::Specification::find_by_name('puppet-lint')
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
exclude_paths = [
|
||||
'bundle/**/*',
|
||||
'pkg/**/*',
|
||||
'vendor/**/*',
|
||||
'spec/**/*'
|
||||
]
|
||||
Rake::Task[:lint].clear
|
||||
PuppetLint::RakeTask.new :lint do |config|
|
||||
config.ignore_paths = exclude_paths
|
||||
end
|
||||
defaults = defaults.insert(-2, :lint)
|
||||
end
|
||||
end
|
||||
task :test => defaults
|
|
@ -0,0 +1,65 @@
|
|||
require 'spec_helper'
|
||||
describe 'aegir::hostmaster' do
|
||||
let(:title) { 'aegir' }
|
||||
let(:params) {
|
||||
{ 'database' =>
|
||||
{ 'host' => 'localhost',
|
||||
'user' => 'aegir_root',
|
||||
'password' => 'password' },
|
||||
'manage_sources' => false
|
||||
}
|
||||
}
|
||||
# Need to fill out a fair amounts of facts for the apt module.
|
||||
let(:facts) {
|
||||
{
|
||||
:operatingsystem => 'Debian',
|
||||
:osfamily => 'Debian',
|
||||
:os => {
|
||||
'name' => 'Debian',
|
||||
'lsb' => {
|
||||
'distcodename' => 'stretch'
|
||||
},
|
||||
'release' => {
|
||||
'full' => '',
|
||||
'major' => '9'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
it do
|
||||
is_expected.to contain_file('/var/lib/dpkg/aegir.response')
|
||||
is_expected.to contain_package('aegir').with(
|
||||
'ensure' => 'present',
|
||||
'name' => 'aegir3'
|
||||
)
|
||||
end
|
||||
|
||||
context 'with manage_sources => true' do
|
||||
let(:params) {
|
||||
{ 'database' =>
|
||||
{'host' => 'localhost',
|
||||
'user' => 'aegir_root',
|
||||
'password' => 'password' },
|
||||
'manage_sources' => true
|
||||
}
|
||||
}
|
||||
it { is_expected.to contain_class('aegir::source') }
|
||||
end
|
||||
|
||||
context 'with server => nginx' do
|
||||
let(:params) {
|
||||
{ 'database' =>
|
||||
{ 'host' => 'localhost',
|
||||
'user' => 'aegir_root',
|
||||
'password' => 'password' },
|
||||
'manage_sources' => false,
|
||||
'server' => 'nginx'
|
||||
}
|
||||
}
|
||||
it do
|
||||
is_expected.to contain_package('nginx').with_ensure('present')
|
||||
is_expected.to contain_package('php7.0-fpm').with_ensure('present')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'rspec-puppet'
|
||||
|
||||
fixture_path = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures')
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.module_path = File.join(fixture_path, 'modules')
|
||||
c.manifest_dir = File.join(fixture_path, 'manifests')
|
||||
c.manifest = File.join(fixture_path, 'manifests', 'site.pp')
|
||||
c.environmentpath = File.join(Dir.pwd, 'spec')
|
||||
end
|
Loading…
Reference in New Issue