From ca061c1c9c013883dec6b4023ef5a31ed495ec47 Mon Sep 17 00:00:00 2001 From: Sebastian Borza Date: Tue, 3 Sep 2019 22:45:10 -0500 Subject: [PATCH 1/3] chore(client_test): adding in an old test from legacy PR#315 --- influxdb/tests/client_test.py | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index b741cf7a..b05a60f4 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -706,6 +706,50 @@ def test_create_retention_policy(self): '"db" duration 1d replication 4 shard duration 0s' ) + def test_create_retention_policy_shard_duration(self): + """Test create retention policy with a custom shard duration.""" + example_response = '{"results":[{}]}' + + with requests_mock.Mocker() as m: + m.register_uri( + requests_mock.GET, + "http://localhost:8086/query", + text=example_response + ) + self.cli.create_retention_policy( + 'somename2', '1d', 4, database='db', + shard_duration='1h' + ) + + self.assertEqual( + m.last_request.qs['q'][0], + 'create retention policy "somename2" on ' + '"db" duration 1d replication 4 shard duration 1h' + ) + + def test_create_retention_policy_shard_duration_default(self): + """Test create retention policy with a default shard duration.""" + example_response = '{"results":[{}]}' + + with requests_mock.Mocker() as m: + m.register_uri( + requests_mock.GET, + "http://localhost:8086/query", + text=example_response + ) + self.cli.create_retention_policy( + 'somename3', '1d', 4, database='db', + shard_duration='1h', default=True + ) + + self.assertEqual( + m.last_request.qs['q'][0], + 'create retention policy "somename3" on ' + '"db" duration 1d replication 4 shard duration 1h ' + 'default' + ) + + def test_alter_retention_policy(self): """Test alter retention policy for TestInfluxDBClient object.""" example_response = '{"results":[{}]}' From 3e11f6163dab7649f3e7b568a0c1fa0d67ca39a0 Mon Sep 17 00:00:00 2001 From: Sebastian Borza Date: Tue, 3 Sep 2019 23:00:15 -0500 Subject: [PATCH 2/3] chore(client_test): update from GET to POST --- influxdb/tests/client_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index b05a60f4..2dcaf0d3 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -712,7 +712,7 @@ def test_create_retention_policy_shard_duration(self): with requests_mock.Mocker() as m: m.register_uri( - requests_mock.GET, + requests_mock.POST, "http://localhost:8086/query", text=example_response ) @@ -733,7 +733,7 @@ def test_create_retention_policy_shard_duration_default(self): with requests_mock.Mocker() as m: m.register_uri( - requests_mock.GET, + requests_mock.POST, "http://localhost:8086/query", text=example_response ) From 73fa0772d9d142fd66c45b6291aaf344cd35246e Mon Sep 17 00:00:00 2001 From: Sebastian Borza Date: Tue, 3 Sep 2019 23:19:06 -0500 Subject: [PATCH 3/3] chore(client_test): update to clear out flake8 issues --- influxdb/tests/client_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py index 2dcaf0d3..571b7ebc 100644 --- a/influxdb/tests/client_test.py +++ b/influxdb/tests/client_test.py @@ -749,7 +749,6 @@ def test_create_retention_policy_shard_duration_default(self): 'default' ) - def test_alter_retention_policy(self): """Test alter retention policy for TestInfluxDBClient object.""" example_response = '{"results":[{}]}' pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy