Add tasks for travis-ci
Rakefile with tasks for syntax and spec tests is added. Fix discovered issues to pass all tests. Signed-off-by: Michal Skalski <mskalski@mirantis.com>
This commit is contained in:
parent
6fdf14adf4
commit
f92959b20f
|
@ -0,0 +1,11 @@
|
|||
fixtures:
|
||||
repositories:
|
||||
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
|
||||
inifile: "https://github.com/puppetlabs/puppetlabs-inifile"
|
||||
openstacklib: "https://github.com/openstack/puppet-openstacklib"
|
||||
postgresql: "https://github.com/puppetlabs/puppetlabs-postgresql"
|
||||
mysql: "https://github.com/puppetlabs/puppetlabs-mysql"
|
||||
concat: "https://github.com/puppetlabs/puppetlabs-concat"
|
||||
keystone: "https://github.com/openstack/puppet-keystone"
|
||||
symlinks:
|
||||
"tacker": "#{source_dir}"
|
31
Gemfile
31
Gemfile
|
@ -1,11 +1,22 @@
|
|||
source "https://rubygems.org"
|
||||
source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||
|
||||
group :test do
|
||||
gem "rake"
|
||||
gem "puppet", ENV['PUPPET_VERSION'] || '~> 4.2.0'
|
||||
gem "rspec-puppet"
|
||||
gem "puppetlabs_spec_helper"
|
||||
gem "metadata-json-lint"
|
||||
group :development, :test do
|
||||
gem 'puppetlabs_spec_helper', :require => 'false'
|
||||
gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
|
||||
gem 'rspec-puppet-facts', :require => 'false'
|
||||
gem 'metadata-json-lint', :require => 'false'
|
||||
gem 'puppet-lint-param-docs', :require => 'false'
|
||||
gem 'puppet-lint-absolute_classname-check', :require => 'false'
|
||||
gem 'puppet-lint-absolute_template_path', :require => 'false'
|
||||
gem 'puppet-lint-trailing_newline-check', :require => 'false'
|
||||
gem 'puppet-lint-unquoted_string-check', :require => 'false'
|
||||
gem 'puppet-lint-leading_zero-check', :require => 'false'
|
||||
gem 'puppet-lint-variable_contains_upcase', :require => 'false'
|
||||
gem 'puppet-lint-numericvariable', :require => 'false'
|
||||
gem 'json', :require => 'false'
|
||||
gem 'puppet-openstack_spec_helper',
|
||||
:git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
|
||||
:require => false
|
||||
end
|
||||
|
||||
group :local_only do
|
||||
|
@ -17,3 +28,9 @@ group :local_only do
|
|||
gem "puppet-blacksmith"
|
||||
gem "guard-rake"
|
||||
end
|
||||
|
||||
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||
gem 'puppet', puppetversion, :require => false
|
||||
else
|
||||
gem 'puppet', :require => false
|
||||
end
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'puppetlabs_spec_helper/rake_tasks'
|
||||
require 'puppet/version'
|
||||
require 'puppet/vendor/semantic/lib/semantic' unless Puppet.version.to_f < 3.6
|
||||
require 'metadata-json-lint/rake_task'
|
||||
require 'puppet-lint/tasks/puppet-lint'
|
||||
require 'puppet-syntax/tasks/puppet-syntax'
|
||||
|
||||
|
||||
# Coverage from puppetlabs-spec-helper requires rcov which
|
||||
# doesn't work in anything since 1.8.7
|
||||
Rake::Task[:coverage].clear
|
||||
|
||||
PuppetSyntax.exclude_paths ||= []
|
||||
PuppetSyntax.exclude_paths << "spec/fixtures/**/*"
|
||||
PuppetSyntax.exclude_paths << "pkg/**/*"
|
||||
PuppetSyntax.exclude_paths << "vendor/**/*"
|
||||
|
||||
Rake::Task[:lint].clear
|
||||
PuppetLint::RakeTask.new :lint do |config|
|
||||
config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
|
||||
config.fail_on_warnings = true
|
||||
config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}'
|
||||
config.disable_checks = ["80chars", "class_inherits_from_params_class", "only_variable_string"]
|
||||
end
|
||||
|
||||
desc "Run syntax, lint, spec tests."
|
||||
task :test => [
|
||||
:syntax,
|
||||
:lint,
|
||||
:metadata_lint,
|
||||
:spec,
|
||||
]
|
|
@ -1,27 +1,10 @@
|
|||
Puppet::Type.type(:tacker_config).provide(
|
||||
:ini_setting,
|
||||
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
|
||||
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
|
||||
) do
|
||||
|
||||
def section
|
||||
resource[:name].split('/', 2).first
|
||||
end
|
||||
|
||||
def setting
|
||||
resource[:name].split('/', 2).last
|
||||
end
|
||||
|
||||
def separator
|
||||
'='
|
||||
end
|
||||
|
||||
def self.file_path
|
||||
'/etc/tacker/tacker.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -40,6 +40,11 @@ Puppet::Type.newtype(:tacker_config) do
|
|||
defaultto false
|
||||
end
|
||||
|
||||
newparam(:ensure_absent_val) do
|
||||
desc 'A value that is specified as the value property will behave as if ensure => absent was specified'
|
||||
defaultto('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'tacker'
|
||||
end
|
||||
|
|
|
@ -262,6 +262,7 @@ class tacker(
|
|||
$database_min_pool_size = undef,
|
||||
$database_max_pool_size = undef,
|
||||
$database_max_overflow = undef,
|
||||
$sync_db = true,
|
||||
$rpc_backend = 'rabbit',
|
||||
$control_exchange = 'tacker',
|
||||
$rabbit_host = '127.0.0.1',
|
||||
|
|
|
@ -26,7 +26,7 @@ describe 'tacker::db::postgresql' do
|
|||
|
||||
it { is_expected.to contain_postgresql__server__db('tacker').with(
|
||||
:user => 'tacker',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
:password => 'md54fb52f4ce3618bd50cf38d2b7399db7a'
|
||||
)}
|
||||
end
|
||||
|
||||
|
@ -49,7 +49,7 @@ describe 'tacker::db::postgresql' do
|
|||
|
||||
it { is_expected.to contain_postgresql__server__db('tacker').with(
|
||||
:user => 'tacker',
|
||||
:password => 'md5c530c33636c58ae83ca933f39319273e'
|
||||
:password => 'md54fb52f4ce3618bd50cf38d2b7399db7a'
|
||||
)}
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'tacker::db' do
|
|||
|
||||
shared_examples 'tacker::db' do
|
||||
context 'with default parameters' do
|
||||
it { is_expected.to contain_tacker_config('database/connection').with_value('mysql://tacker:secrete@localhost:3306/tacker') }
|
||||
it { is_expected.to contain_tacker_config('database/connection').with_value('sqlite:////var/lib/tacker/tacker.sqlite') }
|
||||
it { is_expected.to contain_tacker_config('database/idle_timeout').with_value('3600') }
|
||||
it { is_expected.to contain_tacker_config('database/min_pool_size').with_value('1') }
|
||||
it { is_expected.to contain_tacker_config('database/max_retries').with_value('10') }
|
||||
|
@ -47,7 +47,7 @@ describe 'tacker::db' do
|
|||
|
||||
context 'with incorrect database_connection string' do
|
||||
let :params do
|
||||
{ :database_connection => 'sqlite://tacker:tacker@localhost/tacker', }
|
||||
{ :database_connection => 'redis://tacker:tacker@localhost/tacker', }
|
||||
end
|
||||
|
||||
it_raises 'a Puppet::Error', /validate_re/
|
||||
|
|
|
@ -26,17 +26,16 @@ describe 'tacker::keystone::auth' do
|
|||
:roles => ['admin']
|
||||
)}
|
||||
|
||||
it { is_expected.to contain_keystone_service('tacker').with(
|
||||
it { is_expected.to contain_keystone_service('tacker::servicevm').with(
|
||||
:ensure => 'present',
|
||||
:type => 'FIXME',
|
||||
:description => 'tacker FIXME Service'
|
||||
:description => 'tacker VNF Manager service'
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker').with(
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker::servicevm').with(
|
||||
:ensure => 'present',
|
||||
:public_url => 'http://127.0.0.1:FIXME',
|
||||
:admin_url => 'http://127.0.0.1:FIXME',
|
||||
:internal_url => 'http://127.0.0.1:FIXME',
|
||||
:public_url => 'http://127.0.0.1:8888/',
|
||||
:admin_url => 'http://127.0.0.1:8888/',
|
||||
:internal_url => 'http://127.0.0.1:8888/',
|
||||
) }
|
||||
end
|
||||
|
||||
|
@ -48,11 +47,11 @@ describe 'tacker::keystone::auth' do
|
|||
:admin_url => 'http://10.10.10.12:81', }
|
||||
end
|
||||
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker').with(
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker::servicevm').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',
|
||||
: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
|
||||
|
||||
|
@ -64,8 +63,8 @@ describe 'tacker::keystone::auth' do
|
|||
|
||||
it { is_expected.to contain_keystone_user('tackery') }
|
||||
it { is_expected.to contain_keystone_user_role('tackery@services') }
|
||||
it { is_expected.to contain_keystone_service('tackery') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tackery') }
|
||||
it { is_expected.to contain_keystone_service('tackery::servicevm') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tackery::servicevm') }
|
||||
end
|
||||
|
||||
describe 'when overriding service name' do
|
||||
|
@ -77,8 +76,8 @@ describe 'tacker::keystone::auth' do
|
|||
|
||||
it { is_expected.to contain_keystone_user('tacker') }
|
||||
it { is_expected.to contain_keystone_user_role('tacker@services') }
|
||||
it { is_expected.to contain_keystone_service('tacker_service') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker_service') }
|
||||
it { is_expected.to contain_keystone_service('tacker_service::servicevm') }
|
||||
it { is_expected.to contain_keystone_endpoint('RegionOne/tacker_service::servicevm') }
|
||||
end
|
||||
|
||||
describe 'when disabling user configuration' do
|
||||
|
@ -92,10 +91,9 @@ describe 'tacker::keystone::auth' do
|
|||
|
||||
it { is_expected.not_to contain_keystone_user('tacker') }
|
||||
it { is_expected.to contain_keystone_user_role('tacker@services') }
|
||||
it { is_expected.to contain_keystone_service('tacker').with(
|
||||
it { is_expected.to contain_keystone_service('tacker::servicevm').with(
|
||||
:ensure => 'present',
|
||||
:type => 'FIXME',
|
||||
:description => 'tacker FIXME Service'
|
||||
:description => 'tacker VNF Manager service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
@ -112,10 +110,9 @@ describe 'tacker::keystone::auth' do
|
|||
|
||||
it { is_expected.not_to contain_keystone_user('tacker') }
|
||||
it { is_expected.not_to contain_keystone_user_role('tacker@services') }
|
||||
it { is_expected.to contain_keystone_service('tacker').with(
|
||||
it { is_expected.to contain_keystone_service('tacker::servicevm').with(
|
||||
:ensure => 'present',
|
||||
:type => 'FIXME',
|
||||
:description => 'tacker FIXME Service'
|
||||
:description => 'tacker VNF Manager service'
|
||||
) }
|
||||
|
||||
end
|
||||
|
|
|
@ -56,24 +56,24 @@ describe 'tacker::logging' do
|
|||
end
|
||||
|
||||
shared_examples 'basic default logging settings' do
|
||||
it 'configures ceilometer logging settins with default values' do
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/use_syslog').with(:value => 'false')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/use_stderr').with(:value => 'true')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_USER')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/log_dir').with(:value => '/var/log/tacker')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/verbose').with(:value => 'false')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/debug').with(:value => 'false')
|
||||
it 'configures tacker logging settins with default values' do
|
||||
is_expected.to contain_tacker_config('DEFAULT/use_syslog').with(:value => 'false')
|
||||
is_expected.to contain_tacker_config('DEFAULT/use_stderr').with(:value => 'true')
|
||||
is_expected.to contain_tacker_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_USER')
|
||||
is_expected.to contain_tacker_config('DEFAULT/log_dir').with(:value => '/var/log/tacker')
|
||||
is_expected.to contain_tacker_config('DEFAULT/verbose').with(:value => 'false')
|
||||
is_expected.to contain_tacker_config('DEFAULT/debug').with(:value => 'false')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'basic non-default logging settings' do
|
||||
it 'configures ceilometer logging settins with non-default values' do
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/use_syslog').with(:value => 'true')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/use_stderr').with(:value => 'false')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/log_dir').with(:value => '/var/log')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/verbose').with(:value => 'true')
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/debug').with(:value => 'true')
|
||||
it 'configures tacker logging settins with non-default values' do
|
||||
is_expected.to contain_tacker_config('DEFAULT/use_syslog').with(:value => 'true')
|
||||
is_expected.to contain_tacker_config('DEFAULT/use_stderr').with(:value => 'false')
|
||||
is_expected.to contain_tacker_config('DEFAULT/syslog_log_facility').with(:value => 'LOG_FOO')
|
||||
is_expected.to contain_tacker_config('DEFAULT/log_dir').with(:value => '/var/log')
|
||||
is_expected.to contain_tacker_config('DEFAULT/verbose').with(:value => 'true')
|
||||
is_expected.to contain_tacker_config('DEFAULT/debug').with(:value => 'true')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||
require 'shared_examples'
|
||||
|
||||
require 'puppet-openstack_spec_helper/defaults'
|
||||
require 'rspec-puppet-facts'
|
||||
include RspecPuppetFacts
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||
c.alias_it_should_behave_like_to :it_raises, 'raises'
|
||||
# TODO(aschultz): remove this after all tests converted to use OSDefaults
|
||||
# instead of referencing @default_facts
|
||||
c.before :each do
|
||||
@default_facts = OSDefaults.get_facts
|
||||
end
|
||||
end
|
||||
|
||||
at_exit { RSpec::Puppet::Coverage.report! }
|
Loading…
Reference in New Issue