Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit CommitInterval when writer is configured for database #972

Merged
merged 2 commits into from
Jun 29, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test to exercise writer configuration
  • Loading branch information
ph448 committed Jun 1, 2021
commit a059cd56b8a378d45d01cd0b207f5ddb62905757
33 changes: 27 additions & 6 deletions spec/classes/collectd_plugin_postgresql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
'valuesfrom' => 'log_delay'
}]
}
},
writers: {
'sqlstore' => {
'statement' => 'SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);',
'storerates' => true
}
}
}
end
Expand All @@ -66,6 +60,33 @@
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_query_log_delay').with(content: %r{Statement \"SELECT \* FROM log_delay_repli;\"\n})
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_query_log_delay').with(content: %r{<Result>\n})
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_query_log_delay').with(content: %r{Param \"database\"})
end
end

context ':ensure => present and create a db with a custom writer' do
let(:params) do
{
databases: {
'postgres' => {
'host' => 'localhost',
'user' => 'postgres',
'password' => 'postgres',
'interval' => 10,
'writer' => 'sqlstore'
},
},
writers: {
'sqlstore' => {
'statement' => 'SELECT collectd_insert($1, $2, $3, $4, $5, $6, $7, $8, $9);',
'storerates' => true
}
}
}
end

it "Will create #{options[:plugin_conf_dir]}/postgresql-config.conf" do
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_db_postgres').with(content: %r{Writer \"sqlstore\"})
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_db_postgres').with(content: %r{CommitInterval 10})
is_expected.to contain_concat__fragment('collectd_plugin_postgresql_conf_writer_sqlstore').with(content: %r{<Writer sqlstore>\n})
end
end
Expand Down