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: Iccd19816a7b936bba30d7b1c4ec016caae4a8dcf
This commit is contained in:
Simon Pasquier 2015-09-16 17:16:30 +02:00
parent d3c1338e24
commit 8dfbbbe16e
4 changed files with 51 additions and 1 deletions

View File

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

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,
]

15
tox.ini
View File

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