Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ void testMultiplexedAppendSuccess_NonNullTraceId() throws Exception {
testMultiplexedIngestion(
/* sw1TraceId= */ "header_1:trailer_1",
/* sw2TraceId= */ "header_2:trailer_2",
/* expectedSW1TraceId= */ "java-streamwriter header_1:trailer_1",
/* expectedSW2TraceId= */ "java-streamwriter header_2:trailer_2");
/* expectedSW1TraceId= */ "java-streamwriter(:.+)? header_1:trailer_1",
/* expectedSW2TraceId= */ "java-streamwriter(:.+)? header_2:trailer_2");
}

@Test
void testMultiplexedAppendSuccess_EmptyTraceId() throws Exception {
testMultiplexedIngestion(
/* sw1TraceId= */ "header_1:trailer_1",
/* sw2TraceId= */ "",
/* expectedSW1TraceId= */ "java-streamwriter header_1:trailer_1",
/* expectedSW2TraceId= */ "java-streamwriter");
/* expectedSW1TraceId= */ "java-streamwriter(:.+)? header_1:trailer_1",
/* expectedSW2TraceId= */ "java-streamwriter(:.+)?");
}

private void testMultiplexedIngestion(
Expand Down Expand Up @@ -216,7 +216,7 @@ private void testMultiplexedIngestion(
assertThat(
serverRequest.getProtoRows().getWriterSchema().getProtoDescriptor().getName())
.isEqualTo("foo");
assertThat(serverRequest.getTraceId()).isEqualTo(expectedSW1TraceId);
assertThat(serverRequest.getTraceId()).matches(expectedSW1TraceId);
break;
case 1:
// The write stream is empty until we enter multiplexing.
Expand All @@ -232,7 +232,7 @@ private void testMultiplexedIngestion(
assertThat(
serverRequest.getProtoRows().getWriterSchema().getProtoDescriptor().getName())
.isEqualTo("complicate");
assertThat(serverRequest.getTraceId()).isEqualTo(expectedSW2TraceId);
assertThat(serverRequest.getTraceId()).matches(expectedSW2TraceId);
break;
case 3:
// Schema is empty if not at the first request after table switch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.google.cloud.bigquery.storage.v1;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
Expand Down Expand Up @@ -248,8 +249,8 @@ void testSingleAppendSimpleJson() throws Exception {
.getRows()
.getSerializedRows(0),
expectedProto.toByteString());
assertEquals(
"java-jsonwriter test:empty", testBigQueryWrite.getAppendRequests().get(0).getTraceId());
assertThat(testBigQueryWrite.getAppendRequests().get(0).getTraceId())
.matches("java-jsonwriter(:.+)? test:empty");
}
}

Expand Down Expand Up @@ -291,8 +292,8 @@ void testSingleAppendSimpleGson() throws Exception {
.getRows()
.getSerializedRows(0),
expectedProto.toByteString());
assertEquals(
"java-jsonwriter test:empty", testBigQueryWrite.getAppendRequests().get(0).getTraceId());
assertThat(testBigQueryWrite.getAppendRequests().get(0).getTraceId())
.matches("java-jsonwriter(:.+)? test:empty");
}
}

Expand Down Expand Up @@ -339,7 +340,8 @@ void testFlexibleColumnAppend() throws Exception {
.getRows()
.getSerializedRows(0),
expectedProto.toByteString());
assertEquals("java-jsonwriter", testBigQueryWrite.getAppendRequests().get(0).getTraceId());
assertThat(testBigQueryWrite.getAppendRequests().get(0).getTraceId())
.matches("java-jsonwriter(:.+)?");
}
}

Expand Down Expand Up @@ -561,7 +563,8 @@ void testSingleAppendMultipleSimpleJson() throws Exception {
.getProtoRows()
.getRows()
.getSerializedRowsCount());
assertEquals("java-jsonwriter", testBigQueryWrite.getAppendRequests().get(0).getTraceId());
assertThat(testBigQueryWrite.getAppendRequests().get(0).getTraceId())
.matches("java-jsonwriter(:.+)?");
for (int i = 0; i < 4; i++) {
assertEquals(
testBigQueryWrite
Expand Down
Loading