Exemple #1
0
 def setUp(self):
     if db_user and db_password:
         auth_args = dict(auth_username=db_user, auth_key=db_password)
     else:
         auth_args = {}
     self.cluster = ShardedClusterSingle().start()
     self.dm = DocManager()
     self.connector = Connector(mongo_address=self.cluster.uri,
                                doc_managers=[self.dm],
                                **auth_args)
     self.connector.start()
Exemple #2
0
 def setUpClass(cls):
     if db_user and db_password:
         auth_args = dict(auth_username=db_user, auth_key=db_password)
     else:
         auth_args = {}
     cls.cluster = ShardedClusterSingle().start()
     cls.main_uri = cls.cluster.uri + '/?readPreference=primaryPreferred'
     cls.dm = DocManager()
     cls.connector = Connector(mongo_address=cls.main_uri,
                               doc_managers=[cls.dm],
                               **auth_args)
     cls.connector.start()
     assert_soon(lambda: len(cls.connector.shard_set) == 2,
                 message='connector failed to find both shards!')
Exemple #3
0
 def setUp(self):
     if not (db_user and db_password):
         raise SkipTest('Need to set a user/password to test this.')
     self.cluster = ShardedClusterSingle().start()