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:
31
31
- command : subprocess.exec
32
32
params :
33
33
binary : bash
34
- env :
35
- MONGODB_VERSION : " 5.0"
36
- TOPOLOGY : server
37
- AUTH : " noauth"
38
- SSL : " nossl"
34
+ add_expansions_to_env : true
39
35
args :
40
36
- ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
37
+ - command : expansions.update
38
+ params :
39
+ file : mo-expansion.yml
41
40
42
41
" run unit tests " :
43
42
- command : subprocess.exec
44
43
type : test
45
44
params :
46
45
binary : bash
47
46
working_dir : " src"
48
- include_expansions_in_env : ["DRIVERS_TOOLS"]
47
+ include_expansions_in_env : ["DRIVERS_TOOLS", "MONGODB_URI" ]
49
48
args :
50
49
- ./.evergreen/run-tests.sh
51
50
@@ -64,13 +63,51 @@ post:
64
63
- func : teardown
65
64
66
65
tasks :
67
- - name : run-tests
68
- commands :
69
- - func : " run unit tests"
66
+ - name : run-tests
67
+ commands :
68
+ - func : " run unit tests"
70
69
71
70
buildvariants :
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
+
11
27
DEFAULT_AUTO_FIELD = "django_mongodb_backend.fields.ObjectIdAutoField"
12
28
PASSWORD_HASHERS = ("django.contrib.auth.hashers.MD5PasswordHasher" ,)
13
29
SECRET_KEY = "django_tests_secret_key"
You can’t perform that action at this time.
0 commit comments