Switch puppet-tripleo to use puppet-openstack_spec_helper

Align puppet-tripleo with other Puppet OpenStack modules to use
puppet-openstack_spec_helper.

Here are the benefits:

- Allow to use Depends-On between Puppet OpenStack modules and
  puppet-tripleo, and unit tests will work correctly with dependencies.
- Use the Puppet OpenStack gemspec file that handle gems dependencies to
  test the module.
- Allow to re-use ruby helper that Puppet OpenStack modules have in unit
  tests, to avoid duplicated code.
- Don't manage .fixtures.yml file, it will be generated by Puppet
  OpenStack tooling. TripleO dependencies will live in Puppetfile_extras.

Change-Id: Ic66e9f872c57545327a9fb4b8ae86fbf0abbd8be
This commit is contained in:
Emilien Macchi 2016-09-22 11:11:13 -04:00
parent 223c88460b
commit 1c4fe921e6
6 changed files with 42 additions and 76 deletions

View File

@ -1,32 +0,0 @@
fixtures:
repositories:
'firewall': 'git://github.com/puppetlabs/puppetlabs-firewall.git'
'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
'haproxy': 'git://github.com/puppetlabs/puppetlabs-haproxy.git'
'concat': 'git://github.com/puppetlabs/puppetlabs-concat.git'
'openstacklib': 'git://github.com/openstack/puppet-openstacklib.git'
'swift': 'git://github.com/openstack/puppet-swift.git'
'memcached': 'git://github.com/saz/puppet-memcached.git'
'midonet':
repo: 'git://github.com/midonet/puppet-midonet.git'
ref: 'v2015.06.7'
'tomcat':
repo: 'git://github.com/puppetlabs/puppetlabs-tomcat.git'
ref: '1.3.2'
'inifile':
repo: 'git://github.com/puppetlabs/puppetlabs-inifile.git'
ref: '1.4.2'
'cassandra':
repo: 'git://github.com/locp/cassandra.git'
ref: '1.9.2'
'zookeeper':
repo: 'git://github.com/deric/puppet-zookeeper.git'
ref: 'v0.3.9'
'datacat':
repo: 'git://github.com/richardc/puppet-datacat'
ref: '0.6.2'
'java':
repo: 'git://github.com/puppetlabs/puppetlabs-java'
ref: '1.4.2'
symlinks:
"tripleo": "#{source_dir}"

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ coverage/
.idea/ .idea/
*.swp *.swp
*.iml *.iml
openstack/

27
Gemfile
View File

@ -1,28 +1,9 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org" source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :development, :test do group :development, :test, :system_tests do
gem 'puppetlabs_spec_helper', :require => 'false' gem 'puppet-openstack_spec_helper',
gem 'rspec-puppet', '~> 2.2.0', :require => 'false' :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
gem 'rspec-puppet-facts', :require => 'false' :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'
# adding 'psych' explicitly
# https://github.com/bundler/bundler/issues/2068
# TODO: drop it in a future release of 'bundle'.
gem 'psych', :require => 'false'
end
group :system_tests do
gem 'beaker-rspec', :require => 'false'
gem 'beaker-puppet_install_helper', :require => 'false'
end end
if facterversion = ENV['FACTER_GEM_VERSION'] if facterversion = ENV['FACTER_GEM_VERSION']

31
Puppetfile_extras Normal file
View File

@ -0,0 +1,31 @@
## TripleO Puppet modules
mod 'haproxy',
:git => 'https://github.com/puppetlabs/puppetlabs-haproxy',
:ref => 'master'
mod 'midonet',
:git => 'https://github.com/midonet/puppet-midonet',
:ref => 'v2015.06.7'
mod 'tomcat',
:git => 'https://github.com/puppetlabs/puppetlabs-tomcat',
:ref => '1.3.2'
mod 'java',
:git => 'https://github.com/puppetlabs/puppetlabs-java',
:ref => '1.4.2'
mod 'cassandra',
:git => 'https://github.com/locp/cassandra',
:ref => '1.9.2'
mod 'zookeeper',
:git => 'https://github.com/deric/puppet-zookeeper',
:ref => 'v0.3.9'
mod 'datacat',
:git => 'https://github.com/richardc/puppet-datacat',
:ref => '0.6.2'

View File

@ -1,21 +1 @@
require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-openstack_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
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 acceptance tests"
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
end

View File

@ -1,5 +1,9 @@
# Load libraries from openstacklib here to simulate how they live together in a real puppet run (for provider unit tests)
$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'fixtures', 'modules', 'openstacklib', 'lib'))
require 'puppetlabs_spec_helper/module_spec_helper' require 'puppetlabs_spec_helper/module_spec_helper'
require 'shared_examples' require 'shared_examples'
require 'puppet-openstack_spec_helper/defaults'
require 'rspec-puppet-facts' require 'rspec-puppet-facts'
include RspecPuppetFacts include RspecPuppetFacts
@ -8,6 +12,7 @@ fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c| RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises' c.alias_it_should_behave_like_to :it_raises, 'raises'
c.hiera_config = File.join(fixture_path, 'hiera.yaml') c.hiera_config = File.join(fixture_path, 'hiera.yaml')
c.module_path = File.join(fixture_path, 'modules') c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests') c.manifest_dir = File.join(fixture_path, 'manifests')