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()
17
17
. ThrowExceptions ( ) ;
18
18
var client = new ElasticClient ( settings ) ;
19
19
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
20
24
exception . InnerException . Should ( ) . NotBeNull ( ) ;
25
+ #endif
21
26
exception . Response . Should ( ) . NotBeNull ( ) ;
22
27
exception . Response . ServerError . Should ( ) . NotBeNull ( ) ;
23
28
exception . Response . ServerError . Status . Should ( ) . BeGreaterThan ( 0 ) ;
@@ -40,7 +45,12 @@ public void ServerTestWhenThrowExceptionsDisabled()
40
45
var settings = new ConnectionSettings ( new Uri ( $ "http://{ TestClient . Host } :9200") ) ;
41
46
var client = new ElasticClient ( settings ) ;
42
47
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
43
52
response . CallDetails . OriginalException . Should ( ) . NotBeNull ( ) ;
53
+ #endif
44
54
response . CallDetails . ServerError . Should ( ) . NotBeNull ( ) ;
45
55
response . CallDetails . ServerError . Status . Should ( ) . BeGreaterThan ( 0 ) ;
46
56
}
Original file line number Diff line number Diff line change 1
1
# mode either u (unit test), i (integration test) or m (mixed mode)
2
- mode : u
2
+ mode : i
3
3
# the elasticsearch version that should be started
4
4
elasticsearch_version : 2.0.1
5
5
# 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