forked from voxpupuli/puppet-prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for mysqld_exporter version 0.11.0 (voxpupuli#247)
Flags now use the Kingpin library, and require double-dashes. prometheus/mysqld_exporter#222
- Loading branch information
1 parent
6855851
commit 2ce385e
Showing
3 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'prometheus mysqld exporter' do | ||
it 'mysqld_exporter works idempotently with no errors' do | ||
if default[:platform] =~ %r{ubuntu-18.04-amd64} | ||
pp = "package{'iproute2': ensure => present}" | ||
apply_manifest(pp, catch_failures: true) | ||
end | ||
pp = 'include prometheus::mysqld_exporter' | ||
# Run it twice and test for idempotency | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
describe 'default install' do | ||
describe service('mysqld_exporter') do | ||
it { is_expected.to be_running } | ||
it { is_expected.to be_enabled } | ||
end | ||
# the class installs an the mysqld_exporter that listens on port 9104 | ||
describe port(9104) do | ||
it { is_expected.to be_listening.with('tcp6') } | ||
end | ||
describe process('mysqld_exporter') do | ||
its(:args) { is_expected.to match %r{\ -config.my-cnf} } | ||
end | ||
end | ||
|
||
describe 'update prometheus mysqld exporter' do | ||
it 'update mysqld_exporter to 0.11.0' do | ||
pp = "class {'prometheus::mysqld_exporter': version => '0.11.0' }" | ||
apply_manifest(pp, catch_failures: true) | ||
end | ||
describe process('mysqld_exporter') do | ||
its(:args) { is_expected.to match %r{\ --config.my-cnf} } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'spec_helper' | ||
|
||
describe 'prometheus::mysqld_exporter' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts.merge(os_specific_facts(facts)) | ||
end | ||
|
||
context 'default' do | ||
describe 'options is correct' do | ||
it { is_expected.to contain_prometheus__daemon('mysqld_exporter').with('options' => '-config.my-cnf=/etc/.my.cnf ') } | ||
end | ||
end | ||
|
||
context 'with version >= 0.11.0' do | ||
let(:params) do | ||
{ | ||
version: '0.11.0' | ||
} | ||
end | ||
|
||
describe 'options is correct' do | ||
it { is_expected.to contain_prometheus__daemon('mysqld_exporter').with('options' => '--config.my-cnf=/etc/.my.cnf ') } | ||
end | ||
end | ||
end | ||
end | ||
end |