Adds tests for connection loss exception handling, and unretryable SQL exceptions

This commit is contained in:
Karl Southern
2016-06-29 18:48:12 +01:00
parent 7d699e400c
commit ab566ee969
6 changed files with 76 additions and 23 deletions

View File

@@ -9,20 +9,17 @@ describe 'logstash-output-jdbc: derby', if: ENV['JDBC_DERBY_JAR'] 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))"
"CREATE table #{jdbc_test_table} (created_at timestamp not null, message varchar(512) not null)"
end
let(:jdbc_settings) do
{
'driver_class' => 'org.apache.derby.jdbc.EmbeddedDriver',
'connection_string' => 'jdbc:derby:memory:testdb;create=true',
'driver_jar_path' => ENV[jdbc_jar_env],
'statement' => ['insert into logstash_output_jdbc_test (created_at, message) values(?, ?)', '@timestamp', 'message']
'statement' => ['insert into logstash_output_jdbc_test (created_at, message) values(?, ?)', '@timestamp', 'message'],
'max_flush_exceptions' => 1
}
end
end

View File

@@ -9,12 +9,17 @@ describe 'logstash-output-jdbc: mysql', if: ENV['JDBC_MYSQL_JAR'] do
'JDBC_MYSQL_JAR'
end
let(:systemd_database_service) do
'mysql'
end
let(:jdbc_settings) do
{
'driver_class' => 'com.mysql.jdbc.Driver',
'connection_string' => 'jdbc:mysql://localhost/logstash_output_jdbc_test?user=root',
'driver_jar_path' => ENV[jdbc_jar_env],
'statement' => ["insert into #{jdbc_test_table} (created_at, message) values(?, ?)", '@timestamp', 'message']
'statement' => ["insert into #{jdbc_test_table} (created_at, message) values(?, ?)", '@timestamp', 'message'],
'max_flush_exceptions' => 1
}
end
end

View File

@@ -20,7 +20,8 @@ describe 'logstash-output-jdbc: sqlite', if: ENV['JDBC_SQLITE_JAR'] do
'driver_class' => 'org.sqlite.JDBC',
'connection_string' => "jdbc:sqlite:#{JDBC_SQLITE_FILE}",
'driver_jar_path' => ENV[jdbc_jar_env],
'statement' => ["insert into #{jdbc_test_table} (created_at, message) values(?, ?)", '@timestamp', 'message']
'statement' => ["insert into #{jdbc_test_table} (created_at, message) values(?, ?)", '@timestamp', 'message'],
'max_flush_exceptions' => 1
}
end
end