1
1
// Copyright 2020 Contributors to the Parsec project.
2
2
// SPDX-License-Identifier: Apache-2.0
3
- use super :: { TestCoreClient , DEFAULT_APP_NAME } ;
3
+ use super :: { FailingMockIpc , TestCoreClient , DEFAULT_APP_NAME } ;
4
4
use crate :: error:: { ClientErrorKind , Error } ;
5
- use mockstream:: MockStream ;
5
+ use mockstream:: { FailingMockStream , MockStream } ;
6
6
use parsec_interface:: operations;
7
7
use parsec_interface:: operations:: list_providers:: ProviderInfo ;
8
8
use parsec_interface:: operations:: psa_algorithm:: * ;
@@ -15,6 +15,7 @@ use parsec_interface::requests::ResponseStatus;
15
15
use parsec_interface:: requests:: { request:: RequestHeader , Request } ;
16
16
use parsec_interface:: requests:: { AuthType , BodyType , Opcode , ProviderID } ;
17
17
use std:: collections:: HashSet ;
18
+ use std:: io:: ErrorKind ;
18
19
19
20
const PROTOBUF_CONVERTER : ProtobufConverter = ProtobufConverter { } ;
20
21
const REQ_HEADER : RequestHeader = RequestHeader {
@@ -411,3 +412,19 @@ fn auth_value_test() {
411
412
String :: from( DEFAULT_APP_NAME )
412
413
) ;
413
414
}
415
+
416
+ #[ test]
417
+ fn failing_ipc_test ( ) {
418
+ let mut client: TestCoreClient = Default :: default ( ) ;
419
+ client. set_ipc_client ( Box :: from ( FailingMockIpc ( FailingMockStream :: new (
420
+ ErrorKind :: ConnectionRefused ,
421
+ "connection was refused, so rude" ,
422
+ 1 ,
423
+ ) ) ) ) ;
424
+
425
+ let err = client. ping ( ) . expect_err ( "Expected to fail" ) ;
426
+ assert_eq ! (
427
+ err,
428
+ Error :: Client ( ClientErrorKind :: Interface ( ResponseStatus :: ConnectionError ) )
429
+ ) ;
430
+ }
0 commit comments