File: octavia_driver_agent_spec.rb

package info (click to toggle)
puppet-module-octavia 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,588 kB
  • sloc: ruby: 3,940; python: 38; makefile: 12; sh: 10
file content (97 lines) | stat: -rw-r--r-- 5,007 bytes parent folder | download
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
91
92
93
94
95
96
97
require 'spec_helper'

describe 'octavia::driver_agent' do

  let :params do
    {}
  end

  shared_examples_for 'octavia-driver-agent' do

    context 'with default parameters' do
      it { is_expected.to contain_package('octavia-driver-agent').with(
        :ensure => 'present',
        :name   => platform_params[:driver_agent_package_name],
        :tag    => ['openstack', 'octavia-package'],
      ) }

      it { is_expected.to contain_service('octavia-driver-agent').with(
        :ensure     => 'running',
        :name       => platform_params[:driver_agent_service_name],
        :enable     => true,
        :hasstatus  => true,
        :hasrestart => true,
        :tag        => ['octavia-service']
      ) }

      it { is_expected.to contain_octavia_config('driver_agent/status_socket_path').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/stats_socket_path').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/get_socket_path').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/status_request_timeout').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/status_max_processes').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/stats_request_timeout').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/stats_max_processes').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/get_request_timeout').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/get_max_processes').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/max_process_warning_percent').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/provider_agent_shutdown_timeout').with_value('<SERVICE DEFAULT>') }
      it { is_expected.to contain_octavia_config('driver_agent/enabled_provider_agents').with_value('<SERVICE DEFAULT>') }
    end

    context 'with specific parameters' do
      before do
        params.merge!({
          :status_socket_path              => '/var/run/octavia/foo.sck',
          :stats_socket_path               => '/var/run/octavia/bar.sck',
          :get_socket_path                 => '/var/run/octavia/pikachu.sck',
          :status_request_timeout          => 60,
          :status_max_processes            => 10,
          :stats_request_timeout           => 60,
          :stats_max_processes             => 10,
          :get_request_timeout             => 60,
          :get_max_processes               => 10,
          :max_process_warning_percent     => 0.60,
          :provider_agent_shutdown_timeout => 60,
          :enabled_provider_agents         => ['agent-a', 'agent-b'],
        })
      end

      it { is_expected.to contain_octavia_config('driver_agent/status_socket_path').with_value('/var/run/octavia/foo.sck') }
      it { is_expected.to contain_octavia_config('driver_agent/stats_socket_path').with_value('/var/run/octavia/bar.sck') }
      it { is_expected.to contain_octavia_config('driver_agent/get_socket_path').with_value('/var/run/octavia/pikachu.sck') }
      it { is_expected.to contain_octavia_config('driver_agent/status_request_timeout').with_value(60)}
      it { is_expected.to contain_octavia_config('driver_agent/status_max_processes').with_value(10) }
      it { is_expected.to contain_octavia_config('driver_agent/stats_request_timeout').with_value(60) }
      it { is_expected.to contain_octavia_config('driver_agent/stats_max_processes').with_value(10) }
      it { is_expected.to contain_octavia_config('driver_agent/get_request_timeout').with_value(60) }
      it { is_expected.to contain_octavia_config('driver_agent/get_max_processes').with_value(10) }
      it { is_expected.to contain_octavia_config('driver_agent/max_process_warning_percent').with_value(0.60) }
      it { is_expected.to contain_octavia_config('driver_agent/provider_agent_shutdown_timeout').with_value(60) }
      it { is_expected.to contain_octavia_config('driver_agent/enabled_provider_agents').with_value('agent-a,agent-b') }
    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

      let(:platform_params) do
        case facts[:os]['family']
        when 'Debian'
          { :driver_agent_package_name => 'octavia-driver-agent',
            :driver_agent_service_name => 'octavia-driver-agent' }
        when 'RedHat'
          { :driver_agent_package_name => 'openstack-octavia-driver-agent',
            :driver_agent_service_name => 'octavia-driver-agent' }
        end
      end

      it_behaves_like 'octavia-driver-agent'
    end
  end

end