-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NODE-2625 Fixed GRPC Reflection API (#3910)
- Loading branch information
Showing
3 changed files
with
77 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
node-it/src/test/scala/com/wavesplatform/it/grpc/GrpcReflectionApiSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.wavesplatform.it.grpc | ||
|
||
import com.typesafe.config.Config | ||
import com.wavesplatform.it.NodeConfigs | ||
import com.wavesplatform.it.NodeConfigs.Default | ||
import com.wavesplatform.it.sync.grpc.GrpcBaseTransactionSuite | ||
import io.grpc.{CallOptions, ManagedChannelBuilder} | ||
import io.grpc.reflection.v1alpha.ServerReflectionGrpc.getServerReflectionInfoMethod | ||
import io.grpc.reflection.v1alpha.ServerReflectionRequest | ||
import io.grpc.stub.ClientCalls | ||
|
||
import scala.util.Try | ||
|
||
class GrpcReflectionApiSuite extends GrpcBaseTransactionSuite { | ||
override protected def nodeConfigs: Seq[Config] = | ||
NodeConfigs | ||
.Builder(Default, 1, Seq()) | ||
.overrideBase(_.quorum(0)) | ||
.overrideBase(_.raw("waves.extensions = [com.wavesplatform.api.grpc.GRPCServerExtension\ncom.wavesplatform.events.BlockchainUpdates]")) | ||
.buildNonConflicting() | ||
|
||
test("successful getServerReflectionInfo call for BU") { | ||
val buChannel = ManagedChannelBuilder | ||
.forAddress(nodes.head.networkAddress.getHostString, nodes.head.nodeExternalPort(6881)) | ||
.usePlaintext() | ||
.build() | ||
val call = buChannel.newCall(getServerReflectionInfoMethod, CallOptions.DEFAULT) | ||
val request = ServerReflectionRequest.newBuilder().setFileContainingSymbol("waves.events.grpc.BlockchainUpdatesApi").build() | ||
val result = Try(ClientCalls.blockingUnaryCall(call, request)) | ||
result.isSuccess shouldBe true | ||
result.get.hasFileDescriptorResponse shouldBe true | ||
} | ||
|
||
test("successful getServerReflectionInfo call for GRPC methods") { | ||
val call = nodes.head.grpcChannel.newCall(getServerReflectionInfoMethod, CallOptions.DEFAULT) | ||
val request = ServerReflectionRequest.newBuilder().setFileContainingSymbol("waves.node.grpc.BlocksApi").build() | ||
val result = Try(ClientCalls.blockingUnaryCall(call, request)) | ||
result.isSuccess shouldBe true | ||
result.get.hasFileDescriptorResponse shouldBe true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters