@@ -33,9 +33,12 @@ use common::*;
33
33
use elasticsearch:: cert:: { Certificate , CertificateValidation } ;
34
34
use os_type:: OSType ;
35
35
36
+ #[ allow( dead_code) ]
36
37
static CA_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/ca.crt" ) ;
38
+ #[ allow( dead_code) ]
37
39
static CA_CHAIN_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/ca-chain.crt" ) ;
38
40
static TESTNODE_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/testnode.crt" ) ;
41
+ #[ cfg( feature = "native-tls" ) ]
39
42
static TESTNODE_NO_SAN_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/testnode_no_san.crt" ) ;
40
43
41
44
fn expected_error_message ( ) -> String {
@@ -116,7 +119,7 @@ async fn none_certificate_validation() -> Result<(), failure::Error> {
116
119
/// Certificate provided by the server contains the one given to the client
117
120
/// within the authority chain, and hostname matches
118
121
#[ tokio:: test]
119
- #[ cfg( any( feature = "native-tls" , feature = "rustls-tls" ) ) ]
122
+ #[ cfg( all ( not ( target_os = "macos" ) , any( feature = "native-tls" , feature = "rustls-tls" ) ) ) ]
120
123
async fn full_certificate_ca_validation ( ) -> Result < ( ) , failure:: Error > {
121
124
let cert = Certificate :: from_pem ( CA_CERT ) ?;
122
125
let builder =
@@ -128,7 +131,7 @@ async fn full_certificate_ca_validation() -> Result<(), failure::Error> {
128
131
129
132
/// Try to load a certificate chain.
130
133
#[ tokio:: test]
131
- #[ cfg( any( feature = "native-tls" , feature = "rustls-tls" ) ) ]
134
+ #[ cfg( all ( any( feature = "native-tls" , feature = "rustls-tls" ) , not ( target_os = "macos" ) ) ) ]
132
135
async fn full_certificate_ca_chain_validation ( ) -> Result < ( ) , failure:: Error > {
133
136
let mut cert = Certificate :: from_pem ( CA_CHAIN_CERT ) ?;
134
137
cert. append ( Certificate :: from_pem ( CA_CERT ) ?) ;
@@ -154,7 +157,7 @@ async fn full_certificate_validation() -> Result<(), failure::Error> {
154
157
155
158
/// Certificate provided by the server is the one given to the client and hostname matches, using rustls-tls
156
159
#[ tokio:: test]
157
- #[ cfg( feature = "rustls-tls" ) ]
160
+ #[ cfg( all ( linux , feature = "rustls-tls" ) ) ]
158
161
async fn full_certificate_validation_rustls_tls ( ) -> Result < ( ) , failure:: Error > {
159
162
let mut chain: Vec < u8 > = Vec :: with_capacity ( TESTNODE_CERT . len ( ) + CA_CERT . len ( ) ) ;
160
163
chain. extend ( CA_CERT ) ;
@@ -171,7 +174,7 @@ async fn full_certificate_validation_rustls_tls() -> Result<(), failure::Error>
171
174
/// Certificate provided by the server is the one given to the client. This fails on Linux because
172
175
/// it appears that it also needs the CA for the cert
173
176
#[ tokio:: test]
174
- #[ cfg( all( unix , any( feature = "native-tls" , feature = "rustls-tls" ) ) ) ]
177
+ #[ cfg( all( linux , any( feature = "native-tls" , feature = "rustls-tls" ) ) ) ]
175
178
async fn full_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
176
179
let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
177
180
let builder =
@@ -228,10 +231,10 @@ async fn certificate_certificate_validation() -> Result<(), failure::Error> {
228
231
let result = client. ping ( ) . send ( ) . await ;
229
232
let os_type = os_type:: current_platform ( ) ;
230
233
match os_type. os_type {
231
- OSType :: OSX => match result {
232
- Ok ( _) => Ok ( ( ) ) ,
233
- Err ( e) => Err ( failure:: err_msg ( e. to_string ( ) ) ) ,
234
- } ,
234
+ // OSType::OSX => match result {
235
+ // Ok(_) => Ok(()),
236
+ // Err(e) => Err(failure::err_msg(e.to_string())),
237
+ // },
235
238
_ => match result {
236
239
Ok ( response) => Err ( failure:: err_msg ( format ! (
237
240
"Expected error but response was {}" ,
@@ -255,7 +258,7 @@ async fn certificate_certificate_validation() -> Result<(), failure::Error> {
255
258
/// Certificate provided by the server contains the one given to the client
256
259
/// within the authority chain
257
260
#[ tokio:: test]
258
- #[ cfg( feature = "native-tls" ) ]
261
+ #[ cfg( all ( feature = "native-tls" , not ( target_os = "macos" ) ) ) ]
259
262
async fn certificate_certificate_ca_validation ( ) -> Result < ( ) , failure:: Error > {
260
263
let cert = Certificate :: from_pem ( CA_CERT ) ?;
261
264
let builder =
0 commit comments