def test_hosts_got_sorted(self): collection = HostsCollection([Host('a', 10), Host('b', 20), Host('c')]) hosts = collection.read() self.assertEqual(hosts[0].url, 'b') self.assertEqual(hosts[1].url, 'a') self.assertEqual(hosts[2].url, 'c')
def test_hosts_got_sorted(self): collection = HostsCollection([Host("a", 10), Host("b", 20), Host("c")]) hosts = collection.read() self.assertEqual(hosts[0].url, "b") self.assertEqual(hosts[1].url, "a") self.assertEqual(hosts[2].url, "c")
def test_hosts_got_sorted(self): collection = HostsCollection([ Host('a', 10), Host('b', 20), Host('c') ]) hosts = collection.read() self.assertEqual(hosts[0].url, 'b') self.assertEqual(hosts[1].url, 'a') self.assertEqual(hosts[2].url, 'c')
def build_hosts(self): # type: () -> HostsCollection return HostsCollection([ Host("{}.{}.{}".format("personalization", self._region, "algolia.com")) ])
def build_hosts(self): # type: () -> HostsCollection return HostsCollection([ Host('{}.{}.{}'.format('recommendation', self._region, 'algolia.com')) ])
def build_hosts(self): # type: () -> HostsCollection return HostsCollection([ Host('{}-dsn.algolia.net'.format(self.app_id), 10, CallType.READ), Host('{}.algolia.net'.format(self.app_id), 10, CallType.WRITE), Host('{}-1.algolianet.com'.format(self.app_id)), Host('{}-2.algolianet.com'.format(self.app_id)), Host('{}-3.algolianet.com'.format(self.app_id)) ])
def hosts(app_id): # type: (str) -> HostsCollection hosts = [ Host('{}-1.algolianet.com'.format(app_id)), Host('{}-2.algolianet.com'.format(app_id)), Host('{}-3.algolianet.com'.format(app_id)) ] shuffle(hosts) return HostsCollection([hosts[0]])
def test_dns_timeout(self): config = SearchConfig(F.get_app_id(), F.get_api_key()) config.hosts = HostsCollection([ Host('algolia.biz', 10), Host('{}-1.algolianet.com'.format(F.get_app_id())), Host('{}-2.algolianet.com'.format(F.get_app_id())), Host('{}-3.algolianet.com'.format(F.get_app_id())) ]) client = SearchClient.create_with_config(config) client.list_indices() # We test that the first Host `algolia.biz` is down. self.assertFalse(config.hosts.read()[0].up) self.assertTrue(config.hosts.read()[1].up) self.assertTrue(config.hosts.read()[2].up) self.assertTrue(config.hosts.read()[3].up)
def build_hosts(self): # type: () -> HostsCollection return HostsCollection( [Host('{}.{}.{}'.format('insights', self._region, 'algolia.io'))])
def build_hosts(self): # type: () -> HostsCollection return HostsCollection( [Host("{}.{}.{}".format("insights", self._region, "algolia.io"))])