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

Add tzinfo-data and fix tests #97

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions logstash-input-jdbc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'logstash-codec-plain'
s.add_runtime_dependency 'sequel'
s.add_runtime_dependency 'tzinfo'
s.add_runtime_dependency 'tzinfo-data'
s.add_runtime_dependency 'rufus-scheduler'

s.add_development_dependency 'logstash-devutils'
Expand Down
7 changes: 4 additions & 3 deletions spec/inputs/jdbc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
require "date"

describe LogStash::Inputs::Jdbc do
# This is a necessary change test-wide to guarantee that no local timezone
# is picked up. It could be arbitrarily set to any timezone, but then the test
# would have to compensate differently. That's why UTC is chosen.
ENV["TZ"] = "Etc/UTC"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I overlooked that in the previous PR

let(:mixin_settings) do
{ "jdbc_user" => ENV['USER'], "jdbc_driver_class" => "org.apache.derby.jdbc.EmbeddedDriver",
"jdbc_connection_string" => "jdbc:derby:memory:testdb;create=true"}
Expand Down Expand Up @@ -235,7 +239,6 @@
let(:num_rows) { 10 }

before do
stub_const('ENV', ENV.to_hash.merge('TZ' => 'UTC'))
num_rows.times do
db[:test_table].insert(:num => 1, :custom_time => "2015-01-01 12:00:00", :created_at => Time.now.utc)
end
Expand All @@ -256,7 +259,6 @@
end

context "when fetching time data without jdbc_default_timezone set" do

let(:mixin_settings) do
{ "jdbc_user" => ENV['USER'], "jdbc_driver_class" => "org.apache.derby.jdbc.EmbeddedDriver",
"jdbc_connection_string" => "jdbc:derby:memory:testdb;create=true"
Expand All @@ -272,7 +274,6 @@
let(:num_rows) { 1 }

before do
stub_const('ENV', ENV.to_hash.merge('TZ' => 'UTC'))
num_rows.times do
db.run "INSERT INTO test_table (created_at, num, custom_time) VALUES (TIMESTAMP('2015-01-01 12:00:00'), 1, TIMESTAMP('2015-01-01 12:00:00'))"
end
Expand Down