From e3af0a13daaca382c3a813ab73fcd247b93b29dc Mon Sep 17 00:00:00 2001 From: Jeff Hodges Date: Fri, 12 Jun 2020 15:07:24 -0700 Subject: [PATCH] allow "+" before a timezone in request log tests GitHub Actions runs in UTC where the timezone starts with a "+" instead of our local dev machines (in PT or ET) which start with a "-" in numeric form. So, we expand the regex to allow for those in WebSocketRequestLogTest. Along the way, we change from calling `matches` directly on the strings to calling it on the `assertThat` to get better test output. --- .../websocket/logging/WebSocketRequestLogTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/websocket-resources/src/test/java/org/whispersystems/websocket/logging/WebSocketRequestLogTest.java b/websocket-resources/src/test/java/org/whispersystems/websocket/logging/WebSocketRequestLogTest.java index 9efeca676..93d68d2b4 100644 --- a/websocket-resources/src/test/java/org/whispersystems/websocket/logging/WebSocketRequestLogTest.java +++ b/websocket-resources/src/test/java/org/whispersystems/websocket/logging/WebSocketRequestLogTest.java @@ -42,7 +42,7 @@ public class WebSocketRequestLogTest { assertThat(listAppender.list.size()).isEqualTo(1); String loggedLine = new String(listAppender.outputStream.toByteArray()); - assertThat(loggedLine.matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} \\-[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"\\-\" \"\\-\"\n")).isTrue(); + assertThat(loggedLine).matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} (\\-|\\+)[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"\\-\" \"\\-\"\n"); } @Test @@ -65,7 +65,7 @@ public class WebSocketRequestLogTest { assertThat(listAppender.list.size()).isEqualTo(1); String loggedLine = new String(listAppender.outputStream.toByteArray()); - assertThat(loggedLine.matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} \\-[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"https://moxie.org\" \"SmertZeSmert\"\n")).isTrue(); + assertThat(loggedLine).matches("123\\.456\\.789\\.123 \\- \\- \\[[0-9]{2}\\/[a-zA-Z]{3}\\/[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2} (\\-|\\+)[0-9]{4}\\] \"GET \\/v1\\/test WS\" 200 \\- \"https://moxie.org\" \"SmertZeSmert\"\n"); System.out.println(listAppender.list.get(0)); System.out.println(new String(listAppender.outputStream.toByteArray()));