0
0
mirror of https://github.com/signalapp/Signal-Server.git synced 2024-09-20 03:52:16 +02:00

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.
This commit is contained in:
Jeff Hodges 2020-06-12 15:07:24 -07:00 committed by Jon Chambers
parent 734dc2e37a
commit e3af0a13da

View File

@ -42,7 +42,7 @@ public class WebSocketRequestLogTest {
assertThat(listAppender.list.size()).isEqualTo(1); assertThat(listAppender.list.size()).isEqualTo(1);
String loggedLine = new String(listAppender.outputStream.toByteArray()); 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 @Test
@ -65,7 +65,7 @@ public class WebSocketRequestLogTest {
assertThat(listAppender.list.size()).isEqualTo(1); assertThat(listAppender.list.size()).isEqualTo(1);
String loggedLine = new String(listAppender.outputStream.toByteArray()); 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(listAppender.list.get(0));
System.out.println(new String(listAppender.outputStream.toByteArray())); System.out.println(new String(listAppender.outputStream.toByteArray()));