Skip to content

Commit 97ff93f

Browse files
rcohZelda Hessler
and
Zelda Hessler
authored
Add method to config that uses an empty test environment (#3555)
## Motivation and Context Improve testability ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Zelda Hessler <zhessler@amazon.com>
1 parent 5fe6dca commit 97ff93f

File tree

1 file changed

+11
-0
lines changed
  • aws/rust-runtime/aws-config/src

1 file changed

+11
-0
lines changed

aws/rust-runtime/aws-config/src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ mod loader {
519519
ret
520520
}
521521

522+
/// Ignore any environment variables on the host during config resolution
523+
///
524+
/// This allows for testing in a reproducible environment that ensures any
525+
/// environment variables from the host do not influence environment variable
526+
/// resolution.
527+
pub fn empty_test_environment(mut self) -> Self {
528+
self.env = Some(Env::from_slice(&[]));
529+
self
530+
}
531+
522532
/// Override the access token provider used to build [`SdkConfig`].
523533
///
524534
/// # Examples
@@ -782,6 +792,7 @@ mod loader {
782792
.region()
783793
.await
784794
};
795+
let conf = conf.with_region(region.clone());
785796

786797
let retry_config = if let Some(retry_config) = self.retry_config {
787798
retry_config

0 commit comments

Comments
 (0)