Skip to content

Commit e1233e1

Browse files
committed
fix AWSOptions for test
1 parent 1ee44d1 commit e1233e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/LocalStack.Client.Extensions.Tests/AwsClientFactoryWrapperTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ public void CreateServiceClient_Should_Create_Client_When_UseLocalStack_False()
3939
configurationBuilder.AddInMemoryCollection(new KeyValuePair<string, string?>[] { new("LocalStack:UseLocalStack", "false") });
4040
IConfigurationRoot configurationRoot = configurationBuilder.Build();
4141

42-
Environment.SetEnvironmentVariable("AWS_ACCESS_KEY_ID", "AKIAIOSFODNN7EXAMPLE");
43-
Environment.SetEnvironmentVariable("AWS_SECRET_ACCESS_KEY", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");
44-
Environment.SetEnvironmentVariable("AWS_DEFAULT_REGION", "us-west-2");
42+
// Explicit AWS SDK configuration
43+
var awsOptions = new AWSOptions
44+
{
45+
Credentials = new BasicAWSCredentials("AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), Region = RegionEndpoint.USWest2
46+
};
4547

4648
ServiceCollection serviceCollection = new();
4749
serviceCollection.AddLocalStack(configurationRoot);
50+
serviceCollection.AddDefaultAWSOptions(awsOptions);
4851
serviceCollection.AddAWSServiceLocalStack<IAmazonS3>();
4952
ServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();
5053

0 commit comments

Comments
 (0)