Unverified Commit 97ff93f7 authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

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: default avatarZelda Hessler <zhessler@amazon.com>
parent 5fe6dca9
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -519,6 +519,16 @@ mod loader {
            ret
        }

        /// Ignore any environment variables on the host during config resolution
        ///
        /// This allows for testing in a reproducible environment that ensures any
        /// environment variables from the host do not influence environment variable
        /// resolution.
        pub fn empty_test_environment(mut self) -> Self {
            self.env = Some(Env::from_slice(&[]));
            self
        }

        /// Override the access token provider used to build [`SdkConfig`].
        ///
        /// # Examples
@@ -782,6 +792,7 @@ mod loader {
                    .region()
                    .await
            };
            let conf = conf.with_region(region.clone());

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