From 8a8380b7db5dfbcbd0b95542e59cf44a519233d5 Mon Sep 17 00:00:00 2001 From: minsungoh Date: Fri, 25 Oct 2024 21:09:18 +0900 Subject: [PATCH] feat: flush test on batch mode --- tests/test_WriteApiBatching.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_WriteApiBatching.py b/tests/test_WriteApiBatching.py index 8befd7e5..7bc19b56 100644 --- a/tests/test_WriteApiBatching.py +++ b/tests/test_WriteApiBatching.py @@ -17,6 +17,7 @@ from influxdb_client.client.exceptions import InfluxDBError from influxdb_client.client.write.point import Point from influxdb_client.client.write_api import WriteOptions, WriteApi, PointSettings +from tests.base_test import BaseTest class BatchingWriteTest(unittest.TestCase): @@ -736,6 +737,29 @@ def __call__(self, conf: (str, str, str), data: str, error: InfluxDBError): self.assertIsInstance(callback.error, InfluxDBError) self.assertEqual(429, callback.error.response.status) +class BatchingWriteFlushTest(BaseTest): + + def setUp(self): + return super().setUp() + + def test_flush(self): + write_client = self.client.write_api() + + bucket = self.create_test_bucket() + + write_client.write(bucket.name, self.org, "h2o_feet,location=coyote_creek level\\ water_level=1 1") + + write_client.flush() + + time.sleep(1) + + query = 'from(bucket:"' + bucket.name + '") |> range(start: 1970-01-01T00:00:00.000000001Z)' + flux_result = self.client.query_api().query(query) + + self.assertEqual(1, len(flux_result)) + + self.delete_test_bucket(bucket) + if __name__ == '__main__': unittest.main()