Skip to content

PYTHON-5373 test client auth on cloud-dev #2423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .evergreen/generated_configs/variants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ buildvariants:
display_name: Atlas connect RHEL8
run_on:
- rhel87-small
expansions:
TEST_NAME: atlas_connect
tags: [pr]

# Atlas data lake tests
Expand Down
1 change: 1 addition & 0 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def create_atlas_connect_variants():
get_variant_name("Atlas connect", host),
tags=["pr"],
host=DEFAULT_HOST,
expansions=dict(TEST_NAME="atlas_connect"),
)
]

Expand Down
13 changes: 12 additions & 1 deletion .evergreen/scripts/setup_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,18 @@
run_command(f"bash {auth_aws_dir}/setup-secrets.sh")

if test_name == "atlas_connect":
get_secrets("drivers/atlas_connect")
secrets = get_secrets("drivers/atlas_connect")

# Write file with Atlas X509 client certificate:
decoded = base64.b64decode(secrets["ATLAS_X509_DEV_CERT_BASE64"]).decode("utf8")
cert_file = ROOT / ".evergreen/atlas_x509_dev_client_certificate.pem"
with cert_file.open("w") as file:
file.write(decoded)
write_env(
"ATLAS_X509_DEV_WITH_CERT",
secrets["ATLAS_X509_DEV"] + "&tlsCertificateKeyFile=" + str(cert_file),
)

# We do not want the default client_context to be initialized.
write_env("DISABLE_CONTEXT")

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ expansion.yml
.evergreen/scripts/test-env.sh
specifications/
results.json
.evergreen/atlas_x509_dev_client_certificate.pem

# Lambda temp files
test/lambda/.aws-sam
Expand Down
4 changes: 4 additions & 0 deletions test/atlas/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ATLAS_SRV_FREE": os.environ.get("ATLAS_SRV_FREE"),
"ATLAS_SRV_TLS11": os.environ.get("ATLAS_SRV_TLS11"),
"ATLAS_SRV_TLS12": os.environ.get("ATLAS_SRV_TLS12"),
"ATLAS_X509_DEV_WITH_CERT": os.environ.get("ATLAS_X509_DEV_WITH_CERT"),
}


Expand Down Expand Up @@ -91,6 +92,9 @@ def test_srv_tls_11(self):
def test_srv_tls_12(self):
self.connect_srv(URIS["ATLAS_SRV_TLS12"])

def test_x509_with_cert(self):
self.connect(URIS["ATLAS_X509_DEV_WITH_CERT"])

def test_uniqueness(self):
"""Ensure that we don't accidentally duplicate the test URIs."""
uri_to_names = defaultdict(list)
Expand Down
Loading