Skip to content

Commit 0470c43

Browse files
wip
1 parent eceaea3 commit 0470c43

File tree

2 files changed

+11
-37
lines changed

2 files changed

+11
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Features
66

77
1. [#146](https://github.com/InfluxCommunity/influxdb3-python/pull/146): Add function to get InfluxDB version.
8+
2. [#149](https://github.com/InfluxCommunity/influxdb3-python/pull/149): Run integration tests against a locally started InfluxDB 3 Core server.
89

910
## 0.14.0 [2025-06-18]
1011

tests/test_influxdb_client_3_integration.py

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import logging
22
import os
3+
import pyarrow
4+
import pytest
35
import random
46
import string
57
import time
68
import unittest
79

8-
import pyarrow
9-
import pytest
10-
from influxdb_client_3.exceptions import InfluxDB3ClientQueryError, InfluxDBError
11-
1210
from influxdb_client_3 import InfluxDBClient3, write_client_options, WriteOptions
11+
from influxdb_client_3.exceptions import InfluxDBError
1312
from tests.util import asyncio_run, lp_to_py_object
1413

1514

@@ -21,9 +20,9 @@ def random_hex(len=6):
2120
@pytest.mark.skipif(
2221
not all(
2322
[
24-
os.getenv('TESTING_INFLUXDB_URL'),
25-
os.getenv('TESTING_INFLUXDB_TOKEN'),
26-
os.getenv('TESTING_INFLUXDB_DATABASE'),
23+
os.getenv('INFLUX_DB3_LOCAL_HOST'),
24+
os.getenv('INFLUX_DB3_LOCAL_TOKEN'),
25+
os.getenv('INFLUX_DB3_LOCAL_DATABASE'),
2726
]
2827
),
2928
reason="Integration test environment variables not set.",
@@ -35,9 +34,9 @@ def inject_fixtures(self, caplog):
3534
self._caplog = caplog
3635

3736
def setUp(self):
38-
self.host = os.getenv('TESTING_INFLUXDB_URL')
39-
self.token = os.getenv('TESTING_INFLUXDB_TOKEN')
40-
self.database = os.getenv('TESTING_INFLUXDB_DATABASE')
37+
self.host = os.getenv('INFLUX_DB3_LOCAL_HOST')
38+
self.token = os.getenv('INFLUX_DB3_LOCAL_TOKEN')
39+
self.database = os.getenv('INFLUX_DB3_LOCAL_DATABASE')
4140
self.client = InfluxDBClient3(host=self.host, database=self.database, token=self.token)
4241

4342
def tearDown(self):
@@ -85,15 +84,7 @@ def test_error_headers(self):
8584
headers = err.exception.getheaders()
8685
print("SONN")
8786
print(headers)
88-
try:
89-
self.assertIsNotNone(headers)
90-
self.assertRegex(headers['trace-id'], '[0-9a-f]{16}')
91-
self.assertEqual('false', headers['trace-sampled'])
92-
self.assertIsNotNone(headers['Strict-Transport-Security'])
93-
self.assertRegex(headers['X-Influxdb-Request-ID'], '[0-9a-f]+')
94-
self.assertIsNotNone(headers['X-Influxdb-Build'])
95-
except KeyError as ke:
96-
self.fail(f'Header {ke} not found')
87+
self.assertIsNotNone(headers)
9788

9889
def test_batch_write_callbacks(self):
9990
write_success = False
@@ -218,24 +209,6 @@ def create_test_cert(self, cert_file):
218209
def remove_test_cert(self, cert_file):
219210
os.remove(cert_file)
220211

221-
def test_queries_w_bad_cert(self):
222-
cert_file = "test_cert.pem"
223-
self.create_test_cert(cert_file)
224-
with InfluxDBClient3(host=self.host,
225-
database=self.database,
226-
token=self.token,
227-
verify_ssl=True,
228-
ssl_ca_cert=cert_file,
229-
debug=True) as client:
230-
try:
231-
query = "SELECT table_name FROM information_schema.tables"
232-
client.query(query, mode="")
233-
assert False, "query should throw SSL_ERROR"
234-
except InfluxDB3ClientQueryError as fe:
235-
assert str(fe).__contains__('SSL_ERROR_SSL')
236-
finally:
237-
self.remove_test_cert(cert_file)
238-
239212
def test_verify_ssl_false(self):
240213
cert_file = "test_cert.pem"
241214
self.create_test_cert(cert_file)

0 commit comments

Comments
 (0)