Add tox environment to test Puppet manifests

This change adds syntax checking and lint tests for the Puppet
manifests located in deployment_scripts/puppet/manifests.

Change-Id: I943913ab56338e6cc64ec4cf07dae46d237d2f6c
This commit is contained in:
Simon Pasquier 2015-09-17 17:53:19 +02:00
parent b5f34c54c5
commit 4b39101bd2
5 changed files with 53 additions and 4 deletions

View File

@ -0,0 +1,2 @@
Gemfile.lock
.bundle

View File

@ -0,0 +1,23 @@
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
source 'https://rubygems.org'
group :development, :test do
gem 'rake'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.4.0'
gem 'puppetlabs_spec_helper'
# Need to use master branch of puppet-lint because of
# https://github.com/rodjek/puppet-lint/issues/355
gem 'puppet-lint', :git => 'https://github.com/rodjek/puppet-lint.git'
end

View File

@ -0,0 +1,13 @@
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
PuppetLint.configuration.fail_on_warnings = true
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.send('disable_class_parameter_defaults')
desc "Run lint, and syntax tests."
task :test => [
:lint,
:syntax,
]

View File

@ -1 +1,2 @@
Gemfile.lock
.bundle

18
tox.ini
View File

@ -1,9 +1,21 @@
[tox]
envlist = lma_monitoring_analytics,docs,build_plugin
envlist = manifests,lma_monitoring_analytics,docs,build_plugin
skipsdist = True
[testenv]
deps = -r{toxinidir}/test-requirements.txt
passenv = HOME
[testenv:manifests]
deps =
changedir = {toxinidir}/deployment_scripts/puppet/manifests
whitelist_externals =
bundle
mkdir
commands =
mkdir -p {toxinidir}/.bundled_gems
bundle install --path {toxinidir}/.bundled_gems
bundle exec rake test
[testenv:lma_monitoring_analytics]
deps =
@ -11,11 +23,9 @@ changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}
whitelist_externals =
bundle
mkdir
setenv =
GEM_HOME={toxinidir}/.bundled_gems
commands =
mkdir -p {toxinidir}/.bundled_gems
bundle install
bundle install --path {toxinidir}/.bundled_gems
bundle exec rake test
[testenv:docs]