1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
require 'spec_helper'
describe 'octavia::provider::ovn' do
let :params do
{}
end
shared_examples_for 'octavia-ovn-provider' do
context 'with default parameters' do
it { is_expected.to contain_octavia_config('ovn/ovn_nb_connection').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_private_key').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_certificate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_ca_cert').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_connection').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_private_key').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_certificate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_ca_cert').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovsdb_connection_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovsdb_retry_max_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovsdb_probe_interval').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_package('ovn-octavia-provider').with(
:ensure => 'present',
:name => 'python3-ovn-octavia-provider',
:tag => ['openstack', 'octavia-package'],
) }
end
context 'with specific parameters' do
before do
params.merge!({
:ovn_nb_connection => 'tcp:127.0.0.1:6641',
:ovn_nb_private_key => '/foo.key',
:ovn_nb_certificate => '/foo.pem',
:ovn_nb_ca_cert => '/ca_foo.pem',
:ovn_sb_connection => 'tcp:127.0.0.1:6642',
:ovn_sb_private_key => '/bar.key',
:ovn_sb_certificate => '/bar.pem',
:ovn_sb_ca_cert => '/ca_bar.pem',
:ovsdb_connection_timeout => 180,
:ovsdb_retry_max_interval => 180,
:ovsdb_probe_interval => 60000,
})
end
it { is_expected.to contain_octavia_config('ovn/ovn_nb_connection').with_value('tcp:127.0.0.1:6641') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_private_key').with_value('/foo.key') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_certificate').with_value('/foo.pem') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_ca_cert').with_value('/ca_foo.pem') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_connection').with_value('tcp:127.0.0.1:6642') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_private_key').with_value('/bar.key') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_certificate').with_value('/bar.pem') }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_ca_cert').with_value('/ca_bar.pem') }
it { is_expected.to contain_octavia_config('ovn/ovsdb_connection_timeout').with_value(180) }
it { is_expected.to contain_octavia_config('ovn/ovsdb_retry_max_interval').with_value(180) }
it { is_expected.to contain_octavia_config('ovn/ovsdb_probe_interval').with_value(60000) }
end
context 'with specific parameters' do
before do
params.merge!({
:ovn_nb_connection => ['tcp:192.0.2.11:6641', 'tcp:192.0.2.12:6641'],
:ovn_sb_connection => ['tcp:192.0.2.11:6642', 'tcp:192.0.2.12:6642'],
})
end
it { is_expected.to contain_octavia_config('ovn/ovn_nb_connection').with_value(
'tcp:192.0.2.11:6641,tcp:192.0.2.12:6641'
) }
it { is_expected.to contain_octavia_config('ovn/ovn_sb_connection').with_value(
'tcp:192.0.2.11:6642,tcp:192.0.2.12:6642'
) }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'octavia-ovn-provider'
end
end
end
|