puppet-tripleo/spec/defines/tripleo_haproxy_userlist_spec.rb
Cédric Jeanneret 9d438cd142 Add Basic Authentication support for HAProxy
In order to get a proper support for authenticated endpoints, this patch
creates a new definition (tripleo::haproxy::userlist) and exploit it in
the dynamic endpoint (tripleo::haproxy::service_endpoints) as well as
standard tripleo::haproxy::endpoint.

It also detected a small issue with the "underscorization" of the
service name, the missing 'G' flag for regsubst, that preventend all
dashes to be replaced by underscores.

Change-Id: Ie7471155d1ef3f6adc177a468b81ac410bbfb9c0
Closes-Bug: 1736132
2017-12-16 09:37:27 +01:00

57 lines
1.4 KiB
Ruby

require 'spec_helper'
describe 'tripleo::haproxy::userlist' do
let(:title) { 'starwars' }
let :pre_condition do
'include ::haproxy'
end
let :params do {
:groups => [
'aldebaran users leia,luke',
'deathstar users anakin,sith',
],
:users => [
'leia insecure-password sister',
'luke insecure-password jedi',
'anakin insecure-password darthvador',
'sith password $5$h9LsKUOeCr$UlD62CNEpuZQkGYdBoiFJLsM6TlXluRLBlhEnpjDdaC', # mkpasswd -m sha-256 darkSideOfTheForce
],
}
end
shared_examples_for 'tripleo haproxy userlist' do
context 'with basic parameters to configure neutron binding' do
it 'should compile' do
is_expected.to compile.with_all_deps
end
it 'should configure haproxy' do
is_expected.to contain_haproxy__userlist('starwars').with(
:users => [
'leia insecure-password sister',
'luke insecure-password jedi',
'anakin insecure-password darthvador',
'sith password $5$h9LsKUOeCr$UlD62CNEpuZQkGYdBoiFJLsM6TlXluRLBlhEnpjDdaC',
],
:groups => [
'aldebaran users leia,luke',
'deathstar users anakin,sith',
]
)
end
end
end
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge({})
end
it_behaves_like 'tripleo haproxy userlist'
end
end
end