Skip to content

PYTHON-3672 Increase server selection timeout in more tests #1192

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

Merged
merged 1 commit into from
Apr 14, 2023
Merged
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
22 changes: 11 additions & 11 deletions test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_tlsCertificateKeyFilePassword(self):
tlsCertificateKeyFile=CLIENT_ENCRYPTED_PEM,
tlsCertificateKeyFilePassword="qwerty",
tlsCAFile=CA_PEM,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
)
else:
connected(
Expand Down Expand Up @@ -374,15 +374,15 @@ def test_tlsCRLFile_support(self):
ssl=True,
tlsCAFile=CA_PEM,
tlsCRLFile=CRL_PEM,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
)
else:
connected(
MongoClient(
"localhost",
ssl=True,
tlsCAFile=CA_PEM,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
**self.credentials # type: ignore[arg-type]
)
)
Expand All @@ -394,17 +394,17 @@ def test_tlsCRLFile_support(self):
ssl=True,
tlsCAFile=CA_PEM,
tlsCRLFile=CRL_PEM,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
**self.credentials # type: ignore[arg-type]
)
)

uri_fmt = "mongodb://localhost/?ssl=true&tlsCAFile=%s&serverSelectionTimeoutMS=100"
uri_fmt = "mongodb://localhost/?ssl=true&tlsCAFile=%s&serverSelectionTimeoutMS=1000"
connected(MongoClient(uri_fmt % (CA_PEM,), **self.credentials)) # type: ignore

uri_fmt = (
"mongodb://localhost/?ssl=true&tlsCRLFile=%s"
"&tlsCAFile=%s&serverSelectionTimeoutMS=100"
"&tlsCAFile=%s&serverSelectionTimeoutMS=1000"
)
with self.assertRaises(ConnectionFailure):
connected(
Expand All @@ -425,7 +425,7 @@ def test_validation_with_system_ca_certs(self):
with self.assertRaises(ConnectionFailure):
# Server cert is verified but hostname matching fails
connected(
MongoClient("server", ssl=True, serverSelectionTimeoutMS=100, **self.credentials) # type: ignore[arg-type]
MongoClient("server", ssl=True, serverSelectionTimeoutMS=1000, **self.credentials) # type: ignore[arg-type]
)

# Server cert is verified. Disable hostname matching.
Expand All @@ -434,20 +434,20 @@ def test_validation_with_system_ca_certs(self):
"server",
ssl=True,
tlsAllowInvalidHostnames=True,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
**self.credentials # type: ignore[arg-type]
)
)

# Server cert and hostname are verified.
connected(
MongoClient("localhost", ssl=True, serverSelectionTimeoutMS=100, **self.credentials) # type: ignore[arg-type]
MongoClient("localhost", ssl=True, serverSelectionTimeoutMS=1000, **self.credentials) # type: ignore[arg-type]
)

# Server cert and hostname are verified.
connected(
MongoClient(
"mongodb://localhost/?ssl=true&serverSelectionTimeoutMS=100", **self.credentials # type: ignore[arg-type]
"mongodb://localhost/?ssl=true&serverSelectionTimeoutMS=1000", **self.credentials # type: ignore[arg-type]
)
)

Expand Down Expand Up @@ -622,7 +622,7 @@ def test_mongodb_x509_auth(self):
ssl=True,
tlsAllowInvalidCertificates=True,
tlsCertificateKeyFile=CA_PEM,
serverSelectionTimeoutMS=100,
serverSelectionTimeoutMS=1000,
)
)
except (ConnectionFailure, ConfigurationError):
Expand Down