File: openstacklib_openstackclient_spec.rb

package info (click to toggle)
puppet-module-openstacklib 25.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 968 kB
  • sloc: ruby: 4,500; python: 38; sh: 22; makefile: 10
file content (47 lines) | stat: -rw-r--r-- 1,216 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
require 'spec_helper'

describe 'openstacklib::openstackclient' do
  shared_examples_for 'openstacklib::openstackclient' do
    context 'with default params' do
      it { should contain_package(platform_params[:openstackclient_package_name]).with(
        :ensure => 'installed',
        :tag    => ['openstack', 'openstackclient']
      )}
    end

    context 'with non default package name' do
      let :params do
        {
          :package_name => 'my-openstackclient'
        }
      end

      it { should contain_package('my-openstackclient').with(
        :ensure => 'installed',
        :tag    => ['openstack', 'openstackclient']
      )}
    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'
          { :openstackclient_package_name => 'python3-openstackclient' }
        when 'RedHat'
          { :openstackclient_package_name => 'python3-openstackclient' }
        end
      end

      it_behaves_like 'openstacklib::openstackclient'
    end
  end

end