Skip to content

Commit

Permalink
- Fix some date testing that broke after DST switch
Browse files Browse the repository at this point in the history
- disable some tests until they get converted to be jruby-friendly
  • Loading branch information
jordansissel committed Mar 17, 2011
1 parent 1384017 commit cc7137d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/logstash/filters/date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def register
case value
when "ISO8601"
p "Using iso8601 parser"
parser = org.joda.time.format.ISODateTimeFormat.dateTimeParser()
parser = org.joda.time.format.ISODateTimeFormat.dateTimeParser
missing = []
else
parser = org.joda.time.format.DateTimeFormat.forPattern(value)
Expand Down
8 changes: 3 additions & 5 deletions test/logstash/filters/test_date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
require "logstash/filters/date"
require "logstash/event"

$tz = Time.now.strftime("%z")
$TZ = $tz[0..2] + ":" + $tz[3..-1]

class TestFilterDate < Test::Unit::TestCase

# These tests assume a given timezone.
def setup
ENV["TZ"] = "PST8PDT"
end
Expand All @@ -39,8 +37,8 @@ def test_iso8601
config "field1" => "ISO8601"

times = {
"2001-01-01T00:00:00#{$TZ}" => "2001-01-01T08:00:00.000Z",
"1974-03-02T04:09:09#{$TZ}" => "1974-03-02T12:09:09.000Z",
"2001-01-01T00:00:00-0800" => "2001-01-01T08:00:00.000Z",
"1974-03-02T04:09:09-0800" => "1974-03-02T12:09:09.000Z",
"2010-05-03T08:18:18+00:00" => "2010-05-03T08:18:18.000Z",
"2004-07-04T12:27:27-00:00" => "2004-07-04T12:27:27.000Z",
"2001-09-05T16:36:36+0000" => "2001-09-05T16:36:36.000Z",
Expand Down
28 changes: 20 additions & 8 deletions test/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
# Fix for Ruby 1.9.x
$:.unshift "#{File.dirname(__FILE__)}"

require "logstash/test_syntax"
require "logstash/filters/test_date"
require "logstash/filters/test_grep"
require "logstash/filters/test_multiline"
require "logstash/inputs/test_file"
require "logstash/inputs/test_syslog"
require "logstash/inputs/test_stomp"
require "logstash/outputs/test_elasticsearch"
def skip(path)
puts "Skipping tests: #{path}"
end

def use(path)
puts "Loading tests from #{path}"
require path
end

use "logstash/test_syntax"
use "logstash/filters/test_date"
use "logstash/filters/test_grep"
use "logstash/filters/test_multiline"
use "logstash/filters/test_grok"


skip "logstash/inputs/test_file"
skip "logstash/inputs/test_syslog"
skip "logstash/inputs/test_stomp"
skip "logstash/outputs/test_elasticsearch"

0 comments on commit cc7137d

Please sign in to comment.