Skip to content
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
65 changes: 51 additions & 14 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,20 @@ functions:
- command: subprocess.exec
params:
binary: bash
env:
MONGODB_VERSION: "5.0"
TOPOLOGY: server
AUTH: "noauth"
SSL: "nossl"
add_expansions_to_env: true
args:
- ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
- command: expansions.update
params:
file: mo-expansion.yml

"run unit tests":
- command: subprocess.exec
type: test
params:
binary: bash
working_dir: "src"
include_expansions_in_env: ["DRIVERS_TOOLS"]
include_expansions_in_env: ["DRIVERS_TOOLS", "MONGODB_URI"]
args:
- ./.evergreen/run-tests.sh

Expand All @@ -64,13 +63,51 @@ post:
- func: teardown

tasks:
- name: run-tests
commands:
- func: "run unit tests"
- name: run-tests
commands:
- func: "run unit tests"

buildvariants:
- name: tests
display_name: Run Tests
run_on: rhel87-small
tasks:
- name: run-tests
- name: tests-5-noauth-nossl
display_name: Run Tests 5.0 NoAuth NoSSL
run_on: rhel87-small
expansions:
MONGODB_VERSION: "5.0"
TOPOLOGY: server
AUTH: "noauth"
SSL: "nossl"
tasks:
- name: run-tests

- name: tests-5-auth-ssl
display_name: Run Tests 5.0 Auth SSL
run_on: rhel87-small
expansions:
MONGODB_VERSION: "5.0"
TOPOLOGY: server
AUTH: "auth"
SSL: "ssl"
tasks:
- name: run-tests

- name: tests-8-noauth-nossl
display_name: Run Tests 8.0 NoAuth NoSSL
run_on: rhel87-small
expansions:
MONGODB_VERSION: "8.0"
TOPOLOGY: server
AUTH: "noauth"
SSL: "nossl"
tasks:
- name: run-tests

- name: tests-8-auth-ssl
display_name: Run Tests 8.0 Auth SSL
run_on: rhel87-small
expansions:
MONGODB_VERSION: "8.0"
TOPOLOGY: server
AUTH: "auth"
SSL: "ssl"
tasks:
- name: run-tests
36 changes: 26 additions & 10 deletions .github/workflows/mongodb_settings.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
DATABASES = {
"default": {
"ENGINE": "django_mongodb_backend",
"NAME": "djangotests",
},
"other": {
"ENGINE": "django_mongodb_backend",
"NAME": "djangotests-other",
},
}
import os

from django_mongodb_backend import parse_uri

if mongodb_uri := os.getenv("MONGODB_URI"):
db_settings = parse_uri(mongodb_uri)

# Workaround for https://github.com/mongodb-labs/mongo-orchestration/issues/268
if db_settings["USER"] and db_settings["PASSWORD"]:
db_settings["OPTIONS"].update({"tls": True, "tlsAllowInvalidCertificates": True})
DATABASES = {
"default": {**db_settings, "NAME": "djangotests"},
"other": {**db_settings, "NAME": "djangotests-other"},
}
else:
DATABASES = {
"default": {
"ENGINE": "django_mongodb_backend",
"NAME": "djangotests",
},
"other": {
"ENGINE": "django_mongodb_backend",
"NAME": "djangotests-other",
},
}

DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher",)
SECRET_KEY = "django_tests_secret_key"
Expand Down
Loading