From 63633eee67eaebce8091de6814f00a24e51e0fdb Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Tue, 4 Jan 2022 13:42:08 -0500 Subject: [PATCH 1/3] Bump influxdb-client dependency to 1.24.0 --- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_all.txt b/requirements_all.txt index b57616d1d83372..e587ef7f5cf035 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -896,7 +896,7 @@ ihcsdk==2.7.0 incomfort-client==0.4.4 # homeassistant.components.influxdb -influxdb-client==1.14.0 +influxdb-client==1.24.0 # homeassistant.components.influxdb influxdb==5.3.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 0d88f76c740d6f..68630535782dcc 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -562,7 +562,7 @@ icmplib==3.0 ifaddr==0.1.7 # homeassistant.components.influxdb -influxdb-client==1.14.0 +influxdb-client==1.24.0 # homeassistant.components.influxdb influxdb==5.3.1 From 3f1c62318f9fa973a800d42a788ba48e6e4f5871 Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Tue, 4 Jan 2022 14:18:19 -0500 Subject: [PATCH 2/3] Fix manifest and timeout --- homeassistant/components/influxdb/__init__.py | 1 + homeassistant/components/influxdb/manifest.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/influxdb/__init__.py b/homeassistant/components/influxdb/__init__.py index d07e64ae83a9ed..ecc76481e49b00 100644 --- a/homeassistant/components/influxdb/__init__.py +++ b/homeassistant/components/influxdb/__init__.py @@ -336,6 +336,7 @@ def get_influx_connection(conf, test_write=False, test_read=False): # noqa: C90 precision = conf.get(CONF_PRECISION) if conf[CONF_API_VERSION] == API_VERSION_2: + kwargs[CONF_TIMEOUT] = TIMEOUT * 1000 kwargs[CONF_URL] = conf[CONF_URL] kwargs[CONF_TOKEN] = conf[CONF_TOKEN] kwargs[INFLUX_CONF_ORG] = conf[CONF_ORG] diff --git a/homeassistant/components/influxdb/manifest.json b/homeassistant/components/influxdb/manifest.json index d66561e26daeb9..2c537c7b35a4e5 100644 --- a/homeassistant/components/influxdb/manifest.json +++ b/homeassistant/components/influxdb/manifest.json @@ -2,7 +2,7 @@ "domain": "influxdb", "name": "InfluxDB", "documentation": "https://www.home-assistant.io/integrations/influxdb", - "requirements": ["influxdb==5.3.1", "influxdb-client==1.14.0"], + "requirements": ["influxdb==5.3.1", "influxdb-client==1.24.0"], "codeowners": ["@fabaff", "@mdegat01"], "iot_class": "local_push" } From 7a83800bdef73a474aa16b8f547cd5c51e1f4204 Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Tue, 4 Jan 2022 23:27:56 -0500 Subject: [PATCH 3/3] Pass mock of http response to stop NPE --- tests/components/influxdb/test_init.py | 4 ++-- tests/components/influxdb/test_sensor.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/components/influxdb/test_init.py b/tests/components/influxdb/test_init.py index 24ef68dd5bdd2d..94071e849c2800 100644 --- a/tests/components/influxdb/test_init.py +++ b/tests/components/influxdb/test_init.py @@ -1608,7 +1608,7 @@ async def test_event_listener_attribute_name_conflict( BASE_V2_CONFIG, _get_write_api_mock_v2, influxdb.API_VERSION_2, - influxdb.ApiException(), + influxdb.ApiException(http_resp=MagicMock()), ), ], indirect=["mock_client", "get_mock_call"], @@ -1650,7 +1650,7 @@ async def test_connection_failure_on_startup( BASE_V2_CONFIG, _get_write_api_mock_v2, influxdb.API_VERSION_2, - influxdb.ApiException(status=HTTPStatus.BAD_REQUEST), + influxdb.ApiException(status=HTTPStatus.BAD_REQUEST, http_resp=MagicMock()), ), ], indirect=["mock_client", "get_mock_call"], diff --git a/tests/components/influxdb/test_sensor.py b/tests/components/influxdb/test_sensor.py index ac88c3ab967a0a..86a32877a792bc 100644 --- a/tests/components/influxdb/test_sensor.py +++ b/tests/components/influxdb/test_sensor.py @@ -417,14 +417,14 @@ async def test_state_for_no_results( BASE_V2_CONFIG, BASE_V2_QUERY, _set_query_mock_v2, - ApiException(), + ApiException(http_resp=MagicMock()), ), ( API_VERSION_2, BASE_V2_CONFIG, BASE_V2_QUERY, _set_query_mock_v2, - ApiException(status=HTTPStatus.BAD_REQUEST), + ApiException(status=HTTPStatus.BAD_REQUEST, http_resp=MagicMock()), ), ], indirect=["mock_client"], @@ -534,7 +534,7 @@ async def test_error_rendering_template( BASE_V2_CONFIG, BASE_V2_QUERY, _set_query_mock_v2, - ApiException(), + ApiException(http_resp=MagicMock()), _make_v2_resultset, ), ],