File: manila_share_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 (103 lines) | stat: -rw-r--r-- 5,645 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
require 'spec_helper'

describe 'manila::share' do

  shared_examples_for 'manila-share' do
    context 'with default parameters' do
      it { is_expected.to contain_package('manila-share').with(
        :name   => platform_params[:package_name],
        :ensure => 'present',
        :tag    => ['openstack', 'manila-package'],
      ) }
      it { is_expected.to contain_service('manila-share').with(
        'hasstatus' => true,
        'tag'       => 'manila-service',
      )}

      it 'should configure share options' do
        is_expected.to contain_manila_config('DEFAULT/delete_share_server_with_last_share').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/unmanage_remove_access_rules').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/automatic_share_server_cleanup').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/unused_share_server_cleanup_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/replica_state_update_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/migration_driver_continue_update_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/server_migration_driver_continue_update_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/share_usage_size_update_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/enable_gathering_share_usage_size').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/share_service_inithost_offload').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/check_for_expired_shares_in_recycle_bin_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/check_for_expired_transfers').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/driver_backup_continue_update_interval').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_manila_config('DEFAULT/driver_restore_continue_update_interval').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'with parameters' do
      let :params do
        {
          :delete_share_server_with_last_share              => false,
          :unmanage_remove_access_rules                     => false,
          :automatic_share_server_cleanup                   => true,
          :unused_share_server_cleanup_interval             => 10,
          :replica_state_update_interval                    => 300,
          :migration_driver_continue_update_interval        => 60,
          :server_migration_driver_continue_update_interval => 900,
          :share_usage_size_update_interval                 => 300,
          :enable_gathering_share_usage_size                => false,
          :share_service_inithost_offload                   => false,
          :check_for_expired_shares_in_recycle_bin_interval => 3600,
          :check_for_expired_transfers                      => 300,
          :driver_backup_continue_update_interval           => 60,
          :driver_restore_continue_update_interval          => 60,
        }
      end

      it 'should configure share options' do
        is_expected.to contain_manila_config('DEFAULT/delete_share_server_with_last_share').with_value(false)
        is_expected.to contain_manila_config('DEFAULT/unmanage_remove_access_rules').with_value(false)
        is_expected.to contain_manila_config('DEFAULT/automatic_share_server_cleanup').with_value(true)
        is_expected.to contain_manila_config('DEFAULT/unused_share_server_cleanup_interval').with_value(10)
        is_expected.to contain_manila_config('DEFAULT/replica_state_update_interval').with_value(300)
        is_expected.to contain_manila_config('DEFAULT/migration_driver_continue_update_interval').with_value(60)
        is_expected.to contain_manila_config('DEFAULT/server_migration_driver_continue_update_interval').with_value(900)
        is_expected.to contain_manila_config('DEFAULT/share_usage_size_update_interval').with_value(300)
        is_expected.to contain_manila_config('DEFAULT/enable_gathering_share_usage_size').with_value(false)
        is_expected.to contain_manila_config('DEFAULT/share_service_inithost_offload').with_value(false)
        is_expected.to contain_manila_config('DEFAULT/check_for_expired_shares_in_recycle_bin_interval').with_value(3600)
        is_expected.to contain_manila_config('DEFAULT/check_for_expired_transfers').with_value(300)
        is_expected.to contain_manila_config('DEFAULT/driver_backup_continue_update_interval').with_value(60)
        is_expected.to contain_manila_config('DEFAULT/driver_restore_continue_update_interval').with_value(60)
      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-share')
      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

      let :platform_params do
        case facts[:os]['family']
        when 'Debian'
          { :package_name => 'manila-share' }
        when 'RedHat'
          { :package_name => 'openstack-manila-share' }
        end
      end

      it_behaves_like 'manila-share'
    end
  end
end