Get rid of a few weird timeout tests.
These never made much sense to me. They seem to cause issues in CI and don't seem to be correct either way.
This commit is contained in:
parent
1fe6029c5d
commit
65bece6396
@ -215,30 +215,6 @@ class TestConnection(unittest.TestCase):
|
||||
|
||||
self.assertRaises(TypeError, iterate)
|
||||
|
||||
# TODO this test is probably very dependent on the machine its running on
|
||||
# due to timing issues, but I want to get something in here.
|
||||
def test_low_network_timeout(self):
|
||||
c = None
|
||||
i = 0
|
||||
n = 10
|
||||
while c is None and i < n:
|
||||
try:
|
||||
c = Connection(self.host, self.port, network_timeout=0.0001)
|
||||
except AutoReconnect:
|
||||
i += 1
|
||||
if i == n:
|
||||
raise SkipTest()
|
||||
|
||||
coll = c.pymongo_test.test
|
||||
|
||||
for _ in range(1000):
|
||||
try:
|
||||
coll.find_one()
|
||||
except AutoReconnect:
|
||||
pass
|
||||
except AssertionError:
|
||||
self.fail()
|
||||
|
||||
def test_disconnect(self):
|
||||
c = Connection(self.host, self.port)
|
||||
coll = c.foo.bar
|
||||
|
||||
@ -296,26 +296,6 @@ class BaseTestThreads(object):
|
||||
error.join()
|
||||
okay.join()
|
||||
|
||||
def test_low_network_timeout(self):
|
||||
db = None
|
||||
i = 0
|
||||
n = 10
|
||||
while db is None and i < n:
|
||||
try:
|
||||
db = get_connection(network_timeout=0.0001).pymongo_test
|
||||
except AutoReconnect:
|
||||
i += 1
|
||||
if i == n:
|
||||
raise SkipTest()
|
||||
|
||||
threads = []
|
||||
for _ in range(4):
|
||||
t = IgnoreAutoReconnect(db.test, 100)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
|
||||
joinall(threads)
|
||||
|
||||
def test_server_disconnect(self):
|
||||
# PYTHON-345, we need to make sure that threads' request sockets are
|
||||
# closed by disconnect().
|
||||
|
||||
@ -48,52 +48,6 @@ class TestThreadsReplicaSet(TestConnectionReplicaSetBase, BaseTestThreads):
|
||||
"""
|
||||
return ReplicaSetConnection(pair, replicaSet=self.name)
|
||||
|
||||
def test_low_network_timeout(self):
|
||||
"""
|
||||
Override the similar test as TestThreads.test_low_connect_timeout(),
|
||||
but use the newer connectTimeoutMS and socketTimeoutMS arguments instead
|
||||
of the soon-to-be-deprecated network_timeout.
|
||||
"""
|
||||
db = None
|
||||
n = 10
|
||||
|
||||
# First test connection timeout
|
||||
i = 0
|
||||
while db is None and i < n:
|
||||
try:
|
||||
db = ReplicaSetConnection(
|
||||
pair,
|
||||
replicaSet=self.name,
|
||||
connectTimeoutMS=1
|
||||
).pymongo_test
|
||||
except AutoReconnect:
|
||||
i += 1
|
||||
if i == n:
|
||||
raise SkipTest()
|
||||
|
||||
# ... then test socket timeout
|
||||
i = 0
|
||||
while db is None and i < n:
|
||||
try:
|
||||
db = ReplicaSetConnection(
|
||||
pair,
|
||||
replicaSet=self.name,
|
||||
socketTimeoutMS=1
|
||||
).pymongo_test
|
||||
except AutoReconnect:
|
||||
i += 1
|
||||
if i == n:
|
||||
raise SkipTest()
|
||||
|
||||
threads = []
|
||||
for _ in range(4):
|
||||
t = IgnoreAutoReconnect(db.test, 100)
|
||||
t.start()
|
||||
threads.append(t)
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
||||
|
||||
|
||||
class TestThreadsAuthReplicaSet(TestConnectionReplicaSetBase, BaseTestThreadsAuth):
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user