Skip to content

Commit a60019f

Browse files
Fix tests.
1 parent f99c2a3 commit a60019f

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

evergreen/evergreen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ functions:
629629
- command: shell.exec
630630
type: test
631631
params:
632-
#silent: true
632+
silent: true
633633
working_dir: mongo-csharp-driver
634634
script: |
635635
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)

evergreen/run-mongodb-aws-ecs-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fi
2828
# Now we can safely enable xtrace
2929
set -o xtrace
3030
export AWS_TESTS_ENABLED=true
31-
export AWS_ECS_TEST=true
31+
export AWS_ECS_ENABLED=true
3232

3333
# EG scripts for ECS assume that a root folder is "src" and all driver side scripts are placed in ".evergreen" folder.
3434
# So that script is copied into "src/.evergreen" before running

tests/MongoDB.Driver.Tests/Communication/Security/AwsAuthenticationTests.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ public void Aws_authentication_should_should_have_expected_result()
6363
[SkippableFact]
6464
public void Ecs_should_fill_AWS_CONTAINER_CREDENTIALS_RELATIVE_URI()
6565
{
66-
var isEcs = Environment.GetEnvironmentVariable("AWS_ECS_TEST") != null;
66+
var isEcs = Environment.GetEnvironmentVariable("AWS_ECS_ENABLED") != null;
6767
var awsContainerRelativeUri = Environment.GetEnvironmentVariable("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI");
68-
awsContainerRelativeUri.Should().Match(v => isEcs ? v != null : v == null);
68+
(awsContainerRelativeUri != null).Should().Be(isEcs);
6969
}
7070

7171
[SkippableFact]
72-
public void AwsSdk_should_support_all_required_callbacks()
72+
public void AwsSdk_should_support_all_required_handlers()
7373
{
7474
var credentialsGeneratorsDelegatesEnumerator = FallbackCredentialsFactory.CredentialsGenerators.GetEnumerator();
7575

76-
// Attempt 1
76+
// AppConfigAWSCredentials
7777
AWSCredentials credentials = null;
7878
if (Type.GetType("Amazon.Runtime.AppConfigAWSCredentials", throwOnError: false) != null)
7979
{
@@ -82,6 +82,7 @@ public void AwsSdk_should_support_all_required_callbacks()
8282
appConfigAWSCredentialsException.Message.Should().Contain("The app.config/web.config files for the application did not contain credential information");
8383
}
8484

85+
// AssumeRoleWithWebIdentityCredentials.FromEnvironmentVariables()
8586
var exception = Record.Exception(() => RunTestCase());
8687
if (Environment.GetEnvironmentVariable("AWS_WEB_IDENTITY_TOKEN_FILE") != null)
8788
{
@@ -95,7 +96,7 @@ public void AwsSdk_should_support_all_required_callbacks()
9596
exception.Message.Should().Contain("webIdentityTokenFile");
9697
}
9798

98-
// Attempt 2
99+
// GetAWSCredentials (Profile)
99100
exception = Record.Exception(() => RunTestCase());
100101
if (IsWithAwsProfileOnMachine())
101102
{
@@ -106,26 +107,24 @@ public void AwsSdk_should_support_all_required_callbacks()
106107
else
107108
{
108109
// otherwise fail
109-
exception.Message.Should().Contain("Credential profile ").And.Subject.Should().Contain("is not valid");
110+
exception.Message.Should().Contain("Credential").And.Subject.Should().Contain("profile");
110111
}
111112

112-
// Attempt 3
113-
credentialsGeneratorsDelegatesEnumerator.MoveNext().Should().BeTrue();
113+
// EnvironmentVariablesAWSCredentials
114114
exception = Record.Exception(() => RunTestCase());
115115
if (Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID") != null && Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY") != null)
116116
{
117117
// environment variables code path
118118
exception.Should().BeNull();
119-
credentials.Should().BeOfType<ImmutableCredentials>();
119+
credentials.Should().BeOfType<EnvironmentVariablesAWSCredentials>();
120120
}
121121
else
122122
{
123123
// otherwise fail
124124
exception.Message.Should().Contain("The environment variables").And.Subject.Contains("were not set with AWS credentials");
125125
}
126126

127-
// Attempt 4
128-
credentialsGeneratorsDelegatesEnumerator.MoveNext().Should().BeTrue();
127+
// ECSEC2CredentialsWrapper
129128
exception = Record.Exception(() => RunTestCase());
130129
if (Environment.GetEnvironmentVariable("AWS_CONTAINER_CREDENTIALS_RELATIVE_URI") != null || Environment.GetEnvironmentVariable("AWS_CONTAINER_CREDENTIALS_FULL_URI") != null)
131130
{

0 commit comments

Comments
 (0)