diff options
author | Emilien Macchi <emilien@redhat.com> | 2016-07-25 13:28:12 -0400 |
---|---|---|
committer | Emilien Macchi <emilien@redhat.com> | 2016-07-25 13:28:12 -0400 |
commit | e32a36ae326a673d62a0a60fea6c36ba5ad1d184 (patch) | |
tree | 82c1bf52f91c0b0917cf0098d20626c01ebde1d5 /spec/defines | |
parent | 72453d64312b911f77a717174ffac5c90adfdf6f (diff) |
Unit tests for HAproxy dual stack
Change-Id: I6a959609523bd7fa681cd86522a56fff7c92352b
Diffstat (limited to 'spec/defines')
-rw-r--r-- | spec/defines/tripleo_haproxy_endpoint_spec.rb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/spec/defines/tripleo_haproxy_endpoint_spec.rb b/spec/defines/tripleo_haproxy_endpoint_spec.rb new file mode 100644 index 0000000..72d1619 --- /dev/null +++ b/spec/defines/tripleo_haproxy_endpoint_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' + +describe 'tripleo::haproxy::endpoint' do + + let(:title) { 'neutron' } + + let :pre_condition do + 'include ::haproxy' + end + + let :params do { + :public_virtual_ip => '192.168.0.1', + :internal_ip => '10.0.0.1', + :service_port => 9696, + :ip_addresses => ['10.0.0.2', '10.0.0.3', '10.0.0.4'], + :server_names => ['controller1', 'controller2', 'controller3'], + :public_ssl_port => 19696, + :member_options => [ 'check', 'inter 2000', 'rise 2', 'fall 5' ], + :haproxy_listen_bind_param => ['transparent'], + } + end + + shared_examples_for 'tripleo haproxy endpoint' do + context 'with basic parameters to configure neutron binding' do + it 'should configure haproxy' do + is_expected.to contain_haproxy__listen('neutron').with( + :collect_exported => false, + :bind => [ + ['10.0.0.1:9696', ['transparent']], + ['192.168.0.1:9696', ['transparent']] + ] + ) + end + end + + context 'with dual-stack' do + before :each do + params.merge!({ + :public_virtual_ip => ['fd00:fd00:fd00:2000::14', '192.168.0.1'], + }) + end + it 'should configure haproxy' do + is_expected.to contain_haproxy__listen('neutron').with( + :collect_exported => false, + :bind => [ + ['10.0.0.1:9696', ['transparent']], + ['fd00:fd00:fd00:2000::14:9696', ['transparent']], + ['192.168.0.1:9696', ['transparent']] + ] + ) + end + end + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian', + :hostname => 'myhost' } + end + + it_configures 'tripleo haproxy endpoint' + end + + context 'on RedHat platforms' do + let :facts do + { :osfamily => 'RedHat', + :hostname => 'myhost' } + end + + it_configures 'tripleo haproxy endpoint' + end +end |