summaryrefslogtreecommitdiffstats
path: root/puppet-barometer/spec/classes/barometer_keystone_authtoken_spec.rb
blob: 8c2e4fb516086094657e55534d44cbbc2f2fb7c7 (plain)
1

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highl
require 'spec_helper'

describe 'barometer::keystone::authtoken' do

  let :params do
    { :password => 'secrete', }
  end

  shared_examples 'barometer authtoken' do

    context 'with default parameters' do

      it 'configure keystone_authtoken' do
        is_expected.to contain_barometer_config('keystone_authtoken/username').with_value('barometer')
        is_expected.to contain_barometer_config('keystone_authtoken/password').with_value('secrete')
        is_expected.to contain_barometer_config('keystone_authtoken/auth_url').with_value('http://localhost:35357')
        is_expected.to contain_barometer_config('keystone_authtoken/project_name').with_value('services')
        is_expected.to contain_barometer_config('keystone_authtoken/user_domain_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/project_domain_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/auth_type').with_value('password')
        is_expected.to contain_barometer_config('keystone_authtoken/auth_uri').with_value('http://localhost:5000')
        is_expected.to contain_barometer_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/check_revocations_for_cached').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/hash_algorithms').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/revocation_cache_time').with_value('<SERVICE DEFAULT>')
        is_expected.to contain_barometer_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
      end
    end

    context 'when overriding parameters' do
      before do
        params.merge!({
          :auth_uri                             => 'https://10.0.0.1:9999/',
          :username                             => 'myuser',
          :password                             => 'mypasswd',
          :auth_url                             => 'https://127.0.0.1:35357',
          :project_name                         => 'service_project',
          :user_domain_name                     => 'domainX',
          :project_domain_name                  => 'domainX',
          :insecure                             => false,
          :auth_section                         => 'new_section',
          :auth_type                            => 'password',
          :auth_version                         => 'v3',
          :cache                                => 'somevalue',
          :cafile                               => '/opt/stack/data/cafile.pem',
          :certfile                             => 'certfile.crt',
          :check_revocations_for_cached         => false,
          :delay_auth_decision                  => false,
          :enforce_token_bind                   => 'permissive',
          :hash_algorithms                      => 'md5',
          :http_connect_timeout                 => '300',
          :http_request_max_retries             => '3',
          :include_service_catalog              => true,
          :keyfile                              => 'keyfile',
          :memcache_pool_conn_get_timeout       => '9',
          :memcache_pool_dead_retry             => '302',
          :memcache_pool_maxsize                => '11',
          :memcache_pool_socket_timeout         => '2',
          :memcache_pool_unused_timeout         => '61',
          :memcache_secret_key                  => 'secret_key',
          :memcache_security_strategy           => 'ENCRYPT',
          :memcache_use_advanced_pool           => true,
          :memcached_servers                    => ['memcached01:11211','memcached02:11211'],
          :manage_memcache_package              => true,
          :region_name                          => 'region2',
          :revocation_cache_time                => '11',
          :token_cache_time                     => '301',
        })
      end

      it 'configure keystone_authtoken' do
        is_expected.to contain_barometer_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/')
        is_expected.to contain_barometer_config('keystone_authtoken/username').with_value(params[:username])
        is_expected.to contain_barometer_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
        is_expected.to contain_barometer_config('keystone_authtoken/auth_url').with_value(params[:auth_url])
        is_expected.to contain_barometer_config('keystone_authtoken/project_name').with_value(params[:project_name])
        is_expected.to contain_barometer_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
        is_expected.to contain_barometer_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name])
        is_expected.to contain_barometer_config('keystone_authtoken/insecure').with_value(params[:insecure])
        is_expected.to contain_barometer_config('keystone_authtoken/auth_section').with_value(params[:auth_section])
        is_expected.to contain_barometer_config('keystone_authtoken/auth_type').with_value(params[:auth_type])
        is_expected.to contain_barometer_config('keystone_authtoken/auth_version').with_value(params[:auth_version])
        is_expected.to contain_barometer_config('keystone_authtoken/cache').with_value(params[:cache])
        is_expected.to contain_barometer_config('keystone_authtoken/cafile').with_value(params[:cafile])
        is_expected.to contain_barometer_config('keystone_authtoken/certfile').with_value(params[:certfile])
        is_expected.to contain_barometer_config('keystone_authtoken/check_revocations_for_cached').with_value(params[:check_revocations_for_cached])
        is_expected.to contain_barometer_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision])
        is_expected.to contain_barometer_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind])
        is_expected.to contain_barometer_config('keystone_authtoken/hash_algorithms').with_value(params[:hash_algorithms])
        is_expected.to contain_barometer_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout])
        is_expected.to contain_barometer_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries])
        is_expected.to contain_barometer_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog])
        is_expected.to contain_barometer_config('keystone_authtoken/keyfile').with_value(params[:keyfile])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy])
        is_expected.to contain_barometer_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool])
        is_expected.to contain_barometer_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
        is_expected.to contain_barometer_config('keystone_authtoken/region_name').with_value(params[:region_name])
        is_expected.to contain_barometer_config('keystone_authtoken/revocation_cache_time').with_value(params[:revocation_cache_time])
        is_expected.to contain_barometer_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time])
      end

      it 'installs python memcache package' do
        is_expected.to contain_package('python-memcache')
      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

      it_configures 'barometer authtoken'
    end
  end

end