File tree Expand file tree Collapse file tree 2 files changed +77
-24
lines changed Expand file tree Collapse file tree 2 files changed +77
-24
lines changed Original file line number Diff line number Diff line change @@ -31,21 +31,20 @@ functions:
3131 - command : subprocess.exec
3232 params :
3333 binary : bash
34- env :
35- MONGODB_VERSION : " 5.0"
36- TOPOLOGY : server
37- AUTH : " noauth"
38- SSL : " nossl"
34+ add_expansions_to_env : true
3935 args :
4036 - ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
37+ - command : expansions.update
38+ params :
39+ file : mo-expansion.yml
4140
4241 " run unit tests " :
4342 - command : subprocess.exec
4443 type : test
4544 params :
4645 binary : bash
4746 working_dir : " src"
48- include_expansions_in_env : ["DRIVERS_TOOLS"]
47+ include_expansions_in_env : ["DRIVERS_TOOLS", "MONGODB_URI" ]
4948 args :
5049 - ./.evergreen/run-tests.sh
5150
@@ -64,13 +63,51 @@ post:
6463 - func : teardown
6564
6665tasks :
67- - name : run-tests
68- commands :
69- - func : " run unit tests"
66+ - name : run-tests
67+ commands :
68+ - func : " run unit tests"
7069
7170buildvariants :
72- - name : tests
73- display_name : Run Tests
74- run_on : rhel87-small
75- tasks :
76- - name : run-tests
71+ - name : tests-5-noauth-nossl
72+ display_name : Run Tests 5.0 NoAuth NoSSL
73+ run_on : rhel87-small
74+ expansions :
75+ MONGODB_VERSION : " 5.0"
76+ TOPOLOGY : server
77+ AUTH : " noauth"
78+ SSL : " nossl"
79+ tasks :
80+ - name : run-tests
81+
82+ - name : tests-5-auth-ssl
83+ display_name : Run Tests 5.0 Auth SSL
84+ run_on : rhel87-small
85+ expansions :
86+ MONGODB_VERSION : " 5.0"
87+ TOPOLOGY : server
88+ AUTH : " auth"
89+ SSL : " ssl"
90+ tasks :
91+ - name : run-tests
92+
93+ - name : tests-8-noauth-nossl
94+ display_name : Run Tests 8.0 NoAuth NoSSL
95+ run_on : rhel87-small
96+ expansions :
97+ MONGODB_VERSION : " 8.0"
98+ TOPOLOGY : server
99+ AUTH : " noauth"
100+ SSL : " nossl"
101+ tasks :
102+ - name : run-tests
103+
104+ - name : tests-8-auth-ssl
105+ display_name : Run Tests 8.0 Auth SSL
106+ run_on : rhel87-small
107+ expansions :
108+ MONGODB_VERSION : " 8.0"
109+ TOPOLOGY : server
110+ AUTH : " auth"
111+ SSL : " ssl"
112+ tasks :
113+ - name : run-tests
Original file line number Diff line number Diff line change 1- DATABASES = {
2- "default" : {
3- "ENGINE" : "django_mongodb_backend" ,
4- "NAME" : "djangotests" ,
5- },
6- "other" : {
7- "ENGINE" : "django_mongodb_backend" ,
8- "NAME" : "djangotests-other" ,
9- },
10- }
1+ import os
2+
3+ from django_mongodb_backend import parse_uri
4+
5+ if mongodb_uri := os .getenv ("MONGODB_URI" ):
6+ db_settings = parse_uri (mongodb_uri )
7+
8+ # Workaround for https://github.com/mongodb-labs/mongo-orchestration/issues/268
9+ if db_settings ["USER" ] and db_settings ["PASSWORD" ]:
10+ db_settings ["OPTIONS" ].update ({"tls" : True , "tlsAllowInvalidCertificates" : True })
11+ DATABASES = {
12+ "default" : {** db_settings , "NAME" : "djangotests" },
13+ "other" : {** db_settings , "NAME" : "djangotests-other" },
14+ }
15+ else :
16+ DATABASES = {
17+ "default" : {
18+ "ENGINE" : "django_mongodb_backend" ,
19+ "NAME" : "djangotests" ,
20+ },
21+ "other" : {
22+ "ENGINE" : "django_mongodb_backend" ,
23+ "NAME" : "djangotests-other" ,
24+ },
25+ }
26+
1127DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
1228PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher" ,)
1329SECRET_KEY = "django_tests_secret_key"
You can’t perform that action at this time.
0 commit comments