|
234 | 234 | end
|
235 | 235 | end
|
236 | 236 |
|
237 |
| - context 'with no expired server certificate' do |
238 |
| - it 'TLS handshake failed' do |
239 |
| - expect do |
240 |
| - client_encryption_expired.create_data_key( |
241 |
| - 'aws', |
242 |
| - { |
243 |
| - master_key: { |
244 |
| - region: "us-east-1", |
245 |
| - key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
246 |
| - endpoint: "127.0.0.1:8000", |
247 |
| - } |
248 |
| - } |
249 |
| - ) |
250 |
| - end.to raise_error(Mongo::Error::KmsError, /certificate has expired/) |
| 237 | + context 'with expired server certificate' do |
| 238 | + context "MRI" do |
| 239 | + require_mri |
| 240 | + |
| 241 | + it 'TLS handshake failed' do |
| 242 | + expect do |
| 243 | + client_encryption_expired.create_data_key( |
| 244 | + 'aws', |
| 245 | + { |
| 246 | + master_key: { |
| 247 | + region: "us-east-1", |
| 248 | + key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
| 249 | + endpoint: "127.0.0.1:8000", |
| 250 | + } |
| 251 | + } |
| 252 | + ) |
| 253 | + end.to raise_error(Mongo::Error::KmsError, /certificate has expired/) |
| 254 | + end |
| 255 | + end |
| 256 | + |
| 257 | + context 'JRuby' do |
| 258 | + require_jruby |
| 259 | + |
| 260 | + it 'TLS handshake failed' do |
| 261 | + expect do |
| 262 | + client_encryption_expired.create_data_key( |
| 263 | + 'aws', |
| 264 | + { |
| 265 | + master_key: { |
| 266 | + region: "us-east-1", |
| 267 | + key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
| 268 | + endpoint: "127.0.0.1:8000", |
| 269 | + } |
| 270 | + } |
| 271 | + ) |
| 272 | + end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 273 | + end |
251 | 274 | end
|
252 | 275 | end
|
253 | 276 |
|
254 | 277 | context 'with server certificate with invalid hostname' do
|
255 |
| - it 'TLS handshake failed' do |
256 |
| - expect do |
257 |
| - client_encryption_invalid_hostname.create_data_key( |
258 |
| - 'aws', |
259 |
| - { |
260 |
| - master_key: { |
261 |
| - region: "us-east-1", |
262 |
| - key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
263 |
| - endpoint: "127.0.0.1:8001", |
264 |
| - } |
265 |
| - } |
266 |
| - ) |
267 |
| - end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 278 | + context 'MRI' do |
| 279 | + require_mri |
| 280 | + |
| 281 | + it 'TLS handshake failed' do |
| 282 | + expect do |
| 283 | + client_encryption_invalid_hostname.create_data_key( |
| 284 | + 'aws', |
| 285 | + { |
| 286 | + master_key: { |
| 287 | + region: "us-east-1", |
| 288 | + key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
| 289 | + endpoint: "127.0.0.1:8001", |
| 290 | + } |
| 291 | + } |
| 292 | + ) |
| 293 | + end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 294 | + end |
| 295 | + end |
| 296 | + |
| 297 | + context 'JRuby' do |
| 298 | + require_jruby |
| 299 | + |
| 300 | + it 'TLS handshake failed' do |
| 301 | + expect do |
| 302 | + client_encryption_invalid_hostname.create_data_key( |
| 303 | + 'aws', |
| 304 | + { |
| 305 | + master_key: { |
| 306 | + region: "us-east-1", |
| 307 | + key: "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0", |
| 308 | + endpoint: "127.0.0.1:8001", |
| 309 | + } |
| 310 | + } |
| 311 | + ) |
| 312 | + end.to raise_error(Mongo::Error::KmsError, /TLS handshake failed due to a hostname mismatch/) |
| 313 | + end |
268 | 314 | end
|
269 | 315 | end
|
270 | 316 | end
|
|
296 | 342 | end
|
297 | 343 | end
|
298 | 344 |
|
299 |
| - context 'with no expired server certificate' do |
300 |
| - it 'TLS handshake failed' do |
301 |
| - expect do |
302 |
| - client_encryption_expired.create_data_key( |
303 |
| - kms_provider, |
304 |
| - { |
305 |
| - master_key: master_key |
306 |
| - } |
307 |
| - ) |
308 |
| - end.to raise_error(Mongo::Error::KmsError, /certificate has expired/) |
| 345 | + context 'MRI' do |
| 346 | + require_mri |
| 347 | + |
| 348 | + context 'with expired server certificate' do |
| 349 | + it 'TLS handshake failed' do |
| 350 | + expect do |
| 351 | + client_encryption_expired.create_data_key( |
| 352 | + kms_provider, |
| 353 | + { |
| 354 | + master_key: master_key |
| 355 | + } |
| 356 | + ) |
| 357 | + end.to raise_error(Mongo::Error::KmsError, /certificate has expired/) |
| 358 | + end |
| 359 | + end |
| 360 | + end |
| 361 | + |
| 362 | + context 'JRuby' do |
| 363 | + require_jruby |
| 364 | + |
| 365 | + context 'with expired server certificate' do |
| 366 | + it 'TLS handshake failed' do |
| 367 | + expect do |
| 368 | + client_encryption_expired.create_data_key( |
| 369 | + kms_provider, |
| 370 | + { |
| 371 | + master_key: master_key |
| 372 | + } |
| 373 | + ) |
| 374 | + end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 375 | + end |
309 | 376 | end
|
310 | 377 | end
|
311 | 378 |
|
312 | 379 | context 'with server certificate with invalid hostname' do
|
313 |
| - it 'TLS handshake failed' do |
314 |
| - expect do |
315 |
| - client_encryption_invalid_hostname.create_data_key( |
316 |
| - kms_provider, |
317 |
| - { |
318 |
| - master_key: master_key |
319 |
| - } |
320 |
| - ) |
321 |
| - end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 380 | + context 'MRI' do |
| 381 | + require_mri |
| 382 | + |
| 383 | + it 'TLS handshake failed' do |
| 384 | + expect do |
| 385 | + client_encryption_invalid_hostname.create_data_key( |
| 386 | + kms_provider, |
| 387 | + { |
| 388 | + master_key: master_key |
| 389 | + } |
| 390 | + ) |
| 391 | + end.to raise_error(Mongo::Error::KmsError, /certificate verify failed/) |
| 392 | + end |
| 393 | + end |
| 394 | + |
| 395 | + context 'JRuby' do |
| 396 | + require_jruby |
| 397 | + |
| 398 | + it 'TLS handshake failed' do |
| 399 | + expect do |
| 400 | + client_encryption_invalid_hostname.create_data_key( |
| 401 | + kms_provider, |
| 402 | + { |
| 403 | + master_key: master_key |
| 404 | + } |
| 405 | + ) |
| 406 | + end.to raise_error(Mongo::Error::KmsError, /TLS handshake failed due to a hostname mismatch/) |
| 407 | + end |
322 | 408 | end
|
| 409 | + |
323 | 410 | end
|
324 | 411 | end
|
325 | 412 |
|
|
0 commit comments