Debian Codegraph @

spec/classes/nova_migration_qemu_spec.rb

raw
1 require 'spec_helper'
2
3 describe 'nova::migration::qemu' do
4
5 let :pre_condition do
6 'include nova
7 include nova::compute
8 include nova::compute::libvirt'
9 end
10
11 shared_examples_for 'nova migration with qemu' do
12
13 context 'when not configuring qemu' do
14 it 'should clear all configurations' do
15 is_expected.to contain_qemu_config('migration_address').with_ensure('absent')
16 is_expected.to contain_qemu_config('migration_host').with_ensure('absent')
17 is_expected.to contain_qemu_config('migration_port_min').with_ensure('absent')
18 is_expected.to contain_qemu_config('migration_port_max').with_ensure('absent')
19 end
20 end
21
22 context 'when configuring qemu with defaults' do
23 let :params do
24 {
25 :configure_qemu => true
26 }
27 end
28 it 'should configure the default values' do
29 is_expected.to contain_qemu_config('migration_address').with_value('<SERVICE DEFAULT>')
30 is_expected.to contain_qemu_config('migration_host').with_value('<SERVICE DEFAULT>')
31 is_expected.to contain_qemu_config('migration_port_min').with_value('<SERVICE DEFAULT>')
32 is_expected.to contain_qemu_config('migration_port_max').with_value('<SERVICE DEFAULT>')
33 end
34 end
35
36 context 'when configuring qemu with overridden parameters' do
37 let :params do
38 {
39 :configure_qemu => true,
40 :migration_address => '0.0.0.0',
41 :migration_host => 'host.example.com',
42 :migration_port_min => 61138,
43 :migration_port_max => 61200,
44 }
45 end
46 it 'should configure the given values' do
47 is_expected.to contain_qemu_config('migration_address').with_value('0.0.0.0')
48 is_expected.to contain_qemu_config('migration_host').with_value('host.example.com')
49 is_expected.to contain_qemu_config('migration_port_min').with_value(61138)
50 is_expected.to contain_qemu_config('migration_port_max').with_value(61200)
51 end
52 end
53 end
54
55 on_supported_os({
56 :supported_os => OSDefaults.get_supported_os
57 }).each do |os,facts|
58 context "on #{os}" do
59 let (:facts) do
60 facts.merge!(OSDefaults.get_facts())
61 end
62
63 it_configures 'nova migration with qemu'
64 end
65 end
66
67 end