Skip to content

Commit

Permalink
Remove JavaErrorsTest#propagate404 as it doesn't make sense anymore…
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Jun 21, 2023
1 parent 7500361 commit e8094a9
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 38 deletions.
1 change: 0 additions & 1 deletion contracts/src/main/proto/errors.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ service FailingService {
rpc Fail (ErrorMessage) returns (google.protobuf.Empty);
rpc FailAndHandle (ErrorMessage) returns (ErrorMessage);
rpc InvokeExternalAndHandleFailure(FailRequest) returns (ErrorMessage);
rpc HandleNotFound (FailRequest) returns (ErrorMessage);
}

message FailRequest {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package dev.restate.e2e.services.errors;

import com.google.protobuf.Empty;
import com.google.rpc.Code;
import dev.restate.e2e.services.errors.ErrorsProto.ErrorMessage;
import dev.restate.e2e.services.errors.ErrorsProto.FailRequest;
import dev.restate.e2e.services.utils.NumberSortHttpServerUtils;
import dev.restate.sdk.blocking.Awakeable;
import dev.restate.sdk.blocking.RestateBlockingService;
import dev.restate.sdk.core.TypeTag;
import io.grpc.MethodDescriptor;
import io.grpc.Status;
import io.grpc.StatusRuntimeException;
import io.grpc.stub.StreamObserver;
Expand Down Expand Up @@ -95,26 +93,4 @@ public void invokeExternalAndHandleFailure(
responseObserver.onNext(ErrorMessage.newBuilder().setErrorMessage(finalMessage).build());
responseObserver.onCompleted();
}

@Override
public void handleNotFound(FailRequest request, StreamObserver<ErrorMessage> responseObserver) {
var methodDescriptor =
FailingServiceGrpc.getFailMethod().toBuilder()
.setFullMethodName(
MethodDescriptor.generateFullMethodName(
FailingServiceGrpc.SERVICE_NAME, "UnknownFn"))
.build();
try {
restateContext().call(methodDescriptor, ErrorMessage.getDefaultInstance()).await();
} catch (StatusRuntimeException e) {
if (e.getStatus().getCode().value() == Code.NOT_FOUND_VALUE) {
responseObserver.onNext(ErrorMessage.newBuilder().setErrorMessage("notfound").build());
responseObserver.onCompleted();
} else {
throw new IllegalStateException("Got unexpected error: " + e.getMessage());
}
}

throw new IllegalStateException("This should be unreachable");
}
}
3 changes: 0 additions & 3 deletions services/node-services/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@ export class FailingService implements IFailingService {
invokeExternalAndHandleFailure(): Promise<ErrorMessage> {
throw new Error("Method not implemented.");
}
handleNotFound(): Promise<ErrorMessage> {
throw new Error("Method not implemented.");
}
}
10 changes: 0 additions & 10 deletions tests/src/test/kotlin/dev/restate/e2e/ErrorsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ class JavaErrorsTest : BaseErrorsTest() {
.extracting(ErrorMessage::getErrorMessage)
.isEqualTo("begin:external_call:internal_call")
}

@DisplayName("Test calling unknown service method from within another service")
@Test
fun propagate404(@InjectBlockingStub stub: FailingServiceBlockingStub) {
assertThat(
stub.handleNotFound(
FailRequest.newBuilder().setKey(UUID.randomUUID().toString()).build()))
.extracting(ErrorMessage::getErrorMessage)
.isEqualTo("notfound")
}
}

class NodeErrorsTest : BaseErrorsTest() {
Expand Down

0 comments on commit e8094a9

Please sign in to comment.