File: murano_keystone_auth_spec.rb

package info (click to toggle)
puppet-module-murano 17.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 760 kB
  • sloc: ruby: 2,626; python: 37; sh: 15; makefile: 10
file content (89 lines) | stat: -rw-r--r-- 3,172 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
require 'spec_helper'

describe 'murano::keystone::auth' do

  shared_examples_for 'murano keystone auth' do

    describe 'with default class parameters' do
      let :params do
        { :password => 'murano_password',
          :tenant   => 'foobar' }
      end

      it { is_expected.to contain_keystone_user('murano').with(
                              :ensure   => 'present',
                              :password => 'murano_password',
                          ) }

      it { is_expected.to contain_keystone_user_role('murano@foobar').with(
                              :ensure  => 'present',
                              :roles   => ['admin']
                          )}

      it { is_expected.to contain_keystone_service('murano::application-catalog').with(
                              :ensure      => 'present',
                              :description => 'Murano Application Catalog'
                          ) }

      it { is_expected.to contain_keystone_endpoint('RegionOne/murano::application-catalog').with(
                              :ensure       => 'present',
                              :public_url   => "http://127.0.0.1:8082",
                              :admin_url    => "http://127.0.0.1:8082",
                              :internal_url => "http://127.0.0.1:8082"
                          ) }
    end

    describe 'with endpoint parameters' do
      let :params do
        { :password     => 'murano_password',
          :public_url   => 'https://10.10.10.10:80',
          :internal_url => 'http://10.10.10.11:81',
          :admin_url    => 'http://10.10.10.12:81' }
      end

      it { is_expected.to contain_keystone_endpoint('RegionOne/murano::application-catalog').with(
                              :ensure       => 'present',
                              :public_url   => 'https://10.10.10.10:80',
                              :internal_url => 'http://10.10.10.11:81',
                              :admin_url    => 'http://10.10.10.12:81'
                          ) }
    end

    describe 'when overriding auth and service name' do
      let :params do
        { :password => 'foo',
          :service_name => 'muranoy',
          :auth_name => 'muranoy' }
      end

      it { is_expected.to contain_keystone_user('muranoy') }
      it { is_expected.to contain_keystone_user_role('muranoy@services') }
      it { is_expected.to contain_keystone_service('muranoy::application-catalog') }
      it { is_expected.to contain_keystone_endpoint('RegionOne/muranoy::application-catalog') }
    end

    describe 'when not configuring user and role' do
      let :params do
        { :password => 'foo',
          :configure_user => false,
          :configure_user_role => false }
      end

      it { is_expected.to_not contain_keystone_user('murano') }
      it { is_expected.to_not contain_keystone_user_role('murano@services') }
    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_behaves_like 'murano keystone auth'
    end
  end

end