Fix IT to switch to GRPC service invocation.

This commit is contained in:
Artur Souza 2021-01-27 23:19:27 -08:00
parent 7eacfcc88f
commit 5d20a217a7
2 changed files with 15 additions and 1 deletions

View File

@ -140,18 +140,28 @@ public class DaprRun implements Stoppable {
System.getProperties().setProperty(Properties.GRPC_PORT.getName(), String.valueOf(this.ports.getGrpcPort()));
}
System.getProperties().setProperty(Properties.API_PROTOCOL.getName(), DaprApiProtocol.GRPC.name());
System.getProperties().setProperty(
Properties.API_METHOD_INVOCATION_PROTOCOL.getName(),
DaprApiProtocol.GRPC.name());
}
public void switchToGRPC() {
System.getProperties().setProperty(Properties.API_PROTOCOL.getName(), DaprApiProtocol.GRPC.name());
System.getProperties().setProperty(
Properties.API_METHOD_INVOCATION_PROTOCOL.getName(),
DaprApiProtocol.GRPC.name());
}
public void switchToHTTP() {
System.getProperties().setProperty(Properties.API_PROTOCOL.getName(), DaprApiProtocol.HTTP.name());
System.getProperties().setProperty(
Properties.API_METHOD_INVOCATION_PROTOCOL.getName(),
DaprApiProtocol.HTTP.name());
}
public void switchToProtocol(DaprApiProtocol protocol) {
System.getProperties().setProperty(Properties.API_PROTOCOL.getName(), protocol.name());
System.getProperties().setProperty(Properties.API_METHOD_INVOCATION_PROTOCOL.getName(), protocol.name());
}
public int getGrpcPort() {

View File

@ -139,7 +139,11 @@ public class MethodInvokeIT extends BaseIT {
client.invokeMethod(daprRun.getAppName(), "sleep", req.toByteArray(), HttpExtension.POST).block());
assertEquals("UNKNOWN", exception.getErrorCode());
assertEquals("UNKNOWN: HTTP status code: 500", exception.getMessage());
if (this.useGrpc) {
assertEquals("UNKNOWN: ", exception.getMessage());
} else {
assertEquals("UNKNOWN: HTTP status code: 500", exception.getMessage());
}
}
}
}