Files
puppet-neutron/spec/classes/neutron_db_mysql_spec.rb
Cody Herriges ccac02b917 Make tests pass on Puppet 4.x
This commit makes the following changes, mostly to specs to get them
  passing on Puppet 4.x: removes redefinition of $name because it is now
  a reserved word and redundant in Puppet 3.x, cleans up the use of
  Puppet's old behavior of implicitly converting String to Integers
  since Puppet 4.x is pretty strictly typed, sets facts required for
  doing flow control and comparison, fixes implicit use of empty string
  that is assumed to be the same as false by updating tests that inject
  empty string into params to represent a value not being provide by a
  user to false instead.

Closes-bug: #1447620
Change-Id: Ibb651f26f33549dbe564dc88167b8f578a03fd77
2015-06-16 09:57:29 -07:00

80 lines
1.7 KiB
Ruby

require 'spec_helper'
describe 'neutron::db::mysql' do
let :pre_condition do
'include mysql::server'
end
let :params do
{ :password => 'passw0rd',
}
end
let :default_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
context 'on Debian platforms' do
let :facts do
default_facts.merge({ :osfamily => 'Debian' })
end
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
context 'on RedHat platforms' do
let :facts do
default_facts.merge({ :osfamily => 'RedHat' })
end
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'neutronpass',
:allowed_hosts => ['127.0.0.1','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '192.168.1.1'
}
end
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '127.0.0.1'
}
end
end
end