Try to fix test failing do to timezones.
This commit is contained in:
parent
8d832e93f2
commit
688cbf12a3
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
Basic syslog server written in Java. All received messages are written to *stdout*.
|
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).*
|
*This project is in no way associated with, supported or endorsed by, International Business Machines Corporation (IBM).*
|
||||||
|
|
||||||
|
|
|
@ -2,21 +2,21 @@ package biz.nellemann.syslogd
|
||||||
|
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDateTime;
|
import java.time.OffsetDateTime;
|
||||||
|
|
||||||
class SyslogParserTest extends Specification {
|
class SyslogParserTest extends Specification {
|
||||||
|
|
||||||
void "test parseRfc3164Timestamp"() {
|
void "test parseRfc3164Timestamp"() {
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
LocalDateTime dt = LocalDateTime.now()
|
OffsetDateTime odt = OffsetDateTime.now()
|
||||||
String dateString = "Sep 12 22:50:13"
|
String dateString = "Sep 12 22:50:13"
|
||||||
|
|
||||||
when:
|
when:
|
||||||
Instant inst = SyslogParser.parseRfc3164Timestamp(dateString)
|
Instant inst = SyslogParser.parseRfc3164Timestamp(dateString)
|
||||||
|
|
||||||
then:
|
then:
|
||||||
inst.toString() == "${dt.getYear()}-09-12T20:50:13Z"
|
inst.toString() == "${odt.getYear()}-09-12T20:50:13Z"
|
||||||
}
|
}
|
||||||
|
|
||||||
void "test parseRfc5424Timestamp"() {
|
void "test parseRfc5424Timestamp"() {
|
||||||
|
|
Loading…
Reference in a new issue