aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.fixtures.yml32
-rw-r--r--.gitignore1
-rw-r--r--Gemfile26
-rw-r--r--Puppetfile_extras31
-rw-r--r--Rakefile22
-rw-r--r--manifests/certmonger/ca/local.pp10
-rw-r--r--manifests/profile/base/mistral.pp9
-rw-r--r--manifests/profile/base/swift/ringbuilder.pp2
-rw-r--r--manifests/profile/base/swift/storage.pp2
-rw-r--r--metadata.json6
-rw-r--r--spec/classes/tripleo_cluster_cassandra_spec.rb20
-rw-r--r--spec/classes/tripleo_cluster_zookeeper_spec.rb125
-rw-r--r--spec/classes/tripleo_firewall_spec.rb24
-rw-r--r--spec/classes/tripleo_host_sriov_spec.rb20
-rw-r--r--spec/classes/tripleo_midonet_agent_spec.rb22
-rw-r--r--spec/classes/tripleo_midonet_api_spec.rb20
-rw-r--r--spec/classes/tripleo_packages_spec.rb20
-rw-r--r--spec/classes/tripleo_profile_base_swift_proxy_spec.rb37
-rw-r--r--spec/classes/tripleo_selinux_spec.rb24
-rw-r--r--spec/spec_helper.rb17
20 files changed, 206 insertions, 264 deletions
diff --git a/.fixtures.yml b/.fixtures.yml
deleted file mode 100644
index fae4a8c..0000000
--- a/.fixtures.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-fixtures:
- repositories:
- 'firewall': 'git://github.com/puppetlabs/puppetlabs-firewall.git'
- 'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
- 'haproxy': 'git://github.com/puppetlabs/puppetlabs-haproxy.git'
- 'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
- 'openstacklib': 'git://github.com/openstack/puppet-openstacklib.git'
- 'swift': 'git://github.com/openstack/puppet-swift.git'
- 'memcached': 'git://github.com/saz/puppet-memcached.git'
- 'midonet':
- repo: 'git://github.com/midonet/puppet-midonet.git'
- ref: 'v2015.06.7'
- 'tomcat':
- repo: 'git://github.com/puppetlabs/puppetlabs-tomcat.git'
- ref: '1.3.2'
- 'inifile':
- repo: 'git://github.com/puppetlabs/puppetlabs-inifile.git'
- ref: '1.4.2'
- 'cassandra':
- repo: 'git://github.com/locp/cassandra.git'
- ref: '1.9.2'
- 'zookeeper':
- repo: 'git://github.com/deric/puppet-zookeeper.git'
- ref: 'v0.3.9'
- 'datacat':
- repo: 'git://github.com/richardc/puppet-datacat'
- ref: '0.6.2'
- 'java':
- repo: 'git://github.com/puppetlabs/puppetlabs-java'
- ref: '1.4.2'
- symlinks:
- "tripleo": "#{source_dir}"
diff --git a/.gitignore b/.gitignore
index 4dd84f0..15c55ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ coverage/
.idea/
*.swp
*.iml
+openstack/
diff --git a/Gemfile b/Gemfile
index bdf11ff..1fab608 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,27 +1,9 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
-group :development, :test do
- gem 'puppetlabs_spec_helper', :require => 'false'
- gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
- gem 'metadata-json-lint', :require => 'false'
- gem 'puppet-lint-param-docs', :require => 'false'
- gem 'puppet-lint-absolute_classname-check', :require => 'false'
- gem 'puppet-lint-absolute_template_path', :require => 'false'
- gem 'puppet-lint-trailing_newline-check', :require => 'false'
- gem 'puppet-lint-unquoted_string-check', :require => 'false'
- gem 'puppet-lint-leading_zero-check', :require => 'false'
- gem 'puppet-lint-variable_contains_upcase', :require => 'false'
- gem 'puppet-lint-numericvariable', :require => 'false'
- gem 'json', :require => 'false'
- # adding 'psych' explicitly
- # https://github.com/bundler/bundler/issues/2068
- # TODO: drop it in a future release of 'bundle'.
- gem 'psych', :require => 'false'
-end
-
-group :system_tests do
- gem 'beaker-rspec', :require => 'false'
- gem 'beaker-puppet_install_helper', :require => 'false'
+group :development, :test, :system_tests do
+ gem 'puppet-openstack_spec_helper',
+ :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
+ :require => false
end
if facterversion = ENV['FACTER_GEM_VERSION']
diff --git a/Puppetfile_extras b/Puppetfile_extras
new file mode 100644
index 0000000..b9f664f
--- /dev/null
+++ b/Puppetfile_extras
@@ -0,0 +1,31 @@
+
+## TripleO Puppet modules
+
+mod 'haproxy',
+ :git => 'https://github.com/puppetlabs/puppetlabs-haproxy',
+ :ref => 'master'
+
+mod 'midonet',
+ :git => 'https://github.com/midonet/puppet-midonet',
+ :ref => 'v2015.06.7'
+
+mod 'tomcat',
+ :git => 'https://github.com/puppetlabs/puppetlabs-tomcat',
+ :ref => '1.3.2'
+
+mod 'java',
+ :git => 'https://github.com/puppetlabs/puppetlabs-java',
+ :ref => '1.4.2'
+
+mod 'cassandra',
+ :git => 'https://github.com/locp/cassandra',
+ :ref => '1.9.2'
+
+mod 'zookeeper',
+ :git => 'https://github.com/deric/puppet-zookeeper',
+ :ref => 'v0.3.9'
+
+mod 'datacat',
+ :git => 'https://github.com/richardc/puppet-datacat',
+ :ref => '0.6.2'
+
diff --git a/Rakefile b/Rakefile
index 7dcaeb9..168d108 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,21 +1 @@
-require 'puppetlabs_spec_helper/rake_tasks'
-require 'puppet-lint/tasks/puppet-lint'
-require 'puppet-syntax/tasks/puppet-syntax'
-
-PuppetSyntax.exclude_paths ||= []
-PuppetSyntax.exclude_paths << "spec/fixtures/**/*"
-PuppetSyntax.exclude_paths << "pkg/**/*"
-PuppetSyntax.exclude_paths << "vendor/**/*"
-
-Rake::Task[:lint].clear
-PuppetLint::RakeTask.new :lint do |config|
- config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
- config.fail_on_warnings = true
- config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
- config.disable_checks = ["80chars", "class_inherits_from_params_class", "only_variable_string"]
-end
-
-desc "Run acceptance tests"
-RSpec::Core::RakeTask.new(:acceptance) do |t|
- t.pattern = 'spec/acceptance'
-end
+require 'puppet-openstack_spec_helper/rake_tasks'
diff --git a/manifests/certmonger/ca/local.pp b/manifests/certmonger/ca/local.pp
index ea08dec..b7b7328 100644
--- a/manifests/certmonger/ca/local.pp
+++ b/manifests/certmonger/ca/local.pp
@@ -29,9 +29,11 @@ class tripleo::certmonger::ca::local(
$extract_cmd = "openssl pkcs12 -in ${ca_pkcs12} -out ${ca_pem} -nokeys -nodes -passin pass:''"
$trust_ca_cmd = 'update-ca-trust extract'
exec { 'extract-and-trust-ca':
- command => "${extract_cmd} && ${trust_ca_cmd}",
- path => '/usr/bin',
- creates => $ca_pem,
- require => Package['certmonger'],
+ command => "${extract_cmd} && ${trust_ca_cmd}",
+ path => '/usr/bin',
+ creates => $ca_pem,
+ tries => 5,
+ try_sleep => 1,
+ require => Service['certmonger'],
}
}
diff --git a/manifests/profile/base/mistral.pp b/manifests/profile/base/mistral.pp
index cffb03e..3ebc3d5 100644
--- a/manifests/profile/base/mistral.pp
+++ b/manifests/profile/base/mistral.pp
@@ -27,9 +27,14 @@
# for more details.
# Defaults to hiera('step')
#
+# [*rabbit_hosts*]
+# list of the rabbbit host IPs
+# Defaults to hiera('rabbitmq_node_ips')
+
class tripleo::profile::base::mistral (
$bootstrap_node = hiera('bootstrap_nodeid', undef),
$step = hiera('step'),
+ $rabbit_hosts = hiera('rabbitmq_node_ips', undef),
) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
@@ -42,7 +47,9 @@ class tripleo::profile::base::mistral (
}
if $step >= 4 or ($step >= 3 and $sync_db) {
- include ::mistral
+ class { '::mistral':
+ rabbit_hosts => $rabbit_hosts,
+ }
include ::mistral::config
include ::mistral::client
include ::mistral::db::sync
diff --git a/manifests/profile/base/swift/ringbuilder.pp b/manifests/profile/base/swift/ringbuilder.pp
index 98a09a0..c77d744 100644
--- a/manifests/profile/base/swift/ringbuilder.pp
+++ b/manifests/profile/base/swift/ringbuilder.pp
@@ -91,7 +91,7 @@ class tripleo::profile::base::swift::ringbuilder (
# rebalance
swift::ringbuilder::rebalance{ ['object', 'account', 'container']:
- seed => 999,
+ seed => '999',
}
Ring_object_device<| |> ~> Exec['rebalance_object']
diff --git a/manifests/profile/base/swift/storage.pp b/manifests/profile/base/swift/storage.pp
index 0b09ea6..d1660de 100644
--- a/manifests/profile/base/swift/storage.pp
+++ b/manifests/profile/base/swift/storage.pp
@@ -41,7 +41,7 @@ class tripleo::profile::base::swift::storage (
ensure => directory,
owner => 'swift',
group => 'swift',
- require => Package['openstack-swift'],
+ require => Package['swift'],
}
}
$swift_components = ['account', 'container', 'object']
diff --git a/metadata.json b/metadata.json
index dfeb9b1..ffb856f 100644
--- a/metadata.json
+++ b/metadata.json
@@ -14,11 +14,11 @@
],
"operatingsystem_support": [
{
- "operatingsystem": "Fedora",
- "operatingsystemrelease": ["20"]
+ "operatingsystem": "RedHat",
+ "operatingsystemrelease": ["7"]
},
{
- "operatingsystem": "RedHat",
+ "operatingsystem": "CentOS",
"operatingsystemrelease": ["7"]
}
],
diff --git a/spec/classes/tripleo_cluster_cassandra_spec.rb b/spec/classes/tripleo_cluster_cassandra_spec.rb
index 13be98e..3f7d471 100644
--- a/spec/classes/tripleo_cluster_cassandra_spec.rb
+++ b/spec/classes/tripleo_cluster_cassandra_spec.rb
@@ -19,15 +19,7 @@ require 'spec_helper'
describe 'tripleo::cluster::cassandra' do
- shared_examples_for 'cassandra cluster service' do
-
- let :facts do
- {
- :hostname => 'host1.midonet',
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
- }
- end
+ shared_examples_for 'tripleo::cluster::cassandra' do
let :params do
{
@@ -49,6 +41,14 @@ describe 'tripleo::cluster::cassandra' do
end
end
- it_configures 'cassandra cluster service'
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
+
+ it_behaves_like 'tripleo::cluster::cassandra'
+ end
+ end
end
diff --git a/spec/classes/tripleo_cluster_zookeeper_spec.rb b/spec/classes/tripleo_cluster_zookeeper_spec.rb
index ed46164..fc003b6 100644
--- a/spec/classes/tripleo_cluster_zookeeper_spec.rb
+++ b/spec/classes/tripleo_cluster_zookeeper_spec.rb
@@ -19,97 +19,68 @@ require 'spec_helper'
describe 'tripleo::cluster::zookeeper' do
- let :default_params do
- {
- :zookeeper_server_ips => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :zookeeper_hostnames => ['host1.midonet', 'host2.midonet', 'host3.midonet']
- }
- end
-
- context 'on host1' do
- let :facts do
- {
- :hostname => 'host1.midonet',
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
- }
- end
-
+ shared_examples_for 'tripleo::cluster::zookeeper' do
let :params do
- {
- :zookeeper_client_ip => '23.43.2.34'
- }
- end
-
- before do
- params.merge!(default_params)
- end
-
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.34',
- :id => 1
- )
- end
-
- end
-
- context 'on host2' do
- let :facts do
{
- :hostname => 'host2.midonet',
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
+ :zookeeper_server_ips => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
+ :zookeeper_hostnames => ['host1.midonet', 'host2.midonet', 'host3.midonet']
}
end
- let :params do
- {
- :zookeeper_client_ip => '23.43.2.35'
- }
+ context 'on host1' do
+ before :each do
+ facts.merge!({ :hostname => 'host1.midonet'})
+ params.merge!({ :zookeeper_client_ip => '23.43.2.34' })
+ end
+
+ it 'should call zookeeper using id==1' do
+ is_expected.to contain_class('zookeeper').with(
+ :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
+ :client_ip => '23.43.2.34',
+ :id => 1
+ )
+ end
end
- before do
- params.merge!(default_params)
+ context 'on host2' do
+ before :each do
+ facts.merge!({ :hostname => 'host2.midonet'})
+ params.merge!({ :zookeeper_client_ip => '23.43.2.35' })
+ end
+
+ it 'should call zookeeper using id==1' do
+ is_expected.to contain_class('zookeeper').with(
+ :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
+ :client_ip => '23.43.2.35',
+ :id => 2
+ )
+ end
end
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.35',
- :id => 2
- )
- end
- end
+ context 'on host3' do
+ before :each do
+ facts.merge!({ :hostname => 'host3.midonet'})
+ params.merge!({ :zookeeper_client_ip => '23.43.2.36' })
+ end
- context 'on host3' do
- let :facts do
- {
- :hostname => 'host3.midonet',
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
- }
- end
+ it 'should call zookeeper using id==1' do
+ is_expected.to contain_class('zookeeper').with(
+ :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
+ :client_ip => '23.43.2.36',
+ :id => 3
+ )
+ end
- let :params do
- {
- :zookeeper_client_ip => '23.43.2.36'
- }
end
+ end
- before do
- params.merge!(default_params)
- end
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
- it 'should call zookeeper using id==1' do
- is_expected.to contain_class('zookeeper').with(
- :servers => ['23.43.2.34', '23.43.2.35', '24.43.2.36'],
- :client_ip => '23.43.2.36',
- :id => 3
- )
+ it_behaves_like 'tripleo::cluster::zookeeper'
end
-
end
-
end
diff --git a/spec/classes/tripleo_firewall_spec.rb b/spec/classes/tripleo_firewall_spec.rb
index 27ac62a..1270aa7 100644
--- a/spec/classes/tripleo_firewall_spec.rb
+++ b/spec/classes/tripleo_firewall_spec.rb
@@ -24,7 +24,7 @@ describe 'tripleo::firewall' do
{ }
end
- shared_examples_for 'tripleo node' do
+ shared_examples_for 'tripleo::firewall' do
context 'with firewall enabled' do
before :each do
@@ -114,23 +114,13 @@ describe 'tripleo::firewall' do
end
- context 'on Debian platforms' do
- let :facts do
- { :osfamily => 'Debian' }
- end
-
- it_configures 'tripleo node'
- end
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
- context 'on RedHat platforms' do
- let :facts do
- {
- :osfamily => 'RedHat',
- :operatingsystemrelease => '7.1',
- }
+ it_behaves_like 'tripleo::firewall'
end
-
- it_configures 'tripleo node'
end
-
end
diff --git a/spec/classes/tripleo_host_sriov_spec.rb b/spec/classes/tripleo_host_sriov_spec.rb
index 15d3813..920eb9b 100644
--- a/spec/classes/tripleo_host_sriov_spec.rb
+++ b/spec/classes/tripleo_host_sriov_spec.rb
@@ -2,15 +2,7 @@ require 'spec_helper'
describe 'tripleo::host::sriov' do
- shared_examples_for 'sriov vfs configuration for Red Hat distributions' do
-
- let :facts do
- {
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
- }
- end
-
+ shared_examples_for 'tripleo::host::sriov' do
let :params do
{:number_of_vfs => []}
end
@@ -35,5 +27,13 @@ describe 'tripleo::host::sriov' do
end
end
- it_configures 'sriov vfs configuration for Red Hat distributions'
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
+
+ it_behaves_like 'tripleo::host::sriov'
+ end
+ end
end
diff --git a/spec/classes/tripleo_midonet_agent_spec.rb b/spec/classes/tripleo_midonet_agent_spec.rb
index eb3abfe..73d90b6 100644
--- a/spec/classes/tripleo_midonet_agent_spec.rb
+++ b/spec/classes/tripleo_midonet_agent_spec.rb
@@ -19,17 +19,7 @@ require 'spec_helper'
describe 'tripleo::network::midonet::agent' do
- let :facts do
- {
- :hostname => 'host2.midonet',
- :osfamily => 'RedHat',
- :operatingsystem => 'CentOS',
- :operatingsystemrelease => '7.1',
- :operatingsystemmajrelease => 7,
- }
- end
-
- shared_examples_for 'midonet agent test' do
+ shared_examples_for 'tripleo::network::midonet::agent' do
let :params do
{
@@ -56,7 +46,13 @@ describe 'tripleo::network::midonet::agent' do
end
end
- it_configures 'midonet agent test'
-
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
+ it_behaves_like 'tripleo::network::midonet::agent'
+ end
+ end
end
diff --git a/spec/classes/tripleo_midonet_api_spec.rb b/spec/classes/tripleo_midonet_api_spec.rb
index 4b47294..25b375b 100644
--- a/spec/classes/tripleo_midonet_api_spec.rb
+++ b/spec/classes/tripleo_midonet_api_spec.rb
@@ -19,13 +19,7 @@ require 'spec_helper'
describe 'tripleo::network::midonet::api' do
- let :facts do
- {
- :augeasversion => '1.0.0'
- }
- end
-
- shared_examples_for 'midonet api test' do
+ shared_examples_for 'tripleo::midonet::api' do
let :params do
{
@@ -67,6 +61,16 @@ describe 'tripleo::network::midonet::api' do
end
- it_configures 'midonet api test'
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({
+ :augeasversion => '1.0.0'
+ })
+ end
+
+ it_behaves_like 'tripleo::midonet::api'
+ end
+ end
end
diff --git a/spec/classes/tripleo_packages_spec.rb b/spec/classes/tripleo_packages_spec.rb
index 80e5d7e..076d9cd 100644
--- a/spec/classes/tripleo_packages_spec.rb
+++ b/spec/classes/tripleo_packages_spec.rb
@@ -17,19 +17,12 @@ require 'spec_helper'
describe 'tripleo::packages' do
- shared_examples_for 'Red Hat distributions' do
+ shared_examples_for 'tripleo::packages' do
let :pre_condition do
"service{'nova-compute': ensure => 'running'}"
end
- let :facts do
- {
- :osfamily => 'RedHat',
- :operatingsystemmajrelease => 7,
- }
- end
-
let :params do
{
:enable_upgrade => true
@@ -43,6 +36,15 @@ describe 'tripleo::packages' do
end
- it_configures 'Red Hat distributions'
+
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
+
+ it_behaves_like 'tripleo::packages'
+ end
+ end
end
diff --git a/spec/classes/tripleo_profile_base_swift_proxy_spec.rb b/spec/classes/tripleo_profile_base_swift_proxy_spec.rb
index da80950..68d7dde 100644
--- a/spec/classes/tripleo_profile_base_swift_proxy_spec.rb
+++ b/spec/classes/tripleo_profile_base_swift_proxy_spec.rb
@@ -21,7 +21,7 @@ describe 'tripleo::profile::base::swift::proxy' do
{ }
end
- shared_examples_for 'tripleo swift proxy base profile' do
+ shared_examples_for 'tripleo::profile::base::swift::proxy' do
let :pre_condition do
"class { '::swift':
@@ -63,27 +63,30 @@ describe 'tripleo::profile::base::swift::proxy' do
end
end
- end
+ context 'with ipv4, ipv6 and fqdn memcache servers' do
+ before :each do
+ params.merge!(
+ :step => 4,
+ :memcache_servers => ['192.168.0.1', '::2', 'myserver.com'],
+ )
+ end
- context 'on Debian platforms' do
- let :facts do
- { :osfamily => 'Debian',
- :processorcount => 1 }
+ it 'configure swift proxy cache with ips and fqdn' do
+ is_expected.to contain_class('swift::proxy::cache').with({
+ :memcache_servers => ['192.168.0.1:11211', '[::2]:11211', 'myserver.com:11211']
+ })
+ end
end
- it_configures 'tripleo swift proxy base profile'
end
- context 'on RedHat platforms' do
- let :facts do
- {
- :osfamily => 'RedHat',
- :operatingsystemrelease => '7.1',
- :processorcount => 1,
- }
- end
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
- it_configures 'tripleo swift proxy base profile'
+ it_behaves_like 'tripleo::profile::base::swift::proxy'
+ end
end
-
end
diff --git a/spec/classes/tripleo_selinux_spec.rb b/spec/classes/tripleo_selinux_spec.rb
index 301006b..f49f87b 100644
--- a/spec/classes/tripleo_selinux_spec.rb
+++ b/spec/classes/tripleo_selinux_spec.rb
@@ -19,11 +19,14 @@ require 'spec_helper'
describe 'tripleo::selinux' do
- shared_examples_for 'manage selinux' do
+ shared_examples_for 'tripleo::selinux' do
context 'with selinux enforcing' do
before :each do
- facts.merge!( :selinux_current_mode => 'enforcing' )
+ facts.merge!({
+ :selinux => true,
+ :selinux_current_mode => 'enforcing'
+ })
end
let :params do
@@ -55,7 +58,7 @@ describe 'tripleo::selinux' do
context 'with selinux disabled' do
before :each do
- facts.merge!( :selinux => 'false' )
+ facts.merge!({ :selinux => 'false' })
end
let :params do
@@ -89,18 +92,19 @@ describe 'tripleo::selinux' do
context 'on Debian platforms' do
let :facts do
- { :osfamily => 'Debian' }
+ { :osfamily => 'Debian' }
end
it_raises 'a Puppet::Error', /OS family unsuppored yet \(Debian\), SELinux support is only limited to RedHat family OS/
end
- context 'on RedHat platforms' do
- let :facts do
- { :osfamily => 'RedHat' }
- end
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({})
+ end
- it_configures 'manage selinux'
+ it_behaves_like 'tripleo::selinux'
+ end
end
-
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 251160e..b06b436 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,23 +1,24 @@
+# Load libraries from openstacklib here to simulate how they live together in a real puppet run (for provider unit tests)
+$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib'))
require 'puppetlabs_spec_helper/module_spec_helper'
require 'shared_examples'
+require 'puppet-openstack_spec_helper/defaults'
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
+
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
+
c.hiera_config = File.join(fixture_path, 'hiera.yaml')
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
- c.default_facts = {
- :kernel => 'Linux',
- :concat_basedir => '/var/lib/puppet/concat',
- :memorysize => '1000 MB',
- :processorcount => '1',
- :puppetversion => '3.7.3',
- :uniqueid => '123'
- }
+ # custom global facts for all rspec tests
+ add_custom_fact :concat_basedir, '/var/lib/puppet/concat'
end
at_exit { RSpec::Puppet::Coverage.report! }