(MAINT) switch to rspec-puppet-facts
Switching out the puppet version, as puppet_facts does, does not work, as this will confuse code that wants to use version-dependent features. Instead this uses rspec-puppet-facts, which doesn't touch the puppet version.
This commit is contained in:
parent
5e6db0bb0f
commit
6527a3aa22
12 changed files with 779 additions and 740 deletions
2
Gemfile
2
Gemfile
|
@ -14,9 +14,9 @@ group :development, :unit_tests do
|
|||
gem 'rspec-core', '3.1.7', :require => false
|
||||
gem 'puppetlabs_spec_helper', :require => false
|
||||
gem 'simplecov', :require => false
|
||||
gem 'puppet_facts', :require => false
|
||||
gem 'json', :require => false
|
||||
gem 'metadata-json-lint', :require => false
|
||||
gem 'rspec-puppet-facts', :require => false
|
||||
end
|
||||
|
||||
group :system_tests do
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::server' do
|
||||
on_pe_unsupported_platforms.each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
context "on an unsupported OS" do
|
||||
# fetch any sets of facts to modify them
|
||||
os, facts = on_supported_os.first
|
||||
|
||||
context 'should gracefully fail' do
|
||||
it { expect { is_expected.to compile}.to raise_error(Puppet::Error, /Unsupported platform:/) }
|
||||
end
|
||||
end
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:osfamily => 'UNSUPPORTED',
|
||||
:operatingsystem => 'UNSUPPORTED',
|
||||
})
|
||||
}
|
||||
|
||||
it 'should gracefully fail' do
|
||||
is_expected.to compile.and_raise_error(/Unsupported platform:/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,10 +2,13 @@ require 'spec_helper'
|
|||
|
||||
describe 'mysql::server' do
|
||||
context 'my.cnf template' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
context 'normal entry' do
|
||||
let(:params) {{ :override_options => { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } }}
|
||||
|
@ -75,5 +78,4 @@ describe 'mysql::server' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::bindings' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
let(:params) {{
|
||||
'java_enable' => true,
|
||||
|
@ -26,5 +29,4 @@ describe 'mysql::bindings' do
|
|||
it { is_expected.to contain_package('mysql-daemon_dev') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::client' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
context 'with defaults' do
|
||||
it { is_expected.not_to contain_class('mysql::bindings') }
|
||||
|
@ -32,5 +35,4 @@ describe 'mysql::client' do
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::server::account_security' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts.merge({:fqdn => 'myhost.mydomain', :hostname => 'myhost'}) }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
context "with fqdn==myhost.mydomain" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
:fqdn => 'myhost.mydomain',
|
||||
:hostname => 'myhost',
|
||||
})
|
||||
}
|
||||
|
||||
[ 'root@myhost.mydomain',
|
||||
'root@127.0.0.1',
|
||||
|
@ -32,8 +38,14 @@ describe 'mysql::server::account_security' do
|
|||
end
|
||||
end
|
||||
|
||||
describe "on #{pe_version} #{pe_platform} with fqdn==localhost" do
|
||||
let(:facts) { facts.merge({:fqdn => 'localhost', :hostname => 'localhost'}) }
|
||||
context "with fqdn==localhost" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
:fqdn => 'localhost',
|
||||
:hostname => 'localhost',
|
||||
})
|
||||
}
|
||||
|
||||
[ 'root@127.0.0.1',
|
||||
'root@::1',
|
||||
|
@ -48,8 +60,14 @@ describe 'mysql::server::account_security' do
|
|||
end
|
||||
end
|
||||
|
||||
describe "on #{pe_version} #{pe_platform} with fqdn==localhost.localdomain" do
|
||||
let(:facts) { facts.merge({:fqdn => 'localhost.localdomain', :hostname => 'localhost'}) }
|
||||
context "with fqdn==localhost.localdomain" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
:fqdn => 'localhost.localdomain',
|
||||
:hostname => 'localhost',
|
||||
})
|
||||
}
|
||||
|
||||
[ 'root@127.0.0.1',
|
||||
'root@::1',
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::server::backup' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
let(:default_params) {
|
||||
{ 'backupuser' => 'testuser',
|
||||
|
@ -399,5 +402,4 @@ describe 'mysql::server::backup' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
require 'spec_helper'
|
||||
describe 'mysql::server::monitor' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
let :pre_condition do
|
||||
"include 'mysql::server'"
|
||||
end
|
||||
|
@ -31,5 +35,4 @@ describe 'mysql::server::monitor' do
|
|||
)}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::server::mysqltuner' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
context 'ensure => present' do
|
||||
it { is_expected.to compile }
|
||||
|
@ -39,5 +42,4 @@ describe 'mysql::server::mysqltuner' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::server' do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
context 'with defaults' do
|
||||
it { is_expected.to contain_class('mysql::server::install') }
|
||||
|
@ -188,5 +191,4 @@ describe 'mysql::server' do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'mysql::db', :type => :define do
|
||||
on_pe_supported_platforms(PLATFORMS).each do |pe_version,pe_platforms|
|
||||
pe_platforms.each do |pe_platform,facts|
|
||||
describe "on #{pe_version} #{pe_platform}" do
|
||||
let(:facts) { facts }
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) {
|
||||
facts.merge({
|
||||
:root_home => '/root',
|
||||
})
|
||||
}
|
||||
|
||||
let(:title) { 'test_db' }
|
||||
|
||||
|
@ -71,5 +74,4 @@ describe 'mysql::db', :type => :define do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'puppet_facts'
|
||||
include PuppetFacts
|
||||
require 'rspec-puppet-facts'
|
||||
include RspecPuppetFacts
|
||||
|
||||
# The default set of platforms to test again.
|
||||
ENV['UNIT_TEST_PLATFORMS'] = 'centos-6-x86_64 ubuntu-1404-x86_64'
|
||||
|
|
Loading…
Reference in a new issue