Skip to content

Commit a10cbbf

Browse files
committed
PYTHON-2800 Add Atlas connectivity tests for MongoDB Serverless (#669)
(cherry picked from commit 948ebb2)
1 parent 4d531d1 commit a10cbbf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,13 @@ functions:
459459
export ATLAS_SHRD='${atlas_shrd}'
460460
export ATLAS_TLS11='${atlas_tls11}'
461461
export ATLAS_TLS12='${atlas_tls12}'
462+
export ATLAS_SERVERLESS='${atlas_serverless}'
462463
export ATLAS_SRV_FREE='${atlas_srv_free}'
463464
export ATLAS_SRV_REPL='${atlas_srv_repl}'
464465
export ATLAS_SRV_SHRD='${atlas_srv_shrd}'
465466
export ATLAS_SRV_TLS11='${atlas_srv_tls11}'
466467
export ATLAS_SRV_TLS12='${atlas_srv_tls12}'
468+
export ATLAS_SRV_SERVERLESS='${atlas_srv_serverless}'
467469
EOT
468470
- command: shell.exec
469471
type: test

test/atlas/test_connection.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@
3838
"ATLAS_FREE": os.environ.get("ATLAS_FREE"),
3939
"ATLAS_TLS11": os.environ.get("ATLAS_TLS11"),
4040
"ATLAS_TLS12": os.environ.get("ATLAS_TLS12"),
41+
"ATLAS_SERVERLESS": os.environ.get("ATLAS_SERVERLESS"),
4142
"ATLAS_SRV_REPL": os.environ.get("ATLAS_SRV_REPL"),
4243
"ATLAS_SRV_SHRD": os.environ.get("ATLAS_SRV_SHRD"),
4344
"ATLAS_SRV_FREE": os.environ.get("ATLAS_SRV_FREE"),
4445
"ATLAS_SRV_TLS11": os.environ.get("ATLAS_SRV_TLS11"),
4546
"ATLAS_SRV_TLS12": os.environ.get("ATLAS_SRV_TLS12"),
47+
"ATLAS_SRV_SERVERLESS": os.environ.get("ATLAS_SRV_SERVERLESS"),
4648
}
4749

4850
# Set this variable to true to run the SRV tests even when dnspython is not
@@ -77,6 +79,9 @@ def test_tls_11(self):
7779
def test_tls_12(self):
7880
connect(URIS['ATLAS_TLS12'])
7981

82+
def test_serverless(self):
83+
connect(URIS['ATLAS_SERVERLESS'])
84+
8085
def connect_srv(self, uri):
8186
connect(uri)
8287
self.assertIn('mongodb+srv://', uri)
@@ -102,6 +107,10 @@ def test_srv_tls_11(self):
102107
def test_srv_tls_12(self):
103108
self.connect_srv(URIS['ATLAS_SRV_TLS12'])
104109

110+
@unittest.skipUnless(HAS_DNS or MUST_TEST_SRV, 'SRV requires dnspython')
111+
def test_srv_serverless(self):
112+
self.connect_srv(URIS['ATLAS_SRV_SERVERLESS'])
113+
105114
def test_uniqueness(self):
106115
"""Ensure that we don't accidentally duplicate the test URIs."""
107116
uri_to_names = defaultdict(list)
@@ -114,6 +123,5 @@ def test_uniqueness(self):
114123
'duplicate values: %s' % (duplicates,))
115124

116125

117-
118126
if __name__ == '__main__':
119127
unittest.main()

0 commit comments

Comments
 (0)