File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
ClientConcepts/Exceptions Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,12 @@ public void ServerTestWhenThrowExceptionsEnabled()
1717 . ThrowExceptions ( ) ;
1818 var client = new ElasticClient ( settings ) ;
1919 var exception = Assert . Throws < ElasticsearchClientException > ( ( ) => client . GetMapping < Project > ( s => s . Index ( "doesntexist" ) ) ) ;
20+ #if DOTNETCORE
21+ // HttpClient does not throw on "known error" status codes (i.e. 404) thus the inner exception should not be set
22+ exception . InnerException . Should ( ) . BeNull ( ) ;
23+ #else
2024 exception . InnerException . Should ( ) . NotBeNull ( ) ;
25+ #endif
2126 exception . Response . Should ( ) . NotBeNull ( ) ;
2227 exception . Response . ServerError . Should ( ) . NotBeNull ( ) ;
2328 exception . Response . ServerError . Status . Should ( ) . BeGreaterThan ( 0 ) ;
@@ -40,7 +45,12 @@ public void ServerTestWhenThrowExceptionsDisabled()
4045 var settings = new ConnectionSettings ( new Uri ( $ "http://{ TestClient . Host } :9200") ) ;
4146 var client = new ElasticClient ( settings ) ;
4247 var response = client . GetMapping < Project > ( s => s . Index ( "doesntexist" ) ) ;
48+ #if DOTNETCORE
49+ // HttpClient does not throw on "known error" status codes (i.e. 404) thus OriginalException should not be set
50+ response . CallDetails . OriginalException . Should ( ) . BeNull ( ) ;
51+ #else
4352 response . CallDetails . OriginalException . Should ( ) . NotBeNull ( ) ;
53+ #endif
4454 response . CallDetails . ServerError . Should ( ) . NotBeNull ( ) ;
4555 response . CallDetails . ServerError . Status . Should ( ) . BeGreaterThan ( 0 ) ;
4656 }
Original file line number Diff line number Diff line change 11# mode either u (unit test), i (integration test) or m (mixed mode)
2- mode : u
2+ mode : i
33# the elasticsearch version that should be started
44elasticsearch_version : 2.0.1
55# whether we want to forcefully reseed on the node, if you are starting the tests with a node already running
You can’t perform that action at this time.
0 commit comments