426 426 | struct TestResolver {
|
427 427 | url: String,
|
428 428 | }
|
429 429 | impl ResolveEndpoint for TestResolver {
|
430 430 | fn resolve_endpoint(&self, _params: &Params) -> EndpointFuture<'_> {
|
431 431 | EndpointFuture::ready(Ok(Endpoint::builder().url(self.url.clone()).build()))
|
432 432 | }
|
433 433 | }
|
434 434 |
|
435 435 | let (http_client, request) = capture_request(None);
|
436 436 | let conf = Config::builder()
|
437 437 | .http_client(http_client)
|
438 438 | .region(Region::new("us-west-2"))
|
439 439 | .endpoint_resolver(TestResolver {
|
440 440 | url: "http://127.0.0.1".to_owned(),
|
441 441 | })
|
442 442 | .with_test_defaults()
|
443 443 | .timeout_config(
|
444 444 | TimeoutConfig::builder()
|
445 445 | .operation_attempt_timeout(Duration::from_secs(1))
|
446 446 | .build(),
|
447 447 | )
|
448 448 | .build();
|
449 449 | let client = Client::from_conf(conf);
|
450 450 |
|
451 451 | // Note that we pass a regular bucket; when the bug was present, it still went through s3 Express auth flow.
|
452 452 | let _ = client.list_objects_v2().bucket("test-bucket").send().await;
|
453 453 | // If s3 Express auth flow were exercised, no request would be received, most likely due to `TimeoutError`.
|
454 454 | let _ = request.expect_request();
|
455 455 | }
|
456 - |
|
457 - | #[tracing_test::traced_test]
|
458 - | #[tokio::test]
|
459 - | async fn no_auth_should_be_selected_when_no_credentials_is_configured() {
|
460 - | let (http_client, _) = capture_request(None);
|
461 - | let config = aws_config::from_env()
|
462 - | .http_client(http_client)
|
463 - | .region(Region::new("us-east-2"))
|
464 - | .no_credentials()
|
465 - | .load()
|
466 - | .await;
|
467 - |
|
468 - | let client = Client::new(&config);
|
469 - | let _ = dbg!(
|
470 - | client
|
471 - | .list_objects_v2()
|
472 - | .bucket("doesnotmatter")
|
473 - | .send()
|
474 - | .await
|
475 - | );
|
476 - |
|
477 - | assert!(logs_contain(
|
478 - | "resolving identity scheme_id=AuthSchemeId { scheme_id: \"no_auth\" }"
|
479 - | ));
|
480 - | }
|