当前位置: 首页>>代码示例>>Python>>正文


Python influxdb.InfluxDBClusterClient类代码示例

本文整理汇总了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)
开发者ID:a-sk,项目名称:influxdb-python,代码行数:7,代码来源:client_test.py

示例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))
开发者ID:a-sk,项目名称:influxdb-python,代码行数:7,代码来源:client_test.py

示例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))
开发者ID:a-sk,项目名称:influxdb-python,代码行数:7,代码来源:client_test.py

示例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)
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:25,代码来源:client_test.py

示例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)
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:26,代码来源:client_test.py

示例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)
开发者ID:kespindler,项目名称:influxdb-python,代码行数:30,代码来源:client_test.py

示例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))
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:8,代码来源:client_test.py

示例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))
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:8,代码来源:client_test.py

示例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))
开发者ID:a-sk,项目名称:influxdb-python,代码行数:8,代码来源:client_test.py

示例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))
开发者ID:simudream,项目名称:influxdb-python,代码行数:8,代码来源:client_test.py

示例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))
开发者ID:a-sk,项目名称:influxdb-python,代码行数:9,代码来源:client_test.py

示例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)
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:9,代码来源:client_test.py

示例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))
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:10,代码来源:client_test.py

示例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))
开发者ID:arnimarj,项目名称:influxdb-python,代码行数:10,代码来源:client_test.py

示例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)
开发者ID:krishnazure,项目名称:influxdb-python,代码行数:16,代码来源:client_test.py


注:本文中的influxdb.InfluxDBClusterClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。