File: tempest_magnum_spec.rb

package info (click to toggle)
puppet-module-tempest 25.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,000 kB
  • sloc: ruby: 1,268; python: 38; sh: 10; makefile: 10
file content (88 lines) | stat: -rw-r--r-- 3,596 bytes parent folder | download | duplicates (2)
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
require 'spec_helper'

describe 'tempest::magnum' do
  let :pre_condition do
    "
    class { 'tempest':
      configure_networks => false,
      configure_images   => false
    }"
  end

  let :params do
    { :nic_id => 'b2e6021a-4956-4a1f-8329-790b9add05a9', }
  end

  shared_examples 'tempest magnum' do
    context 'with default parameters' do
      it 'provisions resources and configures tempest for magnum' do
        is_expected.to contain_glance_image('fedora-atomic-latest').with(
            :ensure     => 'present',
            :source     => 'https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2',
            :properties => '{"os_distro"=>"fedora-atomic"}'
        )
        is_expected.to contain_nova_flavor('s1.magnum').with_ensure('present')
        is_expected.to contain_nova_flavor('m1.magnum').with_ensure('present')

        is_expected.to contain_tempest_config('magnum/image_id').with_value('fedora-atomic-latest')
        is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9')
        is_expected.to contain_tempest_config('magnum/keypair_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.magnum')
        is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.magnum')
        is_expected.to contain_tempest_config('magnum/magnum_url').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_tempest_config('magnum/copy_logs').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_tempest_config('magnum/dns_nameserver').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'when overriding parameters' do
      before do
        params.merge!({
          :provision_image   => false,
          :image_name        => 'coreos',
          :provision_flavors => false,
          :flavor_id         => 's1.tempest',
          :master_flavor_id  => 'm1.tempest',
          :keypair_name      => 'magnum',
          :provision_keypair => false,
          :magnum_url        => 'http://magnum/',
          :copy_logs         => false,
          :dns_nameserver    => '7.7.7.7'
        })
      end

      it 'configures tempest for magnum' do
        is_expected.to contain_tempest_config('magnum/image_id').with_value('coreos')
        is_expected.to contain_tempest_config('magnum/nic_id').with_value('b2e6021a-4956-4a1f-8329-790b9add05a9')
        is_expected.to contain_tempest_config('magnum/keypair_name').with_value('magnum')
        is_expected.to contain_tempest_config('magnum/flavor_id').with_value('s1.tempest')
        is_expected.to contain_tempest_config('magnum/master_flavor_id').with_value('m1.tempest')
        is_expected.to contain_tempest_config('magnum/magnum_url').with_value('http://magnum/')
        is_expected.to contain_tempest_config('magnum/copy_logs').with_value('false')
        is_expected.to contain_tempest_config('magnum/dns_nameserver').with_value('7.7.7.7')
      end
    end
  end

  shared_examples 'installs test packages' do
    describe 'with default parameters installing' do
      it { is_expected.to contain_package('python-magnum-tests').with_ensure('present') }
    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 'tempest magnum'

      case facts[:os]['family']
      when 'RedHat'
        it_configures 'installs test packages'
      end
    end
  end
end