Cleanup docs, testing and missed things

The cookiecutter underwent a lot of cleanup in
docs and testing, unfortunately placement was
cut before those were merged so this applies
those changes. [1] [2] [3] [4] [5]

[1] https://review.openstack.org/#/c/624624/
[2] https://review.openstack.org/#/c/624338/
[3] https://review.openstack.org/#/c/614803/
[4] https://review.openstack.org/#/c/610859/
[5] https://review.openstack.org/#/c/622925/

Change-Id: I35903872a9cd3dcaafed4d03fc9b57f04474b087
This commit is contained in:
Tobias Urdin 2018-12-12 14:55:03 +01:00
parent d51cdf664a
commit 0c3813b05c
26 changed files with 479 additions and 490 deletions

12
examples/init.pp Normal file
View File

@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Inc. is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# https://puppet.com/docs/puppet/latest/bgtm.html#testing-your-module
#
include ::placement

View File

@ -5,45 +5,45 @@
# === Parameters
#
# [*password*]
# (required) Password for connecting to Nova Placement API service in
# (Required) Password for connecting to Nova Placement API service in
# admin context through the OpenStack Identity service.
#
# [*auth_type*]
# Name of the auth type to load (string value)
# (Optional) Name of the auth type to load.
# Defaults to 'password'
#
# [*project_name*]
# (optional) Project name for connecting to Nova Placement API service in
# (Optional) Project name for connecting to Nova Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'services'
#
# [*project_domain_name*]
# (optional) Project Domain name for connecting to Nova Placement API service in
# (Optional) Project Domain name for connecting to Nova Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*user_domain_name*]
# (optional) User Domain name for connecting to Nova Placement API service in
# (Optional) User Domain name for connecting to Nova Placement API service in
# admin context through the OpenStack Identity service.
# Defaults to 'Default'
#
# [*region_name*]
# (optional) Region name for connecting to Nova Placement API service in admin context
# (Optional) Region name for connecting to Nova Placement API service in admin context
# through the OpenStack Identity service.
# Defaults to 'RegionOne'
#
# [*valid_interfaces*]
# (optional) Interface names used for getting the keystone endpoint for
# (Optional) Interface names used for getting the keystone endpoint for
# the placement API. Comma separated if multiple.
# Defaults to $::os_service_default
#
# [*username*]
# (optional) Username for connecting to Nova Placement API service in admin context
# (Optional) Username for connecting to Nova Placement API service in admin context
# through the OpenStack Identity service.
# Defaults to 'placement'
#
# [*auth_url*]
# (optional) Points to the OpenStack Identity server IP and port.
# (Optional) Points to the OpenStack Identity server IP and port.
# This is the Identity (keystone) admin API server IP and port value,
# and not the Identity service API IP and port.
# Defaults to 'http://127.0.0.1:5000/v3'

View File

@ -33,15 +33,6 @@
# Only used with mysql modules >= 2.2.
# Defaults to 'utf8_general_ci'
#
# == Dependencies
# Class['mysql::server']
#
# == Examples
#
# == Authors
#
# == Copyright
#
class placement::db::mysql(
$password,
$dbname = 'placement',

View File

@ -16,21 +16,13 @@
# (Optional) User to connect to the database.
# Defaults to 'placement'.
#
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
#
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'
#
# == Dependencies
#
# == Examples
#
# == Authors
#
# == Copyright
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'
#
class placement::db::postgresql(
$password,

View File

@ -13,21 +13,21 @@
# === Parameters:
#
# [*package_name*]
# (mandatory) The package name (for the generic_service)
# (Required) The package name (for the generic_service)
#
# [*service_name*]
# (mandatory) The service name (for the generic_service)
# (Required) The service name (for the generic_service)
#
# [*enabled*]
# (optional) Define if the service must be enabled or not
# (Optional) Define if the service must be enabled or not
# Defaults to false.
#
# [*manage_service*]
# (optional) Manage or not the service (if a service_name is provided).
# (Optional) Manage or not the service (if a service_name is provided).
# Defaults to true.
#
# [*ensure_package*]
# (optional) Control the ensure parameter for the package resource.
# (Optional) Control the ensure parameter for the package resource.
# Defaults to 'present'.
#
define placement::generic_service(

View File

@ -5,7 +5,7 @@
# === Parameters
#
# [*ensure_package*]
# (optional) The state of nova packages
# (Optional) The state of nova packages
# Defaults to 'present'
#
# [*sync_db*]
@ -13,9 +13,8 @@
# Defaults to true
class placement(
$ensure_package = 'present',
$sync_db = true,
$ensure_package = 'present',
$sync_db = true,
) inherits placement::params {
include ::placement::deps

View File

@ -5,22 +5,27 @@
# === Parameters
#
# [*password*]
# (required) Password for placement user.
# (Required) Password for placement user.
#
# [*ensure*]
# (optional) Ensure state of keystone service identity. Defaults to 'present'.
# (Optional) Ensure state of keystone service identity.
# Defaults to 'present'.
#
# [*auth_name*]
# Username for placement service. Defaults to 'placement'.
# (Optional) Username for placement service.
# Defaults to 'placement'.
#
# [*email*]
# Email for placement user. Defaults to 'placement@localhost'.
# (Optional) Email for placement user.
# Defaults to 'placement@localhost'.
#
# [*tenant*]
# Tenant for placement user. Defaults to 'services'.
# (Optional) Tenant for placement user.
# Defaults to 'services'.
#
# [*configure_endpoint*]
# Should placement endpoint be configured? Defaults to 'true'.
# (Optional) Should placement endpoint be configured?
# Defaults to true.
#
# [*configure_user*]
# (Optional) Should the service user be configured?
@ -31,29 +36,34 @@
# Defaults to 'true'.
#
# [*service_type*]
# Type of service. Defaults to 'placement'.
# (Optional) Type of service.
# Defaults to 'placement'.
#
# [*region*]
# Region for endpoint. Defaults to 'RegionOne'.
# (Optional) Region for endpoint.
# Defaults to 'RegionOne'.
#
# [*service_name*]
# (optional) Name of the service.
# (Optional) Name of the service.
# Defaults to the value of 'placement'.
#
# [*service_description*]
# (optional) Description of the service.
# Default to 'Placement Service'
# (Optional) Description of the service.
# Defaults to 'Placement Service'
#
# [*public_url*]
# (optional) The endpoint's public url. (Defaults to 'http://127.0.0.1/placement')
# (Optional) The endpoint's public url.
# Defaults to 'http://127.0.0.1/placement'
# This url should *not* contain any trailing '/'.
#
# [*admin_url*]
# (optional) The endpoint's admin url. (Defaults to 'http://127.0.0.1/placement')
# (Optional) The endpoint's admin url.
# Defaults to 'http://127.0.0.1/placement'
# This url should *not* contain any trailing '/'.
#
# [*internal_url*]
# (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1/placement')
# (Optional) The endpoint's internal url.
# Defaults to 'http://127.0.0.1/placement'
#
class placement::keystone::auth (
$password,

View File

@ -232,4 +232,3 @@ class placement::keystone::authtoken(
token_cache_time => $token_cache_time,
}
}

View File

@ -4,103 +4,103 @@
#
# == parameters
#
# [*debug*]
# (Optional) Should the daemons log debug messages
# Defaults to $::os_service_default
# [*debug*]
# (Optional) Should the daemons log debug messages
# Defaults to $::os_service_default
#
# [*use_syslog*]
# (Optional) Use syslog for logging.
# Defaults to $::os_service_default
# [*use_syslog*]
# (Optional) Use syslog for logging.
# Defaults to $::os_service_default
#
# [*use_json*]
# (Optional) Use json for logging.
# Defaults to $::os_service_default
# [*use_json*]
# (Optional) Use json for logging.
# Defaults to $::os_service_default
#
# [*use_journal*]
# (Optional) Use journal for logging.
# Defaults to $::os_service_default
# [*use_journal*]
# (Optional) Use journal for logging.
# Defaults to $::os_service_default
#
# [*use_stderr*]
# (optional) Use stderr for logging
# Defaults to $::os_service_default
# [*use_stderr*]
# (Optional) Use stderr for logging
# Defaults to $::os_service_default
#
# [*syslog_log_facility*]
# (Optional) Syslog facility to receive log lines.
# Defaults to $::os_service_default
# [*syslog_log_facility*]
# (Optional) Syslog facility to receive log lines.
# Defaults to $::os_service_default
#
# [*log_dir*]
# (optional) Directory where logs should be stored.
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/placement'.
# [*log_dir*]
# (Optional) Directory where logs should be stored.
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/placement'.
#
# [*log_file*]
# (optional) File where logs should be stored.
# Defaults to '/var/log/placement/placement.log'
# [*log_file*]
# (Optional) File where logs should be stored.
# Defaults to '/var/log/placement/placement.log'
#
# [*logging_context_format_string*]
# (optional) Format string to use for log messages with context.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
# [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
#
# [*logging_default_format_string*]
# (optional) Format string to use for log messages without context.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [-] %(instance)s%(message)s'
# [*logging_default_format_string*]
# (Optional) Format string to use for log messages without context.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [-] %(instance)s%(message)s'
#
# [*logging_debug_format_suffix*]
# (optional) Formatted data to append to log format when level is DEBUG.
# Defaults to $::os_service_default
# Example: '%(funcName)s %(pathname)s:%(lineno)d'
# [*logging_debug_format_suffix*]
# (Optional) Formatted data to append to log format when level is DEBUG.
# Defaults to $::os_service_default
# Example: '%(funcName)s %(pathname)s:%(lineno)d'
#
# [*logging_exception_prefix*]
# (optional) Prefix each line of exception output with this format.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
# [*logging_exception_prefix*]
# (Optional) Prefix each line of exception output with this format.
# Defaults to $::os_service_default
# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
#
# [*log_config_append*]
# (optional) The name of an additional logging configuration file.
# Defaults to $::os_service_default
# See https://docs.python.org/2/howto/logging.html
# [*log_config_append*]
# (Optional) The name of an additional logging configuration file.
# Defaults to $::os_service_default
# See https://docs.python.org/2/howto/logging.html
#
# [*default_log_levels*]
# (optional) Hash of logger (keys) and level (values) pairs.
# Defaults to $::os_service_default
# Example:
# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
# 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
# 'oslo.messaging' => 'INFO', 'iso8601' => 'WARN',
# 'requests.packages.urllib3.connectionpool' => 'WARN',
# 'urllib3.connectionpool' => 'WARN',
# 'websocket' => 'WARN', 'placementmiddleware' => 'WARN',
# 'routes.middleware' => 'WARN', stevedore => 'WARN' }
# [*default_log_levels*]
# (Optional) Hash of logger (keys) and level (values) pairs.
# Defaults to $::os_service_default
# Example:
# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
# 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
# 'oslo.messaging' => 'INFO', 'iso8601' => 'WARN',
# 'requests.packages.urllib3.connectionpool' => 'WARN',
# 'urllib3.connectionpool' => 'WARN',
# 'websocket' => 'WARN', 'placementmiddleware' => 'WARN',
# 'routes.middleware' => 'WARN', stevedore => 'WARN' }
#
# [*publish_errors*]
# (optional) Publish error events (boolean value).
# Defaults to $::os_service_default
# [*publish_errors*]
# (Optional) Publish error events (boolean value).
# Defaults to $::os_service_default
#
# [*fatal_deprecations*]
# (optional) Make deprecations fatal (boolean value)
# Defaults to $::os_service_default
# [*fatal_deprecations*]
# (Optional) Make deprecations fatal (boolean value)
# Defaults to $::os_service_default
#
# [*instance_format*]
# (optional) If an instance is passed with the log message, format it
# like this (string value).
# Defaults to undef.
# Example: '[instance: %(uuid)s] '
# [*instance_format*]
# (Optional) If an instance is passed with the log message, format it
# like this (string value).
# Defaults to undef.
# Example: '[instance: %(uuid)s] '
#
# [*instance_uuid_format*]
# (optional) If an instance UUID is passed with the log message, format
# it like this (string value).
# Defaults to $::os_service_default
# Example: instance_uuid_format='[instance: %(uuid)s] '
# [*instance_uuid_format*]
# (Optional) If an instance UUID is passed with the log message, format
# it like this (string value).
# Defaults to $::os_service_default
# Example: instance_uuid_format='[instance: %(uuid)s] '
#
# [*log_date_format*]
# (Optional) Format string for %%(asctime)s in log records.
# Defaults to $::os_service_default
# Example: 'Y-%m-%d %H:%M:%S'
#
# [*log_date_format*]
# (optional) Format string for %%(asctime)s in log records.
# Defaults to $::os_service_default
# Example: 'Y-%m-%d %H:%M:%S'
class placement::logging(
$use_syslog = $::os_service_default,
$use_json = $::os_service_default,

View File

@ -3,13 +3,14 @@
class placement::params {
include ::placement::deps
include ::openstacklib::defaults
if ($::os_package_type == 'debian') or ($::operatingsystem == 'Fedora') {
$pyvers = '3'
} else {
$pyvers = '2'
}
$group = 'placement'
case $::osfamily {
@ -25,7 +26,6 @@ class placement::params {
$wsgi_script_source = '/usr/bin/placement-api'
$wsgi_script_path = '/var/www/cgi-bin/placement'
$httpd_config_file = '/etc/httpd/conf.d/00-placement-api.conf'
}
'Debian': {
$package_name = 'placement-api'

View File

@ -5,7 +5,7 @@
# === Parameters
#
# [*policies*]
# (optional) Set of policies to configure for placement
# (Optional) Set of policies to configure for placement
# Example :
# {
# 'placement-context_is_admin' => {
@ -20,7 +20,7 @@
# Defaults to empty hash.
#
# [*policy_path*]
# (optional) Path to the nova policy.json file
# (Optional) Path to the nova policy.json file
# Defaults to /etc/placement/policy.json
#
class placement::policy (

View File

@ -22,55 +22,55 @@
#
# == Parameters
#
# [*servername*]
# The servername for the virtualhost.
# Optional. Defaults to $::fqdn
# [*servername*]
# (Optional) The servername for the virtualhost.
# Defaults to $::fqdn
#
# [*api_port*]
# The port for Placement API service.
# Optional. Defaults to 80
# [*api_port*]
# (Optional) The port for Placement API service.
# Defaults to 80
#
# [*bind_host*]
# The host/ip address Apache will listen on.
# Optional. Defaults to undef (listen on all ip addresses).
# [*bind_host*]
# (Optional) The host/ip address Apache will listen on.
# Defaults to undef (listen on all ip addresses).
#
# [*path*]
# The prefix for the endpoint.
# Optional. Defaults to '/placement'
# [*path*]
# (Optional) The prefix for the endpoint.
# Defaults to '/placement'
#
# [*ssl*]
# Use ssl ? (boolean)
# Optional. Defaults to true
# [*ssl*]
# (Optional) Use ssl ? (boolean)
# Defaults to true
#
# [*workers*]
# Number of WSGI workers to spawn.
# Optional. Defaults to 1
# [*workers*]
# (Optional) Number of WSGI workers to spawn.
# Defaults to 1
#
# [*priority*]
# (optional) The priority for the vhost.
# Defaults to '10'
# [*priority*]
# (Optional) The priority for the vhost.
# Defaults to '10'
#
# [*threads*]
# (optional) The number of threads for the vhost.
# Defaults to $::os_workers
# [*threads*]
# (Optional) The number of threads for the vhost.
# Defaults to $::os_workers
#
# [*wsgi_process_display_name*]
# (optional) Name of the WSGI process display-name.
# Defaults to undef
# [*wsgi_process_display_name*]
# (Optional) Name of the WSGI process display-name.
# Defaults to undef
#
# [*ensure_package*]
# (optional) Control the ensure parameter for the Placement API package ressource.
# Defaults to 'present'
# [*ensure_package*]
# (Optional) Control the ensure parameter for the Placement API package ressource.
# Defaults to 'present'
#
# [*ssl_cert*]
# [*ssl_key*]
# [*ssl_chain*]
# [*ssl_ca*]
# [*ssl_crl_path*]
# [*ssl_crl*]
# [*ssl_certs_dir*]
# apache::vhost ssl parameters.
# Optional. Default to apache::vhost 'ssl_*' defaults.
# [*ssl_cert*]
# [*ssl_key*]
# [*ssl_chain*]
# [*ssl_ca*]
# [*ssl_crl_path*]
# [*ssl_crl*]
# [*ssl_certs_dir*]
# (Optional) apache::vhost ssl parameters.
# Default to apache::vhost 'ssl_*' defaults.
#
# == Examples
#
@ -79,23 +79,23 @@
# class { 'placement::wsgi::apache': }
#
class placement::wsgi::apache (
$servername = $::fqdn,
$api_port = 80,
$bind_host = undef,
$path = '/placement',
$ssl = true,
$workers = 1,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_chain = undef,
$ssl_ca = undef,
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$wsgi_process_display_name = undef,
$threads = $::os_workers,
$priority = '10',
$ensure_package = 'present',
$servername = $::fqdn,
$api_port = 80,
$bind_host = undef,
$path = '/placement',
$ssl = true,
$workers = 1,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_chain = undef,
$ssl_ca = undef,
$ssl_crl_path = undef,
$ssl_crl = undef,
$ssl_certs_dir = undef,
$wsgi_process_display_name = undef,
$threads = $::os_workers,
$priority = '10',
$ensure_package = 'present',
) {
include ::placement::params

View File

@ -7,23 +7,23 @@
},
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=4.0.0 <5.0.0"
"version_requirement": ">=5.0.0 <6.0.0"
},
{
"name": "openstack/keystone",
"version_requirement": ">=11.0.0 <12.0.0"
"version_requirement": ">=14.1.0 <15.0.0"
},
{
"name": "openstack/openstacklib",
"version_requirement": ">=11.0.0 <12.0.0"
"version_requirement": ">=14.1.0 <15.0.0"
},
{
"name": "openstack/oslo",
"version_requirement": ">=11.0.0 <12.0.0"
"version_requirement": ">=14.1.0 <15.0.0"
},
{
"name": "puppetlabs/apache",
"version_requirement": ">=1.0.0 <2.0.0"
"version_requirement": ">=3.0.0"
}
],
"description": "Installs and configures OpenStack Placement.",

View File

@ -4,7 +4,7 @@ summary = Puppet module for OpenStack placement
description-file =
README.md
author = OpenStack
author-email = openstack-dicuss@lists.openstack.org
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/puppet-openstack-guide/latest
classifier =
Intended Audience :: Developers

View File

@ -1,9 +1,9 @@
require 'spec_helper'
describe 'placement::config' do
let :default_params do
{ :auth_type => 'password',
{
:auth_type => 'password',
:project_name => 'services',
:project_domain_name => 'Default',
:region_name => 'RegionOne',
@ -14,23 +14,24 @@ describe 'placement::config' do
end
let :params do
{ :password => 's3cr3t' }
{
:password => 's3cr3t'
}
end
shared_examples 'placement::config' do
context 'with required parameters' do
it 'configures [placement] parameters in placement.conf' do
is_expected.to contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_placement_config('placement/auth_type').with_value(default_params[:auth_type])
is_expected.to contain_placement_config('placement/project_name').with_value(default_params[:project_name])
is_expected.to contain_placement_config('placement/project_domain_name').with_value(default_params[:project_domain_name])
is_expected.to contain_placement_config('placement/region_name').with_value(default_params[:region_name])
is_expected.to contain_placement_config('placement/valid_interfaces').with_value('<SERVICE DEFAULT>')
is_expected.to contain_placement_config('placement/username').with_value(default_params[:username])
is_expected.to contain_placement_config('placement/user_domain_name').with_value(default_params[:user_domain_name])
is_expected.to contain_placement_config('placement/auth_url').with_value(default_params[:auth_url])
end
it {
should contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
should contain_placement_config('placement/auth_type').with_value(default_params[:auth_type])
should contain_placement_config('placement/project_name').with_value(default_params[:project_name])
should contain_placement_config('placement/project_domain_name').with_value(default_params[:project_domain_name])
should contain_placement_config('placement/region_name').with_value(default_params[:region_name])
should contain_placement_config('placement/valid_interfaces').with_value('<SERVICE DEFAULT>')
should contain_placement_config('placement/username').with_value(default_params[:username])
should contain_placement_config('placement/user_domain_name').with_value(default_params[:user_domain_name])
should contain_placement_config('placement/auth_url').with_value(default_params[:auth_url])
}
end
context 'when overriding class parameters' do
@ -47,17 +48,17 @@ describe 'placement::config' do
)
end
it 'configures [placement] parameters in placement.conf' do
is_expected.to contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_placement_config('placement/auth_type').with_value(params[:auth_type])
is_expected.to contain_placement_config('placement/project_name').with_value(params[:project_name])
is_expected.to contain_placement_config('placement/project_domain_name').with_value(params[:project_domain_name])
is_expected.to contain_placement_config('placement/region_name').with_value(params[:region_name])
is_expected.to contain_placement_config('placement/valid_interfaces').with_value(params[:valid_interfaces])
is_expected.to contain_placement_config('placement/username').with_value(params[:username])
is_expected.to contain_placement_config('placement/user_domain_name').with_value(params[:user_domain_name])
is_expected.to contain_placement_config('placement/auth_url').with_value(params[:auth_url])
end
it {
should contain_placement_config('placement/password').with_value(params[:password]).with_secret(true)
should contain_placement_config('placement/auth_type').with_value(params[:auth_type])
should contain_placement_config('placement/project_name').with_value(params[:project_name])
should contain_placement_config('placement/project_domain_name').with_value(params[:project_domain_name])
should contain_placement_config('placement/region_name').with_value(params[:region_name])
should contain_placement_config('placement/valid_interfaces').with_value(params[:valid_interfaces])
should contain_placement_config('placement/username').with_value(params[:username])
should contain_placement_config('placement/user_domain_name').with_value(params[:user_domain_name])
should contain_placement_config('placement/auth_url').with_value(params[:auth_url])
}
end
end

View File

@ -1,22 +1,19 @@
require 'spec_helper'
describe 'placement::db::mysql' do
let :pre_condition do
'include mysql::server'
end
let :required_params do
{ :password => 'fooboozoo_default_password', }
let :params do
{
:password => 'fooboozoo_default_password',
}
end
shared_examples_for 'placement-db-mysql' do
shared_examples 'placement::db::mysql' do
context 'with only required params' do
let :params do
required_params
end
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
it { should contain_openstacklib__db__mysql('placement').with(
:user => 'placement',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'placement',
@ -27,11 +24,11 @@ describe 'placement::db::mysql' do
end
context 'overriding allowed_hosts param to array' do
let :params do
{ :allowed_hosts => ['127.0.0.1','%'] }.merge(required_params)
before do
params.merge!( :allowed_hosts => ['127.0.0.1', '%'] )
end
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
it { should contain_openstacklib__db__mysql('placement').with(
:user => 'placement',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'placement',
@ -43,11 +40,11 @@ describe 'placement::db::mysql' do
end
describe 'overriding allowed_hosts param to string' do
let :params do
{ :allowed_hosts => '192.168.1.1' }.merge(required_params)
before do
params.merge!( :allowed_hosts => '192.168.1.1' )
end
it { is_expected.to contain_openstacklib__db__mysql('placement').with(
it { should contain_openstacklib__db__mysql('placement').with(
:user => 'placement',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'placement',
@ -67,7 +64,7 @@ describe 'placement::db::mysql' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'placement-db-mysql'
it_behaves_like 'placement::db::mysql'
end
end
end

View File

@ -1,22 +1,19 @@
require 'spec_helper'
describe 'placement::db::postgresql' do
let :pre_condition do
'include postgresql::server'
end
let :required_params do
{ :password => 'pw' }
let :params do
{
:password => 'pw'
}
end
shared_examples_for 'placement-db-postgresql' do
shared_examples 'placement::db::postgresql' do
context 'with only required parameters' do
let :params do
required_params
end
it { is_expected.to contain_postgresql__server__db('placement').with(
it { should contain_postgresql__server__db('placement').with(
:user => 'placement',
:password => 'md51c1dd6fb4863b046eecc6a6b91f53f7f'
)}
@ -28,10 +25,10 @@ describe 'placement::db::postgresql' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts({ :concat_basedir => '/var/lib/puppet/concat' }))
facts.merge!(OSDefaults.get_facts( :concat_basedir => '/var/lib/puppet/concat' ))
end
it_behaves_like 'placement-db-postgresql'
it_behaves_like 'placement::db::postgresql'
end
end
end

View File

@ -3,43 +3,47 @@ require 'spec_helper'
describe 'placement::db' do
shared_examples 'placement::db' do
context 'with default parameters' do
it 'configures placement_database' do
is_expected.to contain_placement_config('placement_database/connection').with_value('sqlite:////var/lib/placement/placement.sqlite')
end
it { should contain_placement_config('placement_database/connection').with_value('sqlite:////var/lib/placement/placement.sqlite') }
end
context 'with specific parameters' do
let :params do
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
{
:database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
}
end
it 'configures placement_database' do
is_expected.to contain_placement_config('placement_database/connection').with_value('mysql+pymysql://placement:placement@localhost/placement')
end
it { should contain_placement_config('placement_database/connection').with_value('mysql+pymysql://placement:placement@localhost/placement') }
end
context 'with incorrect database_connection string' do
let :params do
{ :database_connection => 'foodb://placement:placement@localhost/placement', }
{
:database_connection => 'foodb://placement:placement@localhost/placement',
}
end
it_raises 'a Puppet::Error', /validate_re/
it { should raise_error(Puppet::Error, /validate_re/) }
end
context 'with incorrect pymysql database_connection string' do
let :params do
{ :database_connection => 'foo+pymysql://placement:placement@localhost/placement', }
{
:database_connection => 'foo+pymysql://placement:placement@localhost/placement',
}
end
it_raises 'a Puppet::Error', /validate_re/
it { should raise_error(Puppet::Error, /validate_re/) }
end
end
shared_examples_for 'placement::db on Debian' do
shared_examples 'placement::db on Debian' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement', }
{
:database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
}
end
end
end
@ -47,7 +51,9 @@ describe 'placement::db' do
shared_examples_for 'placement::db on RedHat' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://placement:placement@localhost/placement', }
{
:database_connection => 'mysql+pymysql://placement:placement@localhost/placement',
}
end
end
end
@ -60,8 +66,8 @@ describe 'placement::db' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'placement::db'
it_configures "placement::db on #{facts[:osfamily]}"
it_behaves_like 'placement::db'
it_behaves_like "placement::db on #{facts[:osfamily]}"
end
end
end

View File

@ -1,27 +1,22 @@
require 'spec_helper'
describe 'placement::db::sync' do
shared_examples_for 'placement-manage-db-sync' do
it 'runs placement-manage-db-sync' do
is_expected.to contain_exec('placement-manage-db-sync').with(
:command => 'placement-manage db sync',
:path => [ '/bin', '/usr/bin', '/usr/local/bin'],
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:user => 'placement',
:logoutput => 'on_failure',
:subscribe => ['Anchor[placement::install::end]',
'Anchor[placement::config::end]',
'Anchor[placement::db::end]',
'Anchor[placement::dbsync::begin]'],
:notify => 'Anchor[placement::dbsync::end]',
:tag => ['placement-exec', 'openstack-db']
)
end
shared_examples 'placement::db::sync' do
it { is_expected.to contain_exec('placement-manage-db-sync').with(
:command => 'placement-manage db sync',
:path => [ '/bin', '/usr/bin', '/usr/local/bin'],
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:user => 'placement',
:logoutput => 'on_failure',
:subscribe => ['Anchor[placement::install::end]',
'Anchor[placement::config::end]',
'Anchor[placement::db::end]',
'Anchor[placement::dbsync::begin]'],
:notify => 'Anchor[placement::dbsync::end]',
:tag => ['placement-exec', 'openstack-db']
)}
end
on_supported_os({
@ -29,14 +24,10 @@ describe 'placement::db::sync' do
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts({
:os_workers => 8,
:concat_basedir => '/var/lib/puppet/concat'
}))
facts.merge(OSDefaults.get_facts())
end
it_configures 'placement-manage-db-sync'
it_behaves_like 'placement::db::sync'
end
end
end

View File

@ -1,83 +1,86 @@
#
# Unit tests for placement::keystone::auth
#
require 'spec_helper'
describe 'placement::keystone::auth' do
shared_examples_for 'placement-keystone-auth' do
shared_examples 'placement::keystone::auth' do
context 'with default class parameters' do
let :params do
{ :password => 'placement_password',
:tenant => 'foobar' }
{
:password => 'placement_password',
:tenant => 'foobar'
}
end
it { is_expected.to contain_keystone_user('placement').with(
it { should contain_keystone_user('placement').with(
:ensure => 'present',
:password => 'placement_password',
) }
)}
it { is_expected.to contain_keystone_user_role('placement@foobar').with(
it { should contain_keystone_user_role('placement@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { is_expected.to contain_keystone_service('placement::placement').with(
it { should contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Placement Service'
) }
)}
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
it { should contain_keystone_endpoint('RegionOne/placement::placement').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1/placement',
:admin_url => 'http://127.0.0.1/placement',
:internal_url => 'http://127.0.0.1/placement',
) }
)}
end
context 'when overriding URL parameters' do
let :params do
{ :password => 'placement_password',
{
:password => 'placement_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', }
:admin_url => 'http://10.10.10.12:81',
}
end
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement').with(
it { should contain_keystone_endpoint('RegionOne/placement::placement').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
context 'when overriding auth name' do
let :params do
{ :password => 'foo',
:auth_name => 'placementy' }
{
:password => 'foo',
:auth_name => 'placementy'
}
end
it { is_expected.to contain_keystone_user('placementy') }
it { is_expected.to contain_keystone_user_role('placementy@services') }
it { is_expected.to contain_keystone_service('placement::placement') }
it { is_expected.to contain_keystone_endpoint('RegionOne/placement::placement') }
it { should contain_keystone_user('placementy') }
it { should contain_keystone_user_role('placementy@services') }
it { should contain_keystone_service('placement::placement') }
it { should contain_keystone_endpoint('RegionOne/placement::placement') }
end
context 'when overriding service name' do
let :params do
{ :service_name => 'placement_service',
{
:service_name => 'placement_service',
:auth_name => 'placement',
:password => 'placement_password' }
:password => 'placement_password'
}
end
it { is_expected.to contain_keystone_user('placement') }
it { is_expected.to contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('placement_service::placement') }
it { is_expected.to contain_keystone_endpoint('RegionOne/placement_service::placement') }
it { should contain_keystone_user('placement') }
it { should contain_keystone_user_role('placement@services') }
it { should contain_keystone_service('placement_service::placement') }
it { should contain_keystone_endpoint('RegionOne/placement_service::placement') }
end
context 'when disabling user configuration' do
let :params do
{
:password => 'placement_password',
@ -85,17 +88,16 @@ describe 'placement::keystone::auth' do
}
end
it { is_expected.not_to contain_keystone_user('placement') }
it { is_expected.to contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('placement::placement').with(
it { should_not contain_keystone_user('placement') }
it { should contain_keystone_user_role('placement@services') }
it { should contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Placement Service'
) }
)}
end
context 'when disabling user and user role configuration' do
let :params do
{
:password => 'placement_password',
@ -104,17 +106,16 @@ describe 'placement::keystone::auth' do
}
end
it { is_expected.not_to contain_keystone_user('placement') }
it { is_expected.not_to contain_keystone_user_role('placement@services') }
it { is_expected.to contain_keystone_service('placement::placement').with(
it { should_not contain_keystone_user('placement') }
it { should_not contain_keystone_user_role('placement@services') }
it { should contain_keystone_service('placement::placement').with(
:ensure => 'present',
:description => 'Placement Service'
) }
)}
end
context 'when using ensure absent' do
let :params do
{
:password => 'placement_password',
@ -122,8 +123,7 @@ describe 'placement::keystone::auth' do
}
end
it { is_expected.to contain_keystone__resource__service_identity('placement').with_ensure('absent') }
it { should contain_keystone__resource__service_identity('placement').with_ensure('absent') }
end
end
@ -135,7 +135,7 @@ describe 'placement::keystone::auth' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'placement-keystone-auth'
it_behaves_like 'placement::keystone::auth'
end
end
end

View File

@ -1,16 +1,15 @@
require 'spec_helper'
describe 'placement::keystone::authtoken' do
let :params do
{ :password => 'secrete', }
{
:password => 'secrete',
}
end
shared_examples 'placement authtoken' do
shared_examples 'placement::keystone::authtoken' do
context 'with default parameters' do
it 'configure keystone_authtoken' do
it {
is_expected.to contain_placement_config('keystone_authtoken/username').with_value('placement')
is_expected.to contain_placement_config('keystone_authtoken/password').with_value('secrete')
is_expected.to contain_placement_config('keystone_authtoken/auth_url').with_value('http://localhost:5000')
@ -42,48 +41,48 @@ describe 'placement::keystone::authtoken' do
is_expected.to contain_placement_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_placement_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_placement_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
end
}
end
context 'when overriding parameters' do
before do
params.merge!({
:www_authenticate_uri => 'https://10.0.0.1:9999/',
:username => 'myuser',
:password => 'mypasswd',
:auth_url => 'https://127.0.0.1:5000',
: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',
:delay_auth_decision => false,
:enforce_token_bind => 'permissive',
: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',
:token_cache_time => '301',
:www_authenticate_uri => 'https://10.0.0.1:9999/',
:username => 'myuser',
:password => 'mypasswd',
:auth_url => 'https://127.0.0.1:5000',
: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',
:delay_auth_decision => false,
:enforce_token_bind => 'permissive',
: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',
:token_cache_time => '301',
})
end
it 'configure keystone_authtoken' do
it {
is_expected.to contain_placement_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
is_expected.to contain_placement_config('keystone_authtoken/username').with_value(params[:username])
is_expected.to contain_placement_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
@ -115,11 +114,9 @@ describe 'placement::keystone::authtoken' do
is_expected.to contain_placement_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
is_expected.to contain_placement_config('keystone_authtoken/region_name').with_value(params[:region_name])
is_expected.to contain_placement_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
it { is_expected.to contain_package('python-memcache') }
end
end
@ -131,8 +128,7 @@ describe 'placement::keystone::authtoken' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'placement authtoken'
it_behaves_like 'placement::keystone::authtoken'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'placement::logging' do
let :params do
{
}
@ -11,111 +10,109 @@ describe 'placement::logging' do
{
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
:log_config_append => '/etc/placement/logging.conf',
:publish_errors => true,
:default_log_levels => {
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
:log_config_append => '/etc/placement/logging.conf',
:publish_errors => true,
:default_log_levels => {
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
'requests.packages.urllib3.connectionpool' => 'WARN' },
:fatal_deprecations => true,
:instance_format => '[instance: %(uuid)s] ',
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/placement_random.log',
:debug => true,
:fatal_deprecations => true,
:instance_format => '[instance: %(uuid)s] ',
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/placement_random.log',
:debug => true,
}
end
shared_examples_for 'placement-logging' do
shared_examples 'placement::logging' do
context 'with basic logging options and default settings' do
it_configures 'basic default logging settings'
it_behaves_like 'basic default logging settings'
end
context 'with basic logging options and non-default settings' do
before { params.merge!( log_params ) }
it_configures 'basic non-default logging settings'
before do
params.merge!( log_params )
end
it_behaves_like 'basic non-default logging settings'
end
context 'with extended logging options' do
before { params.merge!( log_params ) }
it_configures 'logging params set'
before do
params.merge!( log_params )
end
it_behaves_like 'logging params set'
end
context 'without extended logging options' do
it_configures 'logging params unset'
it_behaves_like 'logging params unset'
end
end
shared_examples 'basic default logging settings' do
it 'configures placement logging settings with default values' do
is_expected.to contain_oslo__log('placement_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/placement',
:log_file => '/var/log/placement/placement.log',
:debug => '<SERVICE DEFAULT>',
)
end
it { should contain_oslo__log('placement_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
:use_stderr => '<SERVICE DEFAULT>',
:syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/placement',
:log_file => '/var/log/placement/placement.log',
:debug => '<SERVICE DEFAULT>',
)}
end
shared_examples 'basic non-default logging settings' do
it 'configures placement logging settings with non-default values' do
is_expected.to contain_oslo__log('placement_config').with(
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/placement_random.log',
:debug => true,
)
end
it { should contain_oslo__log('placement_config').with(
:use_syslog => true,
:use_json => true,
:use_journal => true,
:use_stderr => false,
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/placement_random.log',
:debug => true,
)}
end
shared_examples_for 'logging params set' do
it 'enables logging params' do
is_expected.to contain_oslo__log('placement_config').with(
:logging_context_format_string =>
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
:log_config_append => '/etc/placement/logging.conf',
:publish_errors => true,
:default_log_levels => {
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
'requests.packages.urllib3.connectionpool' => 'WARN' },
:fatal_deprecations => true,
:instance_format => '[instance: %(uuid)s] ',
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
)
end
shared_examples 'logging params set' do
it { should contain_oslo__log('placement_config').with(
:logging_context_format_string =>
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
:log_config_append => '/etc/placement/logging.conf',
:publish_errors => true,
:default_log_levels => {
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
'sqlalchemy' => 'WARN', 'suds' => 'INFO', 'iso8601' => 'WARN',
'requests.packages.urllib3.connectionpool' => 'WARN' },
:fatal_deprecations => true,
:instance_format => '[instance: %(uuid)s] ',
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
)}
end
shared_examples_for 'logging params unset' do
shared_examples 'logging params unset' do
[ :logging_context_format_string, :logging_default_format_string,
:logging_debug_format_suffix, :logging_exception_prefix,
:log_config_append, :publish_errors,
:default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format,
:log_date_format, ].each { |param|
it { is_expected.to contain_oslo__log('placement_config').with("#{param}" => '<SERVICE DEFAULT>') }
it { should contain_oslo__log('placement_config').with("#{param}" => '<SERVICE DEFAULT>') }
}
end
@ -127,7 +124,7 @@ describe 'placement::logging' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'placement-logging'
it_behaves_like 'placement::logging'
end
end
end

View File

@ -1,7 +1,7 @@
require 'spec_helper'
describe 'placement::policy' do
shared_examples_for 'placement-policies' do
shared_examples 'placement::policy' do
let :params do
{
:policy_path => '/etc/placement/policy.json',
@ -14,14 +14,12 @@ describe 'placement::policy' do
}
end
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'placement',
})
end
it { is_expected.to contain_openstacklib__policy__base('context_is_admin').with(
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'placement',
)}
end
on_supported_os({
@ -32,7 +30,7 @@ describe 'placement::policy' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'placement-policies'
it_behaves_like 'placement::policy'
end
end
end

View File

@ -1,7 +1,7 @@
require 'spec_helper'
describe 'placement::generic_service' do
describe 'package should come before service' do
shared_examples 'placement::generic_service' do
let :pre_condition do
'include placement'
end
@ -13,25 +13,33 @@ describe 'placement::generic_service' do
}
end
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
let :title do
'foo'
end
it { is_expected.to contain_service('placement-foo').with(
'name' => 'food',
'ensure' => 'running',
'enable' => true
it { should contain_service('placement-foo').with(
:name => 'food',
:ensure => 'running',
:enable => true,
)}
it { is_expected.to contain_service('placement-foo').that_subscribes_to(
it { should contain_service('placement-foo').that_subscribes_to(
'Anchor[placement::service::begin]',
)}
it { is_expected.to contain_service('placement-foo').that_notifies(
it { should contain_service('placement-foo').that_notifies(
'Anchor[placement::service::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 'placement::generic_service'
end
end
end

View File

@ -4,9 +4,4 @@ require 'puppetlabs_spec_helper/module_spec_helper'
require 'shared_examples'
require 'puppet-openstack_spec_helper/facts'
RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
end
at_exit { RSpec::Puppet::Coverage.report! }

View File

@ -1,5 +1,5 @@
[tox]
minversion = 1.6
minversion = 2.0
skipsdist = True
envlist = releasenotes