Skip to content
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

Add 8.0 and Auth + SSL Testing #220

Merged
merged 24 commits into from
Jan 25, 2025
Merged

Add 8.0 and Auth + SSL Testing #220

merged 24 commits into from
Jan 25, 2025

Conversation

Jibola
Copy link
Collaborator

@Jibola Jibola commented Jan 16, 2025

Adding tests:

  • MongoDB SERVER Version 8.0
  • Auth SSL

This creates 4 test variants total:

  • 5.0 -- NoAuth NoSSL
  • 5.0 -- Auth SSL
  • 8.0 -- NoAuth NoSSL
  • 8.0 -- Auth SSL

Acceptance Criteria:
EVG tests pass

Adding tests: 
* MongoDB SERVER Version 8.0
* Auth SSL

This creates 4 test variants total:
* 5.0 -- NoAuth NoSSL
* 5.0 -- Auth SSL
* 8.0 -- NoAuth NoSSL
* 8.0 -- Auth SSL
@Jibola Jibola requested a review from blink1073 January 16, 2025 16:55
@timgraham
Copy link
Collaborator

Evergreen stopped running on PRs some time ago, possibly due to the repo rename.

@aclark4life
Copy link
Collaborator

I'll discuss with @blink1073

@blink1073
Copy link
Member

evergreen retry

@blink1073
Copy link
Member

blink1073 commented Jan 16, 2025

Re-enabled, it shows this error: project fails validation: sync with base branch & run evergreen validate -p <project>

@Jibola
Copy link
Collaborator Author

Jibola commented Jan 16, 2025

Bah, I cannot validate it locally. I get:

evergreen validate -p django-mongodb .evergreen/config.yml 
...
[evergreen] 2025/01/16 12:44:55 [p=error]: Automatic CLI update failed! Continuing with command execution. Error: permission denied
.evergreen/config.yml is valid

@blink1073
Copy link
Member

toggling to check on RTD

@blink1073 blink1073 closed this Jan 16, 2025
@blink1073 blink1073 reopened this Jan 16, 2025
@blink1073
Copy link
Member

[evergreen] 2025/01/16 13:05:49 [p=info]: Fetching update from https://evg-bucket-evergreen.s3.amazonaws.com/evergreen/clients/evergreen_d3f98b4cbbaa8d9e8d9cea5738c778a29a653e75/darwin_arm64/evergreen
Upgraded binary downloaded to /tmp/251895727 - verifying
[evergreen] 2025/01/16 13:05:53 [p=info]: Upgraded binary successfully downloaded to temporary file: /tmp/251895727
[evergreen] 2025/01/16 13:05:53 [p=info]: Unlinking existing binary at /Users/steve.silvester/bin/evergreen
[evergreen] 2025/01/16 13:05:53 [p=info]: Moving upgraded binary to /Users/steve.silvester/bin/evergreen
[evergreen] 2025/01/16 13:05:53 [p=info]: Setting binary permissions...
[evergreen] 2025/01/16 13:05:53 [p=info]: Upgrade complete!
ERROR: buildvariant 'tests-8-noauth-nossl' already exists
.evergreen/config.yml is an invalid configuration

.evergreen/config.yml Outdated Show resolved Hide resolved
@timgraham
Copy link
Collaborator

What are the SSL configurations testing? Naively, I would think Django's settings would need to be configured to connect via SSL, but at that point, we'd basically just be testing pymongo's SSL support.

@blink1073
Copy link
Member

I would have thought that we'd need to pass the AUTH/SSL information on to the connection string. It is odd to me that this would pass as-is.

@aclark4life
Copy link
Collaborator

Right. Perhaps we just need to know more about what those variants add to the environment and that use that information to update our settings to test our backend. e.g. user/pass, SSL port. Settings are copied from here AFAICT and only include ENGINE and NAME. The tests presumably pass because even though you CAN test auth + ssl in these variants you, again presumably, don't HAVE to test auth + ssl in these variants.

@blink1073
Copy link
Member

We shouldn't be able to connect without proper TLS, or do any CRUD operations without auth...

@Jibola
Copy link
Collaborator Author

Jibola commented Jan 17, 2025

@timgraham @blink1073 I expected the auth and ssl to fail for the first run as well. I dug in and figured out the failure is because of the evergreen expansions change. I need to use include_expansions_in_env which should then include auth and ssl properly.

.github/workflows/mongodb_settings.py Show resolved Hide resolved

from django_mongodb_backend import parse_uri

PARSED_URI = parse_uri(os.getenv("MONGODB_URI")) if os.getenv("MONGODB_URI") else {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's a bit more verbose, I think it would be clearer to separate the two paths.

if uri := os.getenv("MONGODB_URI"):
    # Settings for the evergreen builds.
    databases_settings = parse_uri(uri)
    # Workaround for https://github.com/mongodb-labs/mongo-orchestration/issues/268
    if databases_settings["USER"] and databases_settings["PASSWORD"]:
        databases_settings["OPTIONS"].update({"tls": True, "tlsAllowInvalidCertificates": True})
    DATABASES["default"] = DATABASES["other"] = databases_settings
    DATABASES["default"]["NAME"] = "djangotests"
    DATABASES["other"]["NAME"] = "djangotests-other"
else:
    # Settings for the Github actions build.
    DATABASES = {...existing code...}

My only question is whether it's necessary to check both username and password since it seems unlikely one would be set without the either (or at least a password without a user).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

Copy link
Member

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Jibola Jibola merged commit 6343462 into main Jan 25, 2025
13 checks passed
@timgraham timgraham deleted the mdb-8-auth-ssl-tests branch January 29, 2025 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants