File: cloudkitty_orchestrator_spec.rb

package info (click to toggle)
puppet-module-cloudkitty 16.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 936 kB
  • sloc: ruby: 2,189; python: 33; makefile: 10; sh: 10
file content (67 lines) | stat: -rw-r--r-- 2,455 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
require 'spec_helper'

describe 'cloudkitty::orchestrator' do

  shared_examples_for 'cloudkitty::orchestrator' do

    context 'with defaults' do
      it { is_expected.to contain_class('cloudkitty::deps') }

      it 'configures orchestrator' do
        is_expected.to contain_cloudkitty_config('orchestrator/coordination_url')\
          .with_value('<SERVICE DEFAULT>').with_secret(true)
        is_expected.to contain_oslo__coordination('cloudkitty_config').with(
          :backend_url            => '<SERVICE DEFAULT>',
          :manage_backend_package => true,
          :package_ensure         => 'present',
          :manage_config          => false,
        )
        is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value(4)
        is_expected.to contain_cloudkitty_config('orchestrator/max_workers_reprocessing').with_value(4)
        is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value(16)
      end
    end

    context 'with parameters set' do
      let :params do
        {
          :coordination_url         => 'etcd3+http://127.0.0.1:2379',
          :max_workers              => 4,
          :max_workers_reprocessing => 5,
          :max_threads              => 20,
          :manage_backend_package   => false,
          :backend_package_ensure   => 'latest',
        }
      end

      it 'configures orchestrator' do
        is_expected.to contain_cloudkitty_config('orchestrator/coordination_url')\
          .with_value('etcd3+http://127.0.0.1:2379').with_secret(true)
        is_expected.to contain_oslo__coordination('cloudkitty_config').with(
          :backend_url            => 'etcd3+http://127.0.0.1:2379',
          :manage_backend_package => false,
          :package_ensure         => 'latest',
          :manage_config          => false,
        )
        is_expected.to contain_cloudkitty_config('orchestrator/max_workers').with_value(4)
        is_expected.to contain_cloudkitty_config('orchestrator/max_workers_reprocessing').with_value(5)
        is_expected.to contain_cloudkitty_config('orchestrator/max_threads').with_value(20)
      end
    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(
          :os_workers => 4,
        ))
      end

      it_configures 'cloudkitty::orchestrator'
    end
  end

end