Fixed edge client tests by setting correctly max inbound message size

This commit is contained in:
Volodymyr Babak 2023-04-10 13:12:11 +03:00
parent 63703bcfdb
commit c95cff74f7
5 changed files with 16 additions and 12 deletions

View File

@ -134,8 +134,10 @@ public final class EdgeGrpcSession implements Closeable {
if (ConnectResponseCode.ACCEPTED != responseMsg.getResponseCode()) { if (ConnectResponseCode.ACCEPTED != responseMsg.getResponseCode()) {
outputStream.onError(new RuntimeException(responseMsg.getErrorMsg())); outputStream.onError(new RuntimeException(responseMsg.getErrorMsg()));
} else { } else {
log.debug("[{}] Client max inbound message size: {}", sessionId, requestMsg.getConnectRequestMsg().getMaxInboundMessageSize()); if (requestMsg.getConnectRequestMsg().hasMaxInboundMessageSize()) {
clientMaxInboundMessageSize = requestMsg.getConnectRequestMsg().getMaxInboundMessageSize(); log.debug("[{}] Client max inbound message size: {}", sessionId, requestMsg.getConnectRequestMsg().getMaxInboundMessageSize());
clientMaxInboundMessageSize = requestMsg.getConnectRequestMsg().getMaxInboundMessageSize();
}
connected = true; connected = true;
} }
} }

View File

@ -960,7 +960,6 @@ edges:
scheduler_pool_size: "${EDGES_SCHEDULER_POOL_SIZE:1}" scheduler_pool_size: "${EDGES_SCHEDULER_POOL_SIZE:1}"
send_scheduler_pool_size: "${EDGES_SEND_SCHEDULER_POOL_SIZE:1}" send_scheduler_pool_size: "${EDGES_SEND_SCHEDULER_POOL_SIZE:1}"
grpc_callback_thread_pool_size: "${EDGES_GRPC_CALLBACK_POOL_SIZE:1}" grpc_callback_thread_pool_size: "${EDGES_GRPC_CALLBACK_POOL_SIZE:1}"
edge_events_ttl: "${EDGES_EDGE_EVENTS_TTL:0}"
state: state:
persistToTelemetry: "${EDGES_PERSIST_STATE_TO_TELEMETRY:false}" persistToTelemetry: "${EDGES_PERSIST_STATE_TO_TELEMETRY:false}"

View File

@ -104,13 +104,14 @@ public class EdgeImitator {
ignoredTypes = new ArrayList<>(); ignoredTypes = new ArrayList<>();
this.routingKey = routingKey; this.routingKey = routingKey;
this.routingSecret = routingSecret; this.routingSecret = routingSecret;
setEdgeCredentials("rpcHost", host); updateEdgeClientFields("rpcHost", host);
setEdgeCredentials("rpcPort", port); updateEdgeClientFields("rpcPort", port);
setEdgeCredentials("timeoutSecs", 3); updateEdgeClientFields("timeoutSecs", 3);
setEdgeCredentials("keepAliveTimeSec", 300); updateEdgeClientFields("keepAliveTimeSec", 300);
updateEdgeClientFields("maxInboundMessageSize", 4194304);
} }
private void setEdgeCredentials(String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException { private void updateEdgeClientFields(String fieldName, Object value) throws NoSuchFieldException, IllegalAccessException {
Field fieldToSet = edgeRpcClient.getClass().getDeclaredField(fieldName); Field fieldToSet = edgeRpcClient.getClass().getDeclaredField(fieldName);
fieldToSet.setAccessible(true); fieldToSet.setAccessible(true);
fieldToSet.set(edgeRpcClient, value); fieldToSet.set(edgeRpcClient, value);

View File

@ -124,8 +124,10 @@ public class EdgeGrpcClient implements EdgeRpcClient {
if (responseMsg.hasConnectResponseMsg()) { if (responseMsg.hasConnectResponseMsg()) {
ConnectResponseMsg connectResponseMsg = responseMsg.getConnectResponseMsg(); ConnectResponseMsg connectResponseMsg = responseMsg.getConnectResponseMsg();
if (connectResponseMsg.getResponseCode().equals(ConnectResponseCode.ACCEPTED)) { if (connectResponseMsg.getResponseCode().equals(ConnectResponseCode.ACCEPTED)) {
log.debug("[{}] Server max inbound message size: {}", edgeKey, connectResponseMsg.getMaxInboundMessageSize()); if (connectResponseMsg.hasMaxInboundMessageSize()) {
serverMaxInboundMessageSize = connectResponseMsg.getMaxInboundMessageSize(); log.debug("[{}] Server max inbound message size: {}", edgeKey, connectResponseMsg.getMaxInboundMessageSize());
serverMaxInboundMessageSize = connectResponseMsg.getMaxInboundMessageSize();
}
log.info("[{}] Configuration received: {}", edgeKey, connectResponseMsg.getConfiguration()); log.info("[{}] Configuration received: {}", edgeKey, connectResponseMsg.getConfiguration());
onEdgeUpdate.accept(connectResponseMsg.getConfiguration()); onEdgeUpdate.accept(connectResponseMsg.getConfiguration());
} else { } else {

View File

@ -68,7 +68,7 @@ message ConnectRequestMsg {
string edgeRoutingKey = 1; string edgeRoutingKey = 1;
string edgeSecret = 2; string edgeSecret = 2;
EdgeVersion edgeVersion = 3; EdgeVersion edgeVersion = 3;
int32 maxInboundMessageSize = 4; optional int32 maxInboundMessageSize = 4;
} }
enum ConnectResponseCode { enum ConnectResponseCode {
@ -81,7 +81,7 @@ message ConnectResponseMsg {
ConnectResponseCode responseCode = 1; ConnectResponseCode responseCode = 1;
string errorMsg = 2; string errorMsg = 2;
EdgeConfiguration configuration = 3; EdgeConfiguration configuration = 3;
int32 maxInboundMessageSize = 4; optional int32 maxInboundMessageSize = 4;
} }
message SyncRequestMsg { message SyncRequestMsg {