logstash-output-jdbc/spec/outputs/jdbc_spec.rb

41 lines
983 B
Ruby
Raw Normal View History

2016-05-03 14:28:01 +00:00
require_relative '../jdbc_spec_helper'
describe LogStash::Outputs::Jdbc do
2015-11-22 23:19:29 +00:00
2016-05-03 14:28:01 +00:00
include_context "rspec setup"
include_context "when initializing"
include_context "when outputting messages"
let(:jdbc_jar_env) do
'JDBC_DERBY_JAR'
end
let(:jdbc_drop_table) do
nil
end
let(:jdbc_create_table) do
"CREATE table #{jdbc_test_table} (created_at timestamp, message varchar(512))"
end
let(:jdbc_settings) do
2016-04-11 17:11:52 +00:00
{
"driver_class" => "org.apache.derby.jdbc.EmbeddedDriver",
"connection_string" => "jdbc:derby:memory:testdb;create=true",
2016-05-03 14:28:01 +00:00
"driver_jar_path" => ENV[jdbc_jar_env],
"statement" => [ "insert into logstash_output_jdbc_test (created_at, message) values(?, ?)", "@timestamp", "message" ]
2016-04-11 17:11:52 +00:00
}
2015-11-22 23:19:29 +00:00
end
2016-04-11 17:11:52 +00:00
context 'when initializing' do
2015-11-22 23:19:29 +00:00
2016-04-11 17:11:52 +00:00
it 'shouldn\'t register without a config' do
expect {
LogStash::Plugin.lookup("output", "jdbc").new()
}.to raise_error(LogStash::ConfigurationError)
2015-11-22 23:19:29 +00:00
end
end
2016-04-11 17:11:52 +00:00
end