summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilien Macchi <emilien@redhat.com>2016-09-22 11:11:13 -0400
committerEmilien Macchi <emilien@redhat.com>2016-09-22 21:26:23 -0400
commit1c4fe921e677c52dd01c9ce9aa12933fe0688b88 (patch)
tree229a250fff00be4394ef1a7e3a645051813253e1
parent223c88460baf33f62acd9d089351b61306e42d72 (diff)
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
-rw-r--r--.fixtures.yml32
-rw-r--r--.gitignore1
-rw-r--r--Gemfile27
-rw-r--r--Puppetfile_extras31
-rw-r--r--Rakefile22
-rw-r--r--spec/spec_helper.rb5
6 files changed, 42 insertions, 76 deletions
diff --git a/.fixtures.yml b/.fixtures.yml
deleted file mode 100644
index fae4a8c..0000000
--- a/.fixtures.yml
+++ /dev/null
@@ -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}"
diff --git a/.gitignore b/.gitignore
index 4dd84f0..15c55ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ coverage/
.idea/
*.swp
*.iml
+openstack/
diff --git a/Gemfile b/Gemfile
index 6181b3b..1fab608 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,28 +1,9 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
-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'
- # 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'
+group :development, :test, :system_tests do
+ gem 'puppet-openstack_spec_helper',
+ :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
+ :require => false
end
if facterversion = ENV['FACTER_GEM_VERSION']
diff --git a/Puppetfile_extras b/Puppetfile_extras
new file mode 100644
index 0000000..b9f664f
--- /dev/null
+++ b/Puppetfile_extras
@@ -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'
+
diff --git a/Rakefile b/Rakefile
index 7dcaeb9..168d108 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,21 +1 @@
-require 'puppetlabs_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
+require 'puppet-openstack_spec_helper/rake_tasks'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index be9532a..b06b436 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -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 'shared_examples'
+
+require 'puppet-openstack_spec_helper/defaults'
require 'rspec-puppet-facts'
include RspecPuppetFacts
@@ -8,6 +12,7 @@ fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.alias_it_should_behave_like_to :it_configures, 'configures'
c.alias_it_should_behave_like_to :it_raises, 'raises'
+
c.hiera_config = File.join(fixture_path, 'hiera.yaml')
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')