16
16
* specific language governing permissions and limitations
17
17
* under the License.
18
18
*/
19
+ //! These tests require a cluster configured with Security. One can be spun up using the
20
+ //! .ci/run-elasticsearch.sh script as follows:
21
+ //!
22
+ //! export TEST_SUITE=xpack
23
+ //! export STACK_VERSION=<a version that aligns with the client e.g. 7.8.0, 8.0.0-SNAPSHOT, etc>
24
+ //!
25
+ //! DETACH=true .ci/run-elasticsearch.sh
19
26
#![ cfg( any( feature = "native-tls" , feature = "rustls-tls" ) ) ]
20
27
21
28
extern crate os_type;
@@ -26,12 +33,10 @@ use common::*;
26
33
use elasticsearch:: cert:: { Certificate , CertificateValidation } ;
27
34
use os_type:: OSType ;
28
35
29
- // TODO: These tests require a cluster configured with Security. Figure out best way to surface this e.g. test category, naming convention, etc.
30
-
31
36
static CA_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/ca.crt" ) ;
32
37
static CA_CHAIN_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/ca-chain.crt" ) ;
33
- static TESTNODE_SAN_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/testnode_san.crt" ) ;
34
38
static TESTNODE_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/testnode.crt" ) ;
39
+ static TESTNODE_NO_SAN_CERT : & [ u8 ] = include_bytes ! ( "../../.ci/certs/testnode_no_san.crt" ) ;
35
40
36
41
fn expected_error_message ( ) -> String {
37
42
if cfg ! ( windows) {
@@ -139,7 +144,7 @@ async fn full_certificate_ca_chain_validation() -> Result<(), failure::Error> {
139
144
#[ tokio:: test]
140
145
#[ cfg( all( windows, feature = "native-tls" ) ) ]
141
146
async fn full_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
142
- let cert = Certificate :: from_pem ( TESTNODE_SAN_CERT ) ?;
147
+ let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
143
148
let builder =
144
149
client:: create_default_builder ( ) . cert_validation ( CertificateValidation :: Full ( cert) ) ;
145
150
let client = client:: create ( builder) ;
@@ -151,9 +156,9 @@ async fn full_certificate_validation() -> Result<(), failure::Error> {
151
156
#[ tokio:: test]
152
157
#[ cfg( feature = "rustls-tls" ) ]
153
158
async fn full_certificate_validation_rustls_tls ( ) -> Result < ( ) , failure:: Error > {
154
- let mut chain: Vec < u8 > = Vec :: with_capacity ( TESTNODE_SAN_CERT . len ( ) + CA_CERT . len ( ) ) ;
159
+ let mut chain: Vec < u8 > = Vec :: with_capacity ( TESTNODE_CERT . len ( ) + CA_CERT . len ( ) ) ;
155
160
chain. extend ( CA_CERT ) ;
156
- chain. extend ( TESTNODE_SAN_CERT ) ;
161
+ chain. extend ( TESTNODE_CERT ) ;
157
162
158
163
let cert = Certificate :: from_pem ( chain. as_slice ( ) ) ?;
159
164
let builder =
@@ -168,7 +173,7 @@ async fn full_certificate_validation_rustls_tls() -> Result<(), failure::Error>
168
173
#[ tokio:: test]
169
174
#[ cfg( all( unix, any( feature = "native-tls" , feature = "rustls-tls" ) ) ) ]
170
175
async fn full_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
171
- let cert = Certificate :: from_pem ( TESTNODE_SAN_CERT ) ?;
176
+ let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
172
177
let builder =
173
178
client:: create_default_builder ( ) . cert_validation ( CertificateValidation :: Full ( cert) ) ;
174
179
let client = client:: create ( builder) ;
@@ -203,7 +208,7 @@ async fn full_certificate_validation() -> Result<(), failure::Error> {
203
208
#[ tokio:: test]
204
209
#[ cfg( all( windows, feature = "native-tls" ) ) ]
205
210
async fn certificate_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
206
- let cert = Certificate :: from_pem ( TESTNODE_SAN_CERT ) ?;
211
+ let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
207
212
let builder =
208
213
client:: create_default_builder ( ) . cert_validation ( CertificateValidation :: Certificate ( cert) ) ;
209
214
let client = client:: create ( builder) ;
@@ -216,7 +221,7 @@ async fn certificate_certificate_validation() -> Result<(), failure::Error> {
216
221
#[ tokio:: test]
217
222
#[ cfg( all( unix, feature = "native-tls" ) ) ]
218
223
async fn certificate_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
219
- let cert = Certificate :: from_pem ( TESTNODE_SAN_CERT ) ?;
224
+ let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
220
225
let builder =
221
226
client:: create_default_builder ( ) . cert_validation ( CertificateValidation :: Certificate ( cert) ) ;
222
227
let client = client:: create ( builder) ;
@@ -264,7 +269,7 @@ async fn certificate_certificate_ca_validation() -> Result<(), failure::Error> {
264
269
#[ tokio:: test]
265
270
#[ cfg( feature = "native-tls" ) ]
266
271
async fn fail_certificate_certificate_validation ( ) -> Result < ( ) , failure:: Error > {
267
- let cert = Certificate :: from_pem ( TESTNODE_CERT ) ?;
272
+ let cert = Certificate :: from_pem ( TESTNODE_NO_SAN_CERT ) ?;
268
273
let builder =
269
274
client:: create_default_builder ( ) . cert_validation ( CertificateValidation :: Certificate ( cert) ) ;
270
275
0 commit comments