Skip to content

Commit

Permalink
feat: flush test on batch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
minsungoh committed Oct 25, 2024
1 parent 1249f41 commit 8a8380b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_WriteApiBatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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()

0 comments on commit 8a8380b

Please sign in to comment.