From 688cbf12a37756922dedc8e02c8ce25fbdcd3af0 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Wed, 23 Sep 2020 07:30:15 +0200 Subject: [PATCH] Try to fix test failing do to timezones. --- README.md | 2 +- .../groovy/biz/nellemann/syslogd/SyslogParserTest.groovy | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6d22fc7..b76e95f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Basic syslog server written in Java. All received messages are written to *stdout*. -The syslog server is able to listen on UDP and/or TCP and parses syslog messages in either RFC5424 or RFC3164 (BSD) format. +The syslog server is able to listen on UDP and/or TCP and parses syslog messages in either RFC5424 or RFC3164 (BSD) format. The default syslog port (514) requires you to run syslogd as root / administrator. If you do not with to do so, you can choose a port number (with the -p flag) above 1024. *This project is in no way associated with, supported or endorsed by, International Business Machines Corporation (IBM).* diff --git a/src/test/groovy/biz/nellemann/syslogd/SyslogParserTest.groovy b/src/test/groovy/biz/nellemann/syslogd/SyslogParserTest.groovy index aff97d6..222e27d 100644 --- a/src/test/groovy/biz/nellemann/syslogd/SyslogParserTest.groovy +++ b/src/test/groovy/biz/nellemann/syslogd/SyslogParserTest.groovy @@ -2,21 +2,21 @@ package biz.nellemann.syslogd import spock.lang.Specification import java.time.Instant -import java.time.LocalDateTime; +import java.time.OffsetDateTime; class SyslogParserTest extends Specification { void "test parseRfc3164Timestamp"() { setup: - LocalDateTime dt = LocalDateTime.now() + OffsetDateTime odt = OffsetDateTime.now() String dateString = "Sep 12 22:50:13" when: Instant inst = SyslogParser.parseRfc3164Timestamp(dateString) then: - inst.toString() == "${dt.getYear()}-09-12T20:50:13Z" + inst.toString() == "${odt.getYear()}-09-12T20:50:13Z" } void "test parseRfc5424Timestamp"() {