Configure tox environments

Change-Id: I1ae791666ff1c1a11659f4154d33bbaac47c5dee
This commit is contained in:
Olivier Bourdon 2016-03-02 18:57:20 +01:00
parent 7d22f3b812
commit 277206f540
10 changed files with 165 additions and 33 deletions

4
.gitignore vendored
View File

@ -3,3 +3,7 @@
repositories/centos/*.rpm
repositories/ubuntu/*.deb
deployment_scripts/puppet/modules/snmp
.bundled_gems/
.bundle/
Gemfile.lock
.tox/

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

@ -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,17 @@
require 'puppetlabs_spec_helper/rake_tasks'
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')
PuppetLint.configuration.send('disable_autoloader_layout')
desc "Run lint, and syntax and spec tests."
task :test => [
:lint,
:syntax,
:spec,
]

View File

@ -21,12 +21,12 @@ define plugin_zabbix_monitoring_emc::emc_host(
if size($host) == 2 {
plugin_zabbix_host { $host[0]:
host => $host[0],
type => 2,
ip => $host[1],
port => '161',
api => $plugin_zabbix::params::api_hash,
groups => $host_group,
host => $host[0],
type => 2,
ip => $host[1],
port => '161',
api => $plugin_zabbix::params::api_hash,
groups => $host_group,
}
plugin_zabbix_template_link { "${host[0]} Template EMC VNX":
host => $host[0],

View File

@ -21,20 +21,20 @@ class plugin_zabbix_monitoring_emc(
include plugin_zabbix::params
file { '/etc/zabbix/import/Template_EMC_VNX.xml':
ensure => present,
source => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml',
ensure => present,
source => 'puppet:///modules/plugin_zabbix_monitoring_emc/Template_EMC_VNX.xml',
}
plugin_zabbix_configuration_import { 'Template_EMC_VNX.xml Import':
ensure => present,
xml_file => '/etc/zabbix/import/Template_EMC_VNX.xml',
api => $plugin_zabbix::params::api_hash,
require => File['/etc/zabbix/import/Template_EMC_VNX.xml'],
ensure => present,
xml_file => '/etc/zabbix/import/Template_EMC_VNX.xml',
api => $plugin_zabbix::params::api_hash,
require => File['/etc/zabbix/import/Template_EMC_VNX.xml'],
}
plugin_zabbix_hostgroup {$host_group:
ensure => present,
api => $plugin_zabbix::params::api_hash,
ensure => present,
api => $plugin_zabbix::params::api_hash,
}
$zabbix_monitoring_emc_hash = hiera('zabbix_monitoring_emc')
@ -42,7 +42,6 @@ class plugin_zabbix_monitoring_emc(
if $hosts_string {
$hosts = split($hosts_string,',')
if size($hosts) > 0 {
plugin_zabbix_monitoring_emc::emc_host { $hosts:
host_group => $host_group,

View File

@ -16,33 +16,33 @@
class plugin_zabbix_monitoring_emc::snmptt_config {
file { '/etc/snmp/snmptt.conf.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
file { '/etc/snmp/snmptt.conf.d/emc.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf',
require => File['/etc/snmp/snmptt.conf.d'],
ensure => present,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/plugin_zabbix_monitoring_emc/snmptt_emc.conf',
require => File['/etc/snmp/snmptt.conf.d'],
}
file_line { 'add emc.conf config to snmptt.ini':
path => '/etc/snmp/snmptt.ini',
after => 'snmptt_conf_files = <<END',
line => '/etc/snmp/snmptt.conf.d/emc.conf',
require => File['/etc/snmp/snmptt.conf.d/emc.conf'],
notify => Service['snmptt'],
path => '/etc/snmp/snmptt.ini',
after => 'snmptt_conf_files = <<END',
line => '/etc/snmp/snmptt.conf.d/emc.conf',
require => File['/etc/snmp/snmptt.conf.d/emc.conf'],
notify => Service['snmptt'],
}
service { 'snmptt':
ensure => running,
enable => true,
hasstatus => false,
ensure => running,
enable => true,
hasstatus => false,
}
}

2
test-requirements.txt Normal file
View File

@ -0,0 +1,2 @@
Sphinx
fuel-plugin-builder>=2.0.4

51
tox.ini Normal file
View File

@ -0,0 +1,51 @@
[tox]
envlist = manifests,plugin_zabbix_monitoring_emc,build_plugin
skipsdist = True
[testenv]
deps = -r{toxinidir}/test-requirements.txt
passenv = HOME
[testenv:manifests]
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:plugin_zabbix_monitoring_emc]
changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}
whitelist_externals =
bundle
mkdir
commands =
mkdir -p {toxinidir}/.bundled_gems
bundle install --path {toxinidir}/.bundled_gems
bundle exec rake test
[testenv:build_plugin]
changedir = {toxinidir}
whitelist_externals=
fpb
rm
commands =
rm -rf .build
rm -rf repositories/ubuntu/*.deb
rm -rf repositories/centos/*.rpm
fpb --check {toxinidir} --debug
fpb --build {toxinidir} --debug
[testenv:docs]
changedir = {toxinidir}/doc/plugin-guide
whitelist_externals = make
commands =
make clean html SPHINXOPTS=-W
[testenv:qa_docs]
changedir = {toxinidir}/doc/qa
whitelist_externals = make
commands =
make clean html SPHINXOPTS=-W