Skip to content

Commit

Permalink
Re #96: Fixed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalcz committed Aug 26, 2022
1 parent 79d20bc commit 92fdfca
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ void shouldDeserialize() throws IOException {
serializer.writeTo(
0,
System.currentTimeMillis(),
0,
labelSerializer,
ByteBuffer.wrap("Test".getBytes())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ static Stream<Arguments> variousMessageConfigurations() {
+ 21 // log level
+ 45 // labels string sizes
+ 6 * 4 // labels string length indicators
+ 8 // timestamp
+ 8 // timestamp millis
+ 8 // timestamp nanos
+ 4 // labels count
),
Arguments.of(
Expand All @@ -48,7 +49,8 @@ static Stream<Arguments> variousMessageConfigurations() {
"[Mando] You have something I want.",
38 // log line
+ 21 // log level
+ 8 // timestamp
+ 8 // timestamp millis
+ 8 // timestamp nanos
+ 4 // labels count
),
Arguments.of(
Expand All @@ -63,7 +65,8 @@ static Stream<Arguments> variousMessageConfigurations() {
38 // log line
+ 45 // labels string sizes
+ 6 * 4 // labels string length indicators
+ 8 // timestamp
+ 8 // timestamp millis
+ 8 // timestamp nanos
+ 4 // labels count
)
);
Expand Down Expand Up @@ -93,6 +96,7 @@ void shouldSerializeMessage(
serializer.writeTo(
0,
32042L,
0,
labelSerializer,
ByteBuffer.wrap(logLine.getBytes())
);
Expand Down Expand Up @@ -130,9 +134,9 @@ void shouldSerializeMessage(

assertThat(stream.getLabels()).isEqualToIgnoringWhitespace(
Streams.concat(
incomingLabelsStream,
logLevelStream
)
incomingLabelsStream,
logLevelStream
)
.collect(joining(",", "{", "}"))
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void shouldDeserializeMessageAndAddStaticLabels(
serializer.writeTo(
0,
32042L,
0,
labelSerializer,
ByteBuffer.wrap(logLine.getBytes())
);
Expand Down Expand Up @@ -122,6 +123,7 @@ void shouldOverrideStaticLabelsWithIncoming() throws InvalidProtocolBufferExcept
serializer.writeTo(
0,
32042L,
0,
labelSerializer,
ByteBuffer.wrap("[Mando] You have something I want.".getBytes())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void shouldWorkWithNoDynamicLabels() {
// Then
verify(tjahziLogger).log(
eq(timestamp),
eq(0),
eq(labelSerializer),
any()
);
Expand Down Expand Up @@ -110,6 +111,7 @@ void shouldPerformSubstitutionOnDynamicLabels() {
// Then
verify(tjahziLogger).log(
eq(timestamp),
eq(0),
eq(labelSerializer),
any()
);
Expand Down

0 comments on commit 92fdfca

Please sign in to comment.