File: magnum_conductor_spec.rb

package info (click to toggle)
puppet-module-magnum 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,180 kB
  • sloc: ruby: 2,768; python: 38; makefile: 21; sh: 10
file content (69 lines) | stat: -rw-r--r-- 1,737 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
#
# Unit tests for magnum::conductor
#
require 'spec_helper'

describe 'magnum::conductor' do

  let :pre_condition do
    'class { "magnum::keystone::keystone_auth": password => "secret", }'
  end

  shared_examples_for 'magnum-conductor' do

    it { is_expected.to contain_package('magnum-conductor').with(
      :name   => platform_params[:conductor_package],
      :ensure => 'present'
    ) }

    it { is_expected.to contain_service('magnum-conductor').with(
      :name      => platform_params[:conductor_service],
      :hasstatus => 'true',
      :ensure    => 'running'
    ) }

    it {
      is_expected.to contain_magnum_config('conductor/workers').with_value(facts[:os_workers])
    }

    context 'with manage_service as false' do
      let :params do
        { :enabled        => true,
          :manage_service => false
        }
      end
      it { is_expected.not_to contain_service('magnum-conductor') }
    end

    context 'with workers specified' do
      let :params do
        { :workers => 10 }
      end

      it { is_expected.to contain_magnum_config('conductor/workers').with_value(10) }
    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
        if facts[:os]['family'] == 'Debian'
          { :conductor_package => 'magnum-conductor',
            :conductor_service => 'magnum-conductor' }
        else
          { :conductor_package => 'openstack-magnum-conductor',
            :conductor_service => 'openstack-magnum-conductor' }
        end
      end

      it_configures 'magnum-conductor'
    end
  end
end