Make changes to lma_collector::collectd::mysql

This commit is related to the usage and documentation of the
lma_collector::collectd::mysql class.

The following changes are made:

1. Make the "username" and "password" parameters required. Today
   they default to the empty string, which doesn't make much sense.
2. Change the internal resource name from "nova" to "config". The
   name "nova" was confusing as the collection of MySQL statistics
   is unrelated to Nova. With this change the generated collectd
   configuration file is named "mysql-config.conf", which makes
   more sense than "mysql-nova.conf" and is consistent with other
   collectd config file names we have (e.g. "python-config.conf").
3. Add a unit test for the class.
4. Adjust the documentation.

Change-Id: I281c28d9f4da7ae728615041e175845ad5829b34
This commit is contained in:
Éric Lemoine
2016-02-09 00:20:25 -08:00
parent be85d7ebac
commit 54a2e4b4b9
5 changed files with 45 additions and 15 deletions

View File

@@ -0,0 +1,31 @@
# 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 'lma_collector::collectd::mysql' do
let(:facts) do
{:kernel => 'Linux', :operatingsystem => 'Ubuntu',
:osfamily => 'Debian', :concat_basedir => '/foo'}
end
describe 'with params' do
let(:params) do
{:username => 'user', :password => 'password'}
end
it { is_expected.to contain_collectd__plugin__mysql__database('config') \
.with_host('localhost') \
.with_username('user') \
.with_password('password') }
end
end