diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2018-04-04 16:50:53 -0400 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2018-04-04 16:57:47 -0400 |
commit | fd930191b98ef9f5f066881b5c88c67508fde707 (patch) | |
tree | 5fcd5b47ff348b6bfddc1899c4905202b71098e6 /pytests | |
parent | 5be474b5389092a8ffd592864de59ff9c40aef75 (diff) | |
download | mongo-fd930191b98ef9f5f066881b5c88c67508fde707.tar.gz |
SERVER-34318 Set timeout for canary insert to 1 hour in powertest.py
(cherry picked from commit b7631b5698effad672d22014156dc16d6f51bf3d)
Diffstat (limited to 'pytests')
-rwxr-xr-x | pytests/powertest.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/pytests/powertest.py b/pytests/powertest.py index e724a973d0f..dbf639fa13c 100755 --- a/pytests/powertest.py +++ b/pytests/powertest.py @@ -2224,6 +2224,9 @@ Examples: orig_canary_doc = canary_doc = "" validate_canary_cmd = "" + # Set the Pymongo connection timeout to 1 hour for canary insert & validation. + one_hour_ms = 60 * 60 * 1000 + # The remote mongod host comes from the ssh_user_host, # which may be specified as user@host. ssh_user, ssh_host = get_user_host(options.ssh_user_host) @@ -2377,16 +2380,10 @@ Examples: # Optionally validate canary document locally. if validate_canary_local: - # Increase the Pymongo connection timeout to 1 hour. - one_hour_ms = 60 * 60 * 1000 - mongo = pymongo.MongoClient( - **get_mongo_client_args( - host=mongod_host, - port=secret_port, - server_selection_timeout_ms=one_hour_ms, - socket_timeout_ms=one_hour_ms)) - ret = mongo_validate_canary( - mongo, options.db_name, options.collection_name, canary_doc) + mongo = pymongo.MongoClient(**get_mongo_client_args( + host=mongod_host, port=secret_port, serverSelectionTimeoutMS=one_hour_ms, + socketTimeoutMS=one_hour_ms)) + ret = mongo_validate_canary(mongo, options.db_name, options.collection_name, canary_doc) LOGGER.info("Local canary validation: %d", ret) if ret: sys.exit(ret) @@ -2497,8 +2494,9 @@ Examples: if options.canary: canary_doc = {"x": time.time()} orig_canary_doc = copy.deepcopy(canary_doc) - mongo = pymongo.MongoClient( - **get_mongo_client_args(host=mongod_host, port=standard_port)) + mongo = pymongo.MongoClient(**get_mongo_client_args( + host=mongod_host, port=standard_port, serverSelectionTimeoutMS=one_hour_ms, + socketTimeoutMS=one_hour_ms)) crash_canary["function"] = mongo_insert_canary crash_canary["args"] = [ mongo, |