Skip to content

Commit

Permalink
Test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
katcharov committed Apr 23, 2024
1 parent df3ef8d commit 581ae2e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static CredentialInfo fetchGcpCredentialInfo(final String resource) {
String endpoint = "http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience="
+ resource;
Map<String, String> header = new HashMap<>();
header.put("Metadata-Flavor", "Google");;
header.put("Metadata-Flavor", "Google");
String response = getHttpContents("GET", endpoint, header);
return new CredentialInfo(
new BsonString(response).getValue(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ public final class OidcAuthenticator extends SaslAuthenticator {
AZURE_ENVIRONMENT, GCP_ENVIRONMENT, TEST_ENVIRONMENT);
private static final List<String> SUPPORTS_TOKEN_RESOURCE = Arrays.asList(
AZURE_ENVIRONMENT, GCP_ENVIRONMENT);
private static final List<String> ALLOWS_USERNAME = Arrays.asList(
AZURE_ENVIRONMENT);

private static final Duration CALLBACK_TIMEOUT = Duration.ofMinutes(5);

Expand Down Expand Up @@ -622,7 +624,7 @@ public static void validateBeforeUse(final MongoCredential credential) {
+ " must not be specified");
}
} else {
if (userName != null) {
if (userName != null && !ALLOWS_USERNAME.contains(providerName)) {
throw new IllegalArgumentException("user name must not be specified when " + ENVIRONMENT_KEY + " is specified");
}
if (machineCallback != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ class ConnectionStringSpecification extends Specification {
new ConnectionString('mongodb://jeff@localhost/?' +
'authMechanism=GSSAPI' +
'&authMechanismProperties=' +
'SERVICE_NAME:foo:bar')
'SERVICE_NAMEbar') // missing =

then:
thrown(IllegalArgumentException)
Expand Down

0 comments on commit 581ae2e

Please sign in to comment.