Add initial tests for influxdb module

This change implements the necessary bits and pieces for testing the
influxdb module.

Change-Id: I47ff671b1ca2ca8929071c693758c8706f37661d
This commit is contained in:
Guillaume Thouvenin 2016-01-08 14:17:33 +01:00
parent 562b1e786c
commit 53e2344f13
9 changed files with 131 additions and 3 deletions

View File

@ -0,0 +1,10 @@
fixtures:
repositories:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
ref: "4.7.0"
inifile:
repo: "git://github.com/puppetlabs/puppetlabs-inifile"
ref: "1.4.1"
symlinks:
influxdb: "#{source_dir}"

View File

@ -0,0 +1,4 @@
spec/fixtures/modules/*
spec/fixtures/manifests/*
Gemfile.lock
.bundle

View File

@ -0,0 +1,24 @@
# Copyright 2016 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 'rspec'
gem 'rspec-puppet'
gem 'rspec-puppet-facts'
gem 'puppetlabs_spec_helper'
gem 'metadata-json-lint'
end

View File

@ -0,0 +1,25 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'puppet-syntax/tasks/puppet-syntax'
require 'metadata-json-lint/rake_task'
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')
exclude_paths = [
"pkg/**/*",
"vendor/**/*",
"spec/**/*",
]
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths
desc "Run metadata_lint, lint, syntax, and spec tests."
task :test => [
:metadata_lint,
:lint,
:syntax,
:spec,
]

View File

@ -3,7 +3,7 @@
"version": "1.0.0",
"author": "Guillaume Thouvenin <gthouvenin@mirantis.com>",
"summary": "Install and configure InfluxDB",
"license": "Apache License 2.0",
"license": "Apache-2.0",
"source": "git://git.openstack.org/cgit/stackforge/fuel-plugin-influxdb-grafana.git",
"project_page": "none",
"issues_url": "none",
@ -20,6 +20,6 @@
"description": "Puppet module for installing and configuring InfluxDB",
"dependencies": [
{"name": "puppetlabs/stdlib", "version_requirement": "4.x"},
{"name": "puppetlabs/inifile", "version_requirement": ">= 1.0.0" },
{"name": "puppetlabs/inifile", "version_requirement": ">= 1.0.0"}
]
}

View File

@ -0,0 +1,26 @@
# Copyright 2016 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.
require 'spec_helper'
describe 'influxdb' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian'}
end
describe 'with defaults' do
it { is_expected.to compile }
end
end

View File

@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace

View File

@ -0,0 +1,22 @@
# Copyright 2016 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.
require 'rspec-puppet'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
c.environmentpath = File.join(Dir.pwd, 'spec')
end

13
tox.ini
View File

@ -1,5 +1,5 @@
[tox]
envlist = manifests,lma_monitoring_analytics,docs,build_plugin
envlist = manifests,influxdb,lma_monitoring_analytics,docs,build_plugin
skipsdist = True
[testenv]
@ -17,6 +17,17 @@ commands =
bundle install --path {toxinidir}/.bundled_gems
bundle exec rake test
[testenv:influxdb]
deps =
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:lma_monitoring_analytics]
deps =
changedir = {toxinidir}/deployment_scripts/puppet/modules/{envname}