File: nova_migration_qemu_spec.rb

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (67 lines) | stat: -rw-r--r-- 2,284 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 'nova::migration::qemu' do

  let :pre_condition do
   'include nova
    include nova::compute
    include nova::compute::libvirt'
  end

  shared_examples_for 'nova migration with qemu' do

    context 'when not configuring qemu' do
      it 'should clear all configurations' do
        is_expected.to contain_qemu_config('migration_address').with_ensure('absent')
        is_expected.to contain_qemu_config('migration_host').with_ensure('absent')
        is_expected.to contain_qemu_config('migration_port_min').with_ensure('absent')
        is_expected.to contain_qemu_config('migration_port_max').with_ensure('absent')
      end
    end

    context 'when configuring qemu with defaults' do
      let :params do
        {
          :configure_qemu => true
        }
      end
      it 'should configure the default values' do
        is_expected.to contain_qemu_config('migration_address').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_qemu_config('migration_host').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_qemu_config('migration_port_min').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_qemu_config('migration_port_max').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'when configuring qemu with overridden parameters' do
      let :params do
        {
          :configure_qemu     => true,
          :migration_address  => '0.0.0.0',
          :migration_host     => 'host.example.com',
          :migration_port_min => 61138,
          :migration_port_max => 61200,
        }
      end
      it 'should configure the given values' do
        is_expected.to contain_qemu_config('migration_address').with_value('0.0.0.0')
        is_expected.to contain_qemu_config('migration_host').with_value('host.example.com')
        is_expected.to contain_qemu_config('migration_port_min').with_value(61138)
        is_expected.to contain_qemu_config('migration_port_max').with_value(61200)
      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())
       end

      it_configures 'nova migration with qemu'
     end
  end

end