File: manila_scheduler_spec.rb

package info (click to toggle)
puppet-module-manila 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,852 kB
  • sloc: ruby: 5,060; python: 33; makefile: 10; sh: 10
file content (111 lines) | stat: -rw-r--r-- 3,268 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require 'spec_helper'

describe 'manila::scheduler' do

  shared_examples_for 'manila::scheduler' do

    context 'with default parameters' do

      it { is_expected.to contain_class('manila::params') }

      it 'configures the default values' do
        is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/scheduler_host_manager').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/scheduler_max_attempts').with_value('<SERVICE DEFAULT>')
      end

      it { is_expected.to contain_service('manila-scheduler').with(
        :name      => platform_params[:scheduler_service],
        :enable    => true,
        :ensure    => 'running',
        :hasstatus => true,
        :tag       => 'manila-service',
      ) }
    end

    context 'with parameters' do

      let :params do
        {
          :driver       => 'manila.scheduler.filter_scheduler.FilterScheduler',
          :host_manager => 'manila.scheduler.host_manager.HostManager',
          :max_attempts => 3,
        }
      end

      it 'configures the overridden values' do
        is_expected.to contain_manila_config('DEFAULT/scheduler_driver').with_value(
          'manila.scheduler.filter_scheduler.FilterScheduler'
        )
        is_expected.to contain_manila_config('DEFAULT/scheduler_host_manager').with_value(
          'manila.scheduler.host_manager.HostManager'
        )
        is_expected.to contain_manila_config('DEFAULT/scheduler_max_attempts').with_value(3)
      end
    end

    context 'with manage_service false' do
      let :params do
        {
          :manage_service => false
        }
      end
      it 'should not configure the service' do
        is_expected.to_not contain_service('manila-scheduler')
      end
    end
  end

  shared_examples_for 'manila::scheduler on Debian' do
    context 'with default parameters' do
      it { is_expected.to contain_package('manila-scheduler').with(
        :name   => 'manila-scheduler',
        :ensure => 'present',
        :tag    => ['openstack', 'manila-package'],
      ) }
    end

    context 'with parameters' do
      let :params do
        {
          :package_ensure => 'installed'
        }
      end

      it { is_expected.to contain_package('manila-scheduler').with(
        :name   => 'manila-scheduler',
        :ensure => 'installed',
        :tag    => ['openstack', 'manila-package'],
      ) }
    end
  end

  shared_examples_for 'manila::scheduler on RedHat' do
    context 'with default parameters' do
      it { is_expected.to_not contain_package('manila-scheduler') }
    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'
          { :scheduler_service => 'manila-scheduler' }
        when 'RedHat'
          { :scheduler_service => 'openstack-manila-scheduler' }
        end
      end

      it_behaves_like 'manila::scheduler'
      it_behaves_like "manila::scheduler on #{facts[:os]['family']}"
    end
  end

end