File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
modules/smithy4sTests/src/test/scala/jsonrpclib/smithy4sinterop Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,34 @@ object TestServerSpec extends SimpleIOSuite {
132
132
}
133
133
}
134
134
135
+ testRes(" internal error when processing notification should not break the server" ) {
136
+ implicit val greetInputEncoder : Encoder [PingInput ] = CirceJsonCodec .fromSchema
137
+
138
+ for {
139
+ ref <- SignallingRef [IO , Option [String ]](none).toStream
140
+ clientSideChannel <- setup(
141
+ channel => {
142
+ val testClient = ClientStub (TestClient , channel)
143
+ AlgebraWrapper (new TestServer [IO ] {
144
+ override def greet (name : String ): IO [GreetOutput ] = ???
145
+
146
+ override def ping (ping : String ): IO [Unit ] = {
147
+ if (ping == " fail" ) IO .raiseError(new RuntimeException (" throwing internal error on demand" ))
148
+ else testClient.pong(" pong" )
149
+ }
150
+ })
151
+ },
152
+ _ => AlgebraWrapper (new Client (ref))
153
+ )
154
+ remoteFunction = clientSideChannel.notificationStub[PingInput ](" ping" )
155
+ _ <- remoteFunction(PingInput (" fail" )).toStream
156
+ _ <- remoteFunction(PingInput (" ping" )).toStream
157
+ result <- ref.discrete.dropWhile(_.isEmpty).take(1 )
158
+ } yield {
159
+ expect.same(result, " pong" .some)
160
+ }
161
+ }
162
+
135
163
testRes(" server returns known error" ) {
136
164
implicit val greetInputEncoder : Encoder [GreetInput ] = CirceJsonCodec .fromSchema
137
165
implicit val greetOutputDecoder : Decoder [GreetOutput ] = CirceJsonCodec .fromSchema
You can’t perform that action at this time.
0 commit comments