memcached (openstack) is no longer in use
[mirror/dsa-puppet.git] / 3rdparty / modules / neutron / spec / classes / neutron_plugins_linuxbridge_spec.rb
1 require 'spec_helper'
2
3 describe 'neutron::plugins::linuxbridge' do
4
5   let :pre_condition do
6     "class { 'neutron': rabbit_password => 'passw0rd' }"
7   end
8
9   let :params do
10     { :sql_connection      => false,
11       :network_vlan_ranges => 'physnet0:100:109',
12       :tenant_network_type => 'vlan',
13       :package_ensure      => 'installed'
14     }
15   end
16
17   shared_examples_for 'neutron linuxbridge plugin' do
18
19     it { should contain_class('neutron::params') }
20
21     it 'installs neutron linuxbridge plugin package' do
22       should contain_package('neutron-plugin-linuxbridge').with(
23         :ensure => params[:package_ensure],
24         :name   => platform_params[:linuxbridge_plugin_package]
25       )
26     end
27
28     it 'configures linuxbridge_conf.ini' do
29       should contain_neutron_plugin_linuxbridge('VLANS/tenant_network_type').with(
30         :value => params[:tenant_network_type]
31       )
32       should contain_neutron_plugin_linuxbridge('VLANS/network_vlan_ranges').with(
33         :value => params[:network_vlan_ranges]
34       )
35     end
36
37     it 'should create plugin symbolic link' do
38       should contain_file('/etc/neutron/plugin.ini').with(
39         :ensure  => 'link',
40         :target  => '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
41         :require => 'Package[neutron-plugin-linuxbridge]'
42       )
43     end
44   end
45
46   context 'on Debian platforms' do
47     let :facts do
48       { :osfamily => 'Debian' }
49     end
50
51     let :platform_params do
52       { :linuxbridge_plugin_package => 'neutron-plugin-linuxbridge' }
53     end
54
55     context 'on Ubuntu operating systems' do
56       before do
57         facts.merge!({:operatingsystem => 'Ubuntu'})
58       end
59
60       it 'configures /etc/default/neutron-server' do
61         should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
62           :path    => '/etc/default/neutron-server',
63           :match   => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
64           :line    => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini',
65           :require => ['Package[neutron-plugin-linuxbridge]', 'Package[neutron-server]'],
66           :notify  => 'Service[neutron-server]'
67         )
68       end
69       it_configures 'neutron linuxbridge plugin'
70     end
71
72     context 'on Debian operating systems' do
73       before do
74         facts.merge!({:operatingsystem => 'Debian'})
75       end
76
77       it_configures 'neutron linuxbridge plugin'
78     end
79   end
80
81   context 'on RedHat platforms' do
82     let :facts do
83       { :osfamily => 'RedHat' }
84     end
85
86     let :platform_params do
87       { :linuxbridge_plugin_package => 'openstack-neutron-linuxbridge' }
88     end
89
90     it_configures 'neutron linuxbridge plugin'
91   end
92 end