Fix puppet-qdr testing
This change updates the puppet-qdr module to leverage the puppet-openstack_spec_helper for unit testing and common dependency management for spec tests. Additionally this change fixes the lint issues with the module. Change-Id: I62d6b60712e237a8b4daf654879a4f1912fb9ec6
This commit is contained in:
parent
6b2f2ea048
commit
75bb0b5c3e
|
@ -1,40 +1,11 @@
|
||||||
## Emacs ##
|
pkg/
|
||||||
*~
|
Gemfile.lock
|
||||||
\#*\#
|
vendor/
|
||||||
|
spec/fixtures/
|
||||||
*.gem
|
.vagrant/
|
||||||
*.rbc
|
.bundle/
|
||||||
/.config
|
coverage/
|
||||||
/coverage/
|
.idea/
|
||||||
/InstalledFiles
|
*.swp
|
||||||
/pkg/
|
*.iml
|
||||||
/spec/reports/
|
/openstack/
|
||||||
/spec/examples.txt
|
|
||||||
/test/tmp/
|
|
||||||
/test/version_tmp/
|
|
||||||
/tmp/
|
|
||||||
|
|
||||||
## Specific to RubyMotion:
|
|
||||||
.dat*
|
|
||||||
.repl_history
|
|
||||||
build/
|
|
||||||
|
|
||||||
## Documentation cache and generated files:
|
|
||||||
/.yardoc/
|
|
||||||
/_yardoc/
|
|
||||||
/doc/
|
|
||||||
/rdoc/
|
|
||||||
|
|
||||||
## Environment normalization:
|
|
||||||
/.bundle/
|
|
||||||
/vendor/bundle
|
|
||||||
/lib/bundler/man/
|
|
||||||
|
|
||||||
# for a library or gem, you might want to ignore these files since the code is
|
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
|
||||||
# Gemfile.lock
|
|
||||||
# .ruby-version
|
|
||||||
# .ruby-gemset
|
|
||||||
|
|
||||||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
||||||
.rvmrc
|
|
||||||
|
|
26
Gemfile
26
Gemfile
|
@ -1,7 +1,21 @@
|
||||||
source 'https://rubygems.org'
|
source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||||
|
|
||||||
puppetversion = ENV.key?('PUPPET_VERSION') ? "#{ENV['PUPPET_VERSION']}" : ['>= 3.3']
|
group :development, :test, :system_tests do
|
||||||
gem 'puppet', puppetversion
|
gem 'puppet-openstack_spec_helper',
|
||||||
gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
:git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
|
||||||
gem 'puppet-lint', '>= 1.0.0'
|
:require => false
|
||||||
gem 'facter', '>= 1.7.0'
|
end
|
||||||
|
|
||||||
|
if facterversion = ENV['FACTER_GEM_VERSION']
|
||||||
|
gem 'facter', facterversion, :require => false
|
||||||
|
else
|
||||||
|
gem 'facter', :require => false
|
||||||
|
end
|
||||||
|
|
||||||
|
if puppetversion = ENV['PUPPET_GEM_VERSION']
|
||||||
|
gem 'puppet', puppetversion, :require => false
|
||||||
|
else
|
||||||
|
gem 'puppet', :require => false
|
||||||
|
end
|
||||||
|
|
||||||
|
# vim:ft=ruby
|
||||||
|
|
18
Rakefile
18
Rakefile
|
@ -1,17 +1 @@
|
||||||
require 'puppetlabs_spec_helper/rake_tasks'
|
require 'puppet-openstack_spec_helper/rake_tasks'
|
||||||
require 'puppet-lint/tasks/puppet-lint'
|
|
||||||
PuppetLint.configuration.send('disable_80chars')
|
|
||||||
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
|
|
||||||
|
|
||||||
desc "Validate manifests, templates, and ruby files"
|
|
||||||
task :validate do
|
|
||||||
Dir['manifests/**/*.pp'].each do |manifest|
|
|
||||||
sh "puppet parser validate --noop #{manifest}"
|
|
||||||
end
|
|
||||||
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
|
||||||
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
|
||||||
end
|
|
||||||
Dir['templates/**/*.erb'].each do |template|
|
|
||||||
sh "erb -P -x -T '-' #{template} | ruby -c"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -20,16 +20,17 @@
|
||||||
# (optional) Service host name
|
# (optional) Service host name
|
||||||
# Defaults to '127.0.0.1'
|
# Defaults to '127.0.0.1'
|
||||||
#
|
#
|
||||||
# [*listner_auth_peer*]
|
# [*listener_auth_peer*]
|
||||||
# (optional) Require the peer's identity to be authenticated.
|
# (optional)
|
||||||
# Defaults to 'no'
|
# Defaults to 'no'
|
||||||
#
|
#
|
||||||
# [*listner_idle_timeout*]
|
# [*listener_idle_timeout*]
|
||||||
# (optional) Idle timeout, in seconds, for connection through the listener
|
# (optional)
|
||||||
# Defaults to '16'
|
# Defaults to '16'
|
||||||
#
|
#
|
||||||
# [*listener_max_frame_size*]
|
# [*listener_max_frame_size*]
|
||||||
# (optional) Maximum frame size used for a message delivery over the connection
|
# (optional) Maximum frame size used for a message delivery over the
|
||||||
|
# connection
|
||||||
# Defaults to '16384'
|
# Defaults to '16384'
|
||||||
#
|
#
|
||||||
# [*listener_port*]
|
# [*listener_port*]
|
||||||
|
@ -134,7 +135,7 @@ class qdr(
|
||||||
$enable_service = true,
|
$enable_service = true,
|
||||||
$listener_addr = '127.0.0.1',
|
$listener_addr = '127.0.0.1',
|
||||||
$listener_auth_peer = 'no',
|
$listener_auth_peer = 'no',
|
||||||
$listener_idle_timout = '16',
|
$listener_idle_timeout = '16',
|
||||||
$listener_max_frame_size = '16384',
|
$listener_max_frame_size = '16384',
|
||||||
$listener_port = '5672',
|
$listener_port = '5672',
|
||||||
$listener_require_encrypt = 'no',
|
$listener_require_encrypt = 'no',
|
||||||
|
|
|
@ -10,7 +10,7 @@ class qdr::install inherits qdr {
|
||||||
$tools_package_list = $::qdr::params::tools_package_list
|
$tools_package_list = $::qdr::params::tools_package_list
|
||||||
|
|
||||||
if $::osfamily == 'Debian' {
|
if $::osfamily == 'Debian' {
|
||||||
include apt
|
include ::apt
|
||||||
|
|
||||||
Class['apt::update'] -> Package<| provider == 'apt' |>
|
Class['apt::update'] -> Package<| provider == 'apt' |>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,59 @@
|
||||||
{
|
{
|
||||||
"name": "ajssmith-qdr",
|
"name": "openstack-qdr",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"author": "Andy Smith",
|
"author": "OpenStack Contributors",
|
||||||
"summary": "This module manages qpid-dispatch-router service",
|
"summary": "Puppet OpenStack Extras Module",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"source": "https://github.com/ajssmith/puppet-qdr",
|
"source": "git://github.com/openstack/puppet-qdr.git",
|
||||||
"project_page": "https://github.com/ajssmith/puppet-qdr",
|
"project_page": "https://launchpad.net/puppet-qdr",
|
||||||
"issues_url": "https://github.com/ajssmith/puppet-qdr/issues",
|
"issues_url": "https://bugs.launchpad.net/puppet-qdr",
|
||||||
|
"requirements": [
|
||||||
|
{
|
||||||
|
"name": "pe",
|
||||||
|
"version_requirement": "3.x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "puppet",
|
||||||
|
"version_requirement": "3.x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"operatingsystem_support": [
|
||||||
|
{
|
||||||
|
"operatingsystem": "Debian",
|
||||||
|
"operatingsystemrelease": [
|
||||||
|
"7"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"operatingsystem": "Fedora",
|
||||||
|
"operatingsystemrelease": [
|
||||||
|
"20"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"operatingsystem": "RedHat",
|
||||||
|
"operatingsystemrelease": [
|
||||||
|
"6.5",
|
||||||
|
"7"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"operatingsystem": "Ubuntu",
|
||||||
|
"operatingsystemrelease": [
|
||||||
|
"14.04",
|
||||||
|
"16.04"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Puppet module to add useful utilities for OpenStack deployments",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
|
{
|
||||||
|
"name": "puppetlabs/apt",
|
||||||
|
"version_requirement": ">=1.8.0 <3.0.0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "puppetlabs/stdlib",
|
||||||
|
"version_requirement": ">=4.0.0 <5.0.0"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
HOSTS:
|
||||||
|
centos-server-70-x64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: el-7-x86_64
|
||||||
|
box: puppetlabs/centos-7.0-64-nocm
|
||||||
|
box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm
|
||||||
|
hypervisor: vagrant
|
||||||
|
CONFIG:
|
||||||
|
log_level: debug
|
||||||
|
type: foss
|
|
@ -0,0 +1,10 @@
|
||||||
|
HOSTS:
|
||||||
|
ubuntu-server-14.04-amd64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: ubuntu-14.04-amd64
|
||||||
|
box: puppetlabs/ubuntu-14.04-64-nocm
|
||||||
|
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
|
||||||
|
hypervisor: vagrant
|
||||||
|
CONFIG:
|
||||||
|
type: foss
|
|
@ -0,0 +1,10 @@
|
||||||
|
HOSTS:
|
||||||
|
centos-70-x64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: el-7-x86_64
|
||||||
|
hypervisor: none
|
||||||
|
ip: 127.0.0.1
|
||||||
|
CONFIG:
|
||||||
|
type: foss
|
||||||
|
set_env: false
|
|
@ -0,0 +1,10 @@
|
||||||
|
HOSTS:
|
||||||
|
ubuntu-14.04-amd64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: ubuntu-14.04-amd64
|
||||||
|
hypervisor: none
|
||||||
|
ip: 127.0.0.1
|
||||||
|
CONFIG:
|
||||||
|
type: foss
|
||||||
|
set_env: false
|
|
@ -0,0 +1,10 @@
|
||||||
|
HOSTS:
|
||||||
|
ubuntu-16.04-amd64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: ubuntu-16.04-amd64
|
||||||
|
hypervisor: none
|
||||||
|
ip: 127.0.0.1
|
||||||
|
CONFIG:
|
||||||
|
type: foss
|
||||||
|
set_env: false
|
|
@ -0,0 +1,11 @@
|
||||||
|
HOSTS:
|
||||||
|
ubuntu-server-14.04-amd64:
|
||||||
|
roles:
|
||||||
|
- master
|
||||||
|
platform: ubuntu-14.04-amd64
|
||||||
|
box: puppetlabs/ubuntu-14.04-64-nocm
|
||||||
|
box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
|
||||||
|
hypervisor: vagrant
|
||||||
|
CONFIG:
|
||||||
|
log_level: debug
|
||||||
|
type: foss
|
|
@ -0,0 +1,5 @@
|
||||||
|
shared_examples_for "a Puppet::Error" do |description|
|
||||||
|
it "with message matching #{description.inspect}" do
|
||||||
|
expect { is_expected.to have_class_count(1) }.to raise_error(Puppet::Error, description)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,10 +1,10 @@
|
||||||
require 'rspec-puppet/spec_helper'
|
require 'puppetlabs_spec_helper/module_spec_helper'
|
||||||
require 'rspec-puppet'
|
require 'shared_examples'
|
||||||
|
require 'puppet-openstack_spec_helper/facts'
|
||||||
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
|
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
c.module_path = File.join(fixture_path, 'modules')
|
c.alias_it_should_behave_like_to :it_configures, 'configures'
|
||||||
c.manifest_dir = File.join(fixture_path, 'manifests')
|
c.alias_it_should_behave_like_to :it_raises, 'raises'
|
||||||
c.environmentpath = File.join(Dir.pwd, 'spec')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
at_exit { RSpec::Puppet::Coverage.report! }
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
require 'puppet-openstack_spec_helper/beaker_spec_helper'
|
|
@ -2,12 +2,12 @@ require 'puppet'
|
||||||
require 'puppet/type/qdr_address'
|
require 'puppet/type/qdr_address'
|
||||||
describe 'Puppet::Type.type(:qdr_address)' do
|
describe 'Puppet::Type.type(:qdr_address)' do
|
||||||
before :each do
|
before :each do
|
||||||
@qdr_address = Puppet::Type.type(:qdr_address).new(:prefix => 'unicast', :distribution => 'closest' )
|
@qdr_address = Puppet::Type.type(:qdr_address).new(:name => 'test', :prefix => 'unicast', :distribution => 'closest' )
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not expect a prefix with a whitespace' do
|
it 'should not expect a prefix with a whitespace' do
|
||||||
expect {
|
expect {
|
||||||
Puppet::Type.type(:qdr_address).new(:prefix => 'multi cast')
|
Puppet::Type.type(:qdr_address).new(:name => 'test', :prefix => 'multi cast')
|
||||||
}.to raise_error(Puppet::Error, /Parameter prefix failed/)
|
}.to raise_error(Puppet::Error, /Parameter prefix failed/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue