Add tox environment to test Puppet manifests
This change adds syntax checking and lint tests for the Puppet manifests locates in deployment_scripts/puppet/manifests. It also fixes a Puppet lint problem in base.pp as well as illegal key assignments that aren't allowed with Puppet 4.x. Change-Id: I3a6913773d3c3952e882db5644b8cc2289cee8fa
This commit is contained in:
parent
26da1d8e25
commit
6c661bc615
|
@ -0,0 +1 @@
|
|||
Gemfile.lock
|
|
@ -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
|
|
@ -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,
|
||||
]
|
|
@ -139,13 +139,10 @@ case $influxdb_mode {
|
|||
$influxdb_password = $influxdb_grafana['influxdb_userpass']
|
||||
}
|
||||
|
||||
$processes_hash = {'hekad' => true,
|
||||
'collectd' => true,
|
||||
}
|
||||
|
||||
if member($current_roles, 'influxdb_grafana') {
|
||||
$processes_hash['influxd'] = true
|
||||
$processes_hash['grafana-server'] = true
|
||||
$processes = ['influxd', 'grafana-server', 'hekad', 'collectd']
|
||||
} else {
|
||||
$processes = ['hekad', 'collectd']
|
||||
}
|
||||
|
||||
if member($current_roles, 'elasticsearch_kibana') {
|
||||
|
@ -164,7 +161,7 @@ case $influxdb_mode {
|
|||
}
|
||||
|
||||
class { 'lma_collector::collectd::base':
|
||||
processes => keys($processes_hash),
|
||||
processes => $processes,
|
||||
process_matches => $process_matches,
|
||||
read_threads => $collectd_read_threads,
|
||||
require => Class['lma_collector'],
|
||||
|
|
15
tox.ini
15
tox.ini
|
@ -1,10 +1,23 @@
|
|||
[tox]
|
||||
envlist = heka,lma_collector,docs,build_plugin
|
||||
envlist = manifests,heka,lma_collector,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:heka]
|
||||
deps =
|
||||
changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}
|
||||
|
|
Loading…
Reference in New Issue