diff --git a/conftrak/ignition.py b/conftrak/ignition.py index 9e5b766..3d10950 100644 --- a/conftrak/ignition.py +++ b/conftrak/ignition.py @@ -36,11 +36,11 @@ def parse_configuration(config=None): "--database", dest="database", type=str, help="name of database to use" ) parser.add_argument( - "--mongo-uri", dest="mongo_uri", type=str, help="URI to use to connect to Mongo" + "--mongo_uri", dest="mongo_uri", type=str, help="URI to use to connect to Mongo" ) parser.add_argument("--timezone", dest="timezone", type=str, help="Local timezone") parser.add_argument( - "--service-port", + "--service_port", dest="service_port", type=int, help="port listen to for clients", diff --git a/conftrak/server/engine.py b/conftrak/server/engine.py index 0d1d561..7288b60 100644 --- a/conftrak/server/engine.py +++ b/conftrak/server/engine.py @@ -33,7 +33,8 @@ def db_connect(database, mongo_uri, testing=False): else: try: client = pymongo.MongoClient(mongo_uri) - client.list_database_names() # check if the server is really okay. + # Proactively check that connection to server is working. + client.server_info() except ( pymongo.errors.ConnectionFailure, pymongo.errors.ServerSelectionTimeoutError, diff --git a/conftrak/test/test_server.py b/conftrak/test/test_server.py index 220c819..a800c52 100644 --- a/conftrak/test/test_server.py +++ b/conftrak/test/test_server.py @@ -13,7 +13,7 @@ def test_parse_configuration(): "prog", "--database", "conftrak", - "--mongo-uri", + "--mongo_uri", "mongodb://localhost", "--timezone", "US/Eastern",