def testMultiHost(self): info = self.cluster_info cs = ConnectionString(self.make_connargs()['connection_string']) cs.hosts = [info.host + ':' + '10', info.host + ':' + str(info.port)] cb = self.make_connection(connection_string=cs.encode()) d = cb.connect() d.addCallback(lambda x: self.assertTrue(cb.connected)) return d
def test_server_not_found(self): connargs = self.make_connargs() cs = ConnectionString(connargs['connection_string']) cs.hosts = [ 'example.com' ] connargs['connection_string'] = cs.encode() self.assertRaises((CouchbaseNetworkError, TimeoutError), self.factory, **connargs) cs.hosts = [ self.cluster_info.host + ':' + str(34567)] self.assertRaises(CouchbaseNetworkError, self.factory, **connargs)
def test_multi_hosts(self): passwd = self.cluster_info.bucket_password cs = ConnectionString(bucket=self.cluster_info.bucket_name, hosts=[self.cluster_info.host]) if not self.mock: cb = self.factory(str(cs), password=passwd) self.assertTrue(cb.upsert("foo", "bar").success) cs.hosts = [self.cluster_info.host + ':' + str(self.cluster_info.port)] cs.scheme = 'http' cb = self.factory(str(cs)) self.assertTrue(cb.upsert("foo", "bar").success) cs.hosts.insert(0, 'localhost:1') cb = self.factory(str(cs)) self.assertTrue(cb.upsert("foo", "bar").success)