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:
parent
734dc2e37a
commit
e3af0a13da
|
@ -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()));
|
||||
|
|
Loading…
Reference in New Issue