File: manila_backend_glusternfs_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 (72 lines) | stat: -rw-r--r-- 2,406 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
require 'spec_helper'

describe 'manila::backend::glusternfs' do

  shared_examples_for 'glusternfs volume driver' do
    let(:title) {'gnfs'}

    let :params do
      {
        :glusterfs_target                        => 'remoteuser@volserver:volid',
        :glusterfs_mount_point_base              => '$state_path/mnt',
        :glusterfs_nfs_server_type               => 'gluster',
        :glusterfs_path_to_private_key           => '/etc/glusterfs/glusterfs.pem',
        :glusterfs_ganesha_server_ip             => '127.0.0.1',
        :backend_availability_zone               => 'my_zone',
        :reserved_share_percentage               => 10.0,
        :reserved_share_from_snapshot_percentage => 10.1,
        :reserved_share_extend_percentage        => 10.2,
      }
    end

    describe 'glusternfs share driver' do
      it 'configures gluster nfs/ganesha share driver' do
        is_expected.to contain_manila_config('gnfs/share_backend_name').with(
          :value => 'gnfs')
        is_expected.to contain_manila_config('gnfs/share_driver').with_value(
          'manila.share.drivers.glusterfs.GlusterfsShareDriver')
        params.each_pair do |config,value|
          is_expected.to contain_manila_config("gnfs/#{config}").with_value( value )
        end
      end

      it 'installs gluster packages' do
        is_expected.to contain_package(platform_params[:gluster_package_name]).with(
          'ensure' => 'installed',
          'tag'    => 'manila-support-package',
        )
        is_expected.to contain_package(platform_params[:gluster_client_package_name]).with(
          'ensure' => 'installed',
          'tag'    => 'manila-support-package',
        )
      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'
          {
            :gluster_client_package_name => 'glusterfs-client',
            :gluster_package_name        => 'glusterfs-common'
          }
        when 'RedHat'
          {
            :gluster_client_package_name => 'glusterfs-fuse',
            :gluster_package_name        => 'glusterfs'
          }
        end
      end

      it_behaves_like 'glusternfs volume driver'
    end
  end
end