Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add extra JsonWriterTest to show that the LimitBehavior addition is not breaking #1643

Merged
merged 11 commits into from
May 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -78,10 +78,6 @@ private JsonStreamWriter(Builder builder)
this.protoSchema = ProtoSchemaConverter.convert(this.descriptor);
this.totalMessageSize = protoSchema.getSerializedSize();
streamWriterBuilder.setWriterSchema(protoSchema);
if (builder.flowControlSettings != null) {
GaoleMeng marked this conversation as resolved.
Show resolved Hide resolved
streamWriterBuilder.setLimitExceededBehavior(
builder.flowControlSettings.getLimitExceededBehavior());
}
setStreamWriterSettings(
builder.channelProvider,
builder.credentialsProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ public void testFlowControlSetting() throws Exception {
.setMaxOutstandingRequestBytes(1L)
.build())
.build()) {
testBigQueryWrite.addResponse(AppendRowsResponse.newBuilder().build());
JSONObject foo = new JSONObject();
foo.put("test_int", 10);
JSONArray jsonArr = new JSONArray();
Expand All @@ -581,4 +582,25 @@ public void run() throws Throwable {
"Exceeds client side inflight buffer, consider add more buffer or open more connections"));
}
}

@Test
public void testFlowControlSettingNoLimitBehavior() throws Exception {
yirutang marked this conversation as resolved.
Show resolved Hide resolved
TableSchema tableSchema = TableSchema.newBuilder().addFields(0, TEST_INT).build();
try (JsonStreamWriter writer =
JsonStreamWriter.newBuilder(TEST_STREAM, tableSchema)
.setChannelProvider(channelProvider)
.setCredentialsProvider(NoCredentialsProvider.create())
.setFlowControlSettings(
FlowControlSettings.newBuilder()
.setMaxOutstandingRequestBytes(1L)
.build())
.build()) {
JSONObject foo = new JSONObject();
foo.put("test_int", 10);
JSONArray jsonArr = new JSONArray();
jsonArr.put(foo);
ApiFuture<AppendRowsResponse> appendFuture = writer.append(jsonArr);
appendFuture.get();
}
}
}