本文整理汇总了Python中influxdb.InfluxDBClusterClient类的典型用法代码示例。如果您正苦于以下问题:Python InfluxDBClusterClient类的具体用法?Python InfluxDBClusterClient怎么用?Python InfluxDBClusterClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InfluxDBClusterClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dsn_mixed_scheme_case
def test_dsn_mixed_scheme_case(self):
cli = InfluxDBClusterClient.from_DSN("hTTps+inFLUxdb://usr:[email protected]:8086/db")
self.assertEqual("pWd", cli._client._password)
self.assertEqual("https://host:8086", cli._client._baseurl)
cli = InfluxDBClusterClient.from_DSN("uDP+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db")
self.assertTrue(cli._client.use_udp)
示例2: test_all_good
def test_all_good(self):
cluster = InfluxDBClusterClient(
hosts=self.hosts, database="database", shuffle=True, client_base_class=FakeClient
)
self.assertEqual("Success", cluster.query(""))
self.assertEqual(3, len(cluster.hosts))
self.assertEqual(0, len(cluster.bad_hosts))
示例3: test_two_servers_fail
def test_two_servers_fail(self):
cluster = InfluxDBClusterClient(
hosts=self.hosts, database="database", shuffle=False, client_base_class=FakeClient
)
self.assertEqual("Success", cluster.query("Fail twice"))
self.assertEqual(1, len(cluster.hosts))
self.assertEqual(2, len(cluster.bad_hosts))
示例4: test_dsn
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual(2, len(cli.clients))
self.assertEqual("http://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("uSr", cli.clients[0]._username)
self.assertEqual("pWd", cli.clients[0]._password)
self.assertEqual("db", cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual("http://host2:8086", cli.clients[1]._baseurl)
self.assertEqual("uSr", cli.clients[1]._username)
self.assertEqual("pWd", cli.clients[1]._password)
self.assertEqual("db", cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN("udp+" + self.dsn_string)
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string)
self.assertEqual("https://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("https://host2:8086", cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN("https+" + self.dsn_string, **{"ssl": False})
self.assertEqual("http://host1:8086", cli.clients[0]._baseurl)
self.assertEqual("http://host2:8086", cli.clients[1]._baseurl)
示例5: test_dsn
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(self.dsn_string)
self.assertEqual(2, len(cli.clients))
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('uSr', cli.clients[0]._username)
self.assertEqual('pWd', cli.clients[0]._password)
self.assertEqual('db', cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
self.assertEqual('uSr', cli.clients[1]._username)
self.assertEqual('pWd', cli.clients[1]._password)
self.assertEqual('db', cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN('udp+' + self.dsn_string)
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string)
self.assertEqual('https://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('https://host2:8086', cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN('https+' + self.dsn_string,
**{'ssl': False})
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
示例6: test_dsn
def test_dsn(self):
cli = InfluxDBClusterClient.from_DSN(
'influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertEqual(2, len(cli.clients))
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('usr', cli.clients[0]._username)
self.assertEqual('pwd', cli.clients[0]._password)
self.assertEqual('db', cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
self.assertEqual('usr', cli.clients[1]._username)
self.assertEqual('pwd', cli.clients[1]._password)
self.assertEqual('db', cli.clients[1]._database)
self.assertFalse(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN(
'udp+influxdb://usr:[email protected]:8086,usr:[email protected]st2:8086/db')
self.assertTrue(cli.clients[0].use_udp)
self.assertTrue(cli.clients[1].use_udp)
cli = InfluxDBClusterClient.from_DSN(
'https+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertEqual('https://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('https://host2:8086', cli.clients[1]._baseurl)
cli = InfluxDBClusterClient.from_DSN(
'https+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db',
**{'ssl': False})
self.assertEqual('http://host1:8086', cli.clients[0]._baseurl)
self.assertEqual('http://host2:8086', cli.clients[1]._baseurl)
示例7: test_all_good
def test_all_good(self):
cluster = InfluxDBClusterClient(hosts=self.hosts,
database='database',
shuffle=True,
client_base_class=FakeClient)
self.assertEqual('Success', cluster.query(''))
self.assertEqual(3, len(cluster.clients))
self.assertEqual(0, len(cluster.bad_clients))
示例8: test_one_server_fails
def test_one_server_fails(self):
cluster = InfluxDBClusterClient(
hosts=self.hosts, database="database", shuffle=False, client_base_class=FakeClient
)
cluster.clients[0].fail = True
self.assertEqual("Success", cluster.query(""))
self.assertEqual(2, len(cluster.clients))
self.assertEqual(1, len(cluster.bad_clients))
示例9: test_all_fail
def test_all_fail(self):
cluster = InfluxDBClusterClient(
hosts=self.hosts, database="database", shuffle=True, client_base_class=FakeClient
)
with self.assertRaises(InfluxDBServerError):
cluster.query("Fail")
self.assertEqual(0, len(cluster.hosts))
self.assertEqual(3, len(cluster.bad_hosts))
示例10: test_one_server_fails
def test_one_server_fails(self):
cluster = InfluxDBClusterClient(hosts=self.hosts,
database='database',
shuffle=False,
client_base_class=FakeClient)
self.assertEqual('Success', cluster.query('Fail once'))
self.assertEqual(2, len(cluster.hosts))
self.assertEqual(1, len(cluster.bad_hosts))
示例11: test_recovery
def test_recovery(self):
cluster = InfluxDBClusterClient(
hosts=self.hosts, database="database", shuffle=True, client_base_class=FakeClient
)
with self.assertRaises(InfluxDBServerError):
cluster.query("Fail")
self.assertEqual("Success", cluster.query(""))
self.assertEqual(1, len(cluster.hosts))
self.assertEqual(2, len(cluster.bad_hosts))
示例12: test_dsn_mixed_scheme_case
def test_dsn_mixed_scheme_case(self):
cli = InfluxDBClusterClient.from_DSN(
'hTTps+inFLUxdb://usr:[email protected]:8086/db')
self.assertEqual('pWd', cli.clients[0]._password)
self.assertEqual('https://host:8086', cli.clients[0]._baseurl)
cli = InfluxDBClusterClient.from_DSN(
'uDP+influxdb://usr:[email protected]:8086,usr:[email protected]:8086/db')
self.assertTrue(cli.clients[0].use_udp)
示例13: test_recovery
def test_recovery(self):
cluster = InfluxDBClusterClient(hosts=self.hosts,
database='database',
shuffle=True,
client_base_class=FakeClient)
with self.assertRaises(InfluxDBServerError):
cluster.query('Fail')
self.assertEqual('Success', cluster.query(''))
self.assertEqual(1, len(cluster.clients))
self.assertEqual(2, len(cluster.bad_clients))
示例14: test_two_servers_fail
def test_two_servers_fail(self):
cluster = InfluxDBClusterClient(hosts=self.hosts,
database='database',
shuffle=False,
client_base_class=FakeClient)
cluster.clients[0].fail = True
cluster.clients[1].fail = True
self.assertEqual('Success', cluster.query(''))
self.assertEqual(1, len(cluster.clients))
self.assertEqual(2, len(cluster.bad_clients))
示例15: test_dsn_single_client
def test_dsn_single_client(self):
cli = InfluxDBClusterClient.from_DSN("influxdb://usr:[email protected]:8086/db")
self.assertEqual("http://host:8086", cli.clients[0]._baseurl)
self.assertEqual("usr", cli.clients[0]._username)
self.assertEqual("pwd", cli.clients[0]._password)
self.assertEqual("db", cli.clients[0]._database)
self.assertFalse(cli.clients[0].use_udp)
cli = InfluxDBClusterClient.from_DSN("udp+influxdb://usr:[email protected]:8086/db")
self.assertTrue(cli.clients[0].use_udp)
cli = InfluxDBClusterClient.from_DSN("https+influxdb://usr:[email protected]:8086/db")
self.assertEqual("https://host:8086", cli.clients[0]._baseurl)
cli = InfluxDBClusterClient.from_DSN("https+influxdb://usr:[email protected]:8086/db", **{"ssl": False})
self.assertEqual("http://host:8086", cli.clients[0]._baseurl)