Replace verify_contents
This is provided by puppetlabs_spec_helper which we aim to replace by voxpupuli-test. Change-Id: I518b308e05e9bb9187f82ac7aa95d59b6ccaac91 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -16,29 +16,27 @@ describe 'openstack_extras::auth_file' do
|
|||||||
:mode => '0700',
|
:mode => '0700',
|
||||||
:show_diff => false,
|
:show_diff => false,
|
||||||
:tag => ['openrc'],
|
:tag => ['openrc'],
|
||||||
|
:content => <<EOS
|
||||||
|
#!/bin/sh
|
||||||
|
export OS_NO_CACHE='true'
|
||||||
|
export OS_PROJECT_NAME='openstack'
|
||||||
|
export OS_USERNAME='admin'
|
||||||
|
export OS_PASSWORD='admin'
|
||||||
|
export OS_AUTH_URL='http://127.0.0.1:5000/v3/'
|
||||||
|
export OS_AUTH_STRATEGY='keystone'
|
||||||
|
export OS_REGION_NAME='RegionOne'
|
||||||
|
export OS_PROJECT_DOMAIN_NAME='Default'
|
||||||
|
export OS_USER_DOMAIN_NAME='Default'
|
||||||
|
export OS_INTERFACE='public'
|
||||||
|
export OS_ENDPOINT_TYPE='publicURL'
|
||||||
|
export CINDER_ENDPOINT_TYPE='publicURL'
|
||||||
|
export GLANCE_ENDPOINT_TYPE='publicURL'
|
||||||
|
export KEYSTONE_ENDPOINT_TYPE='publicURL'
|
||||||
|
export NOVA_ENDPOINT_TYPE='publicURL'
|
||||||
|
export NEUTRON_ENDPOINT_TYPE='publicURL'
|
||||||
|
export OS_IDENTITY_API_VERSION='3'
|
||||||
|
EOS
|
||||||
)}
|
)}
|
||||||
|
|
||||||
it {
|
|
||||||
verify_contents(catalogue, '/root/openrc', [
|
|
||||||
'export OS_NO_CACHE=\'true\'',
|
|
||||||
'export OS_PROJECT_NAME=\'openstack\'',
|
|
||||||
'export OS_USERNAME=\'admin\'',
|
|
||||||
'export OS_PASSWORD=\'admin\'',
|
|
||||||
'export OS_AUTH_URL=\'http://127.0.0.1:5000/v3/\'',
|
|
||||||
'export OS_AUTH_STRATEGY=\'keystone\'',
|
|
||||||
'export OS_REGION_NAME=\'RegionOne\'',
|
|
||||||
'export OS_PROJECT_DOMAIN_NAME=\'Default\'',
|
|
||||||
'export OS_USER_DOMAIN_NAME=\'Default\'',
|
|
||||||
'export OS_INTERFACE=\'public\'',
|
|
||||||
'export OS_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export CINDER_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export GLANCE_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export KEYSTONE_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export NOVA_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export NEUTRON_ENDPOINT_TYPE=\'publicURL\'',
|
|
||||||
'export OS_IDENTITY_API_VERSION=\'3\'',
|
|
||||||
])
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when overriding parameters' do
|
context 'when overriding parameters' do
|
||||||
@@ -79,36 +77,34 @@ describe 'openstack_extras::auth_file' do
|
|||||||
:mode => '0700',
|
:mode => '0700',
|
||||||
:show_diff => false,
|
:show_diff => false,
|
||||||
:tag => ['openrc'],
|
:tag => ['openrc'],
|
||||||
|
:content => <<EOS
|
||||||
|
#!/bin/sh
|
||||||
|
export OS_SERVICE_TOKEN='servicetoken'
|
||||||
|
export OS_SERVICE_ENDPOINT='http://127.0.0.2:5000/v3/'
|
||||||
|
export OS_NO_CACHE='false'
|
||||||
|
export OS_PROJECT_NAME='myproject'
|
||||||
|
export OS_USERNAME='myuser'
|
||||||
|
export OS_PASSWORD='admin'
|
||||||
|
export OS_AUTH_URL='http://127.0.0.2:5000/v3/'
|
||||||
|
export OS_AUTH_STRATEGY='no_auth'
|
||||||
|
export OS_REGION_NAME='myregion'
|
||||||
|
export OS_PROJECT_DOMAIN_NAME='anotherdomain'
|
||||||
|
export OS_USER_DOMAIN_NAME='anotherdomain'
|
||||||
|
export OS_INTERFACE='internal'
|
||||||
|
export OS_ENDPOINT_TYPE='internalURL'
|
||||||
|
export CINDER_ENDPOINT_TYPE='internalURL'
|
||||||
|
export GLANCE_ENDPOINT_TYPE='internalURL'
|
||||||
|
export KEYSTONE_ENDPOINT_TYPE='internalURL'
|
||||||
|
export NOVA_ENDPOINT_TYPE='internalURL'
|
||||||
|
export NEUTRON_ENDPOINT_TYPE='internalURL'
|
||||||
|
export OS_COMPUTE_API_VERSION='2.1'
|
||||||
|
export OS_NETWORK_API_VERSION='2.0'
|
||||||
|
export OS_IMAGE_API_VERSION='2'
|
||||||
|
export OS_VOLUME_API_VERSION='2'
|
||||||
|
export OS_IDENTITY_API_VERSION='3.1'
|
||||||
|
export OS_OBJECT_API_VERSION='1'
|
||||||
|
EOS
|
||||||
)}
|
)}
|
||||||
|
|
||||||
it {
|
|
||||||
verify_contents(catalogue, '/path/to/file', [
|
|
||||||
'export OS_SERVICE_TOKEN=\'servicetoken\'',
|
|
||||||
'export OS_SERVICE_ENDPOINT=\'http://127.0.0.2:5000/v3/\'',
|
|
||||||
'export OS_NO_CACHE=\'false\'',
|
|
||||||
'export OS_PROJECT_NAME=\'myproject\'',
|
|
||||||
'export OS_USERNAME=\'myuser\'',
|
|
||||||
'export OS_PASSWORD=\'admin\'',
|
|
||||||
'export OS_AUTH_URL=\'http://127.0.0.2:5000/v3/\'',
|
|
||||||
'export OS_AUTH_STRATEGY=\'no_auth\'',
|
|
||||||
'export OS_REGION_NAME=\'myregion\'',
|
|
||||||
'export OS_PROJECT_DOMAIN_NAME=\'anotherdomain\'',
|
|
||||||
'export OS_USER_DOMAIN_NAME=\'anotherdomain\'',
|
|
||||||
'export OS_INTERFACE=\'internal\'',
|
|
||||||
'export OS_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export CINDER_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export GLANCE_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export KEYSTONE_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export NOVA_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export NEUTRON_ENDPOINT_TYPE=\'internalURL\'',
|
|
||||||
'export OS_COMPUTE_API_VERSION=\'2.1\'',
|
|
||||||
'export OS_NETWORK_API_VERSION=\'2.0\'',
|
|
||||||
'export OS_IMAGE_API_VERSION=\'2\'',
|
|
||||||
'export OS_VOLUME_API_VERSION=\'2\'',
|
|
||||||
'export OS_IDENTITY_API_VERSION=\'3.1\'',
|
|
||||||
'export OS_OBJECT_API_VERSION=\'1\'',
|
|
||||||
])
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'handle password and token with single quotes' do
|
context 'handle password and token with single quotes' do
|
||||||
@@ -119,12 +115,36 @@ describe 'openstack_extras::auth_file' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it {
|
it { is_expected.to contain_file('/root/openrc').with(
|
||||||
verify_contents(catalogue, '/root/openrc', [
|
:ensure => 'file',
|
||||||
'export OS_SERVICE_TOKEN=\'key\\\'stone\'',
|
:owner => 'root',
|
||||||
'export OS_PASSWORD=\'singlequote\\\'\'',
|
:group => 'root',
|
||||||
])
|
:mode => '0700',
|
||||||
}
|
:show_diff => false,
|
||||||
|
:tag => ['openrc'],
|
||||||
|
:content => <<EOS
|
||||||
|
#!/bin/sh
|
||||||
|
export OS_SERVICE_TOKEN='key\\'stone'
|
||||||
|
export OS_SERVICE_ENDPOINT='http://127.0.0.1:5000/v3/'
|
||||||
|
export OS_NO_CACHE='true'
|
||||||
|
export OS_PROJECT_NAME='openstack'
|
||||||
|
export OS_USERNAME='admin'
|
||||||
|
export OS_PASSWORD='singlequote\\''
|
||||||
|
export OS_AUTH_URL='http://127.0.0.1:5000/v3/'
|
||||||
|
export OS_AUTH_STRATEGY='keystone'
|
||||||
|
export OS_REGION_NAME='RegionOne'
|
||||||
|
export OS_PROJECT_DOMAIN_NAME='Default'
|
||||||
|
export OS_USER_DOMAIN_NAME='Default'
|
||||||
|
export OS_INTERFACE='public'
|
||||||
|
export OS_ENDPOINT_TYPE='publicURL'
|
||||||
|
export CINDER_ENDPOINT_TYPE='publicURL'
|
||||||
|
export GLANCE_ENDPOINT_TYPE='publicURL'
|
||||||
|
export KEYSTONE_ENDPOINT_TYPE='publicURL'
|
||||||
|
export NOVA_ENDPOINT_TYPE='publicURL'
|
||||||
|
export NEUTRON_ENDPOINT_TYPE='publicURL'
|
||||||
|
export OS_IDENTITY_API_VERSION='3'
|
||||||
|
EOS
|
||||||
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the file is in /tmp' do
|
context 'when the file is in /tmp' do
|
||||||
|
|||||||
Reference in New Issue
Block a user