This is an automated email from the ASF dual-hosted git repository.
jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 9ac68d10ea3 Fix async deletion race in Python integration tests
(#19385)
9ac68d10ea3 is described below
commit 9ac68d10ea31acc1c2a0642e76d40358ecd7efe1
Author: Caideyipi <[email protected]>
AuthorDate: Wed Nov 25 11:30:09 2026 +0800
Fix async deletion race in Python integration tests (#19385)
---
.../tests/integration/test_aligned_timeseries.py | 16 +++++-----
.../client-py/tests/integration/test_session.py | 16 +++++-----
iotdb-client/client-py/tests/integration/utils.py | 34 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 14 deletions(-)
diff --git
a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py
b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py
index 2c36f948427..cf7702d8fcb 100644
--- a/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py
+++ b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py
@@ -21,6 +21,7 @@ from iotdb.Session import Session
from iotdb.utils.IoTDBConstants import TSDataType, TSEncoding, Compressor
from iotdb.utils.Tablet import Tablet
from .iotdb_container import IoTDBContainer
+from .utils import wait_for_time_series_deletion
# whether the test has passed
final_flag = True
@@ -114,18 +115,19 @@ def test_aligned_timeseries():
)
# delete time series
+ paths_to_delete = [
+ "root.sg_test_01.d_02.s_07",
+ "root.sg_test_01.d_02.s_08",
+ "root.sg_test_01.d_02.s_09",
+ ]
try:
- session.delete_time_series(
- [
- "root.sg_test_01.d_02.s_07",
- "root.sg_test_01.d_02.s_08",
- "root.sg_test_01.d_02.s_09",
- ]
- )
+ session.delete_time_series(paths_to_delete)
except Exception:
test_fail()
print_message("delete time series failed")
+ wait_for_time_series_deletion(session, paths_to_delete)
+
# checking time series
# s_07 expecting False
if session.check_time_series_exists("root.sg_test_01.d_02.s_07"):
diff --git a/iotdb-client/client-py/tests/integration/test_session.py
b/iotdb-client/client-py/tests/integration/test_session.py
index 75cdf056113..d2f4fd14e30 100644
--- a/iotdb-client/client-py/tests/integration/test_session.py
+++ b/iotdb-client/client-py/tests/integration/test_session.py
@@ -26,6 +26,7 @@ from iotdb.utils.IoTDBConstants import TSDataType,
TSEncoding, Compressor
from iotdb.utils.NumpyTablet import NumpyTablet
from iotdb.utils.Tablet import Tablet
from .iotdb_container import IoTDBContainer
+from .utils import wait_for_time_series_deletion
# whether the test has passed
final_flag = True
@@ -181,18 +182,19 @@ def session_test(use_session_pool=False):
)
# delete time series
+ paths_to_delete = [
+ "root.sg_test_01.d_01.s_07",
+ "root.sg_test_01.d_01.s_08",
+ "root.sg_test_01.d_01.s_09",
+ ]
try:
- session.delete_time_series(
- [
- "root.sg_test_01.d_01.s_07",
- "root.sg_test_01.d_01.s_08",
- "root.sg_test_01.d_01.s_09",
- ]
- )
+ session.delete_time_series(paths_to_delete)
except Exception:
test_fail()
print_message("delete time series failed")
+ wait_for_time_series_deletion(session, paths_to_delete)
+
# checking time series
# s_07 expecting False
if session.check_time_series_exists("root.sg_test_01.d_01.s_07"):
diff --git a/iotdb-client/client-py/tests/integration/utils.py
b/iotdb-client/client-py/tests/integration/utils.py
new file mode 100644
index 00000000000..306fc9572d1
--- /dev/null
+++ b/iotdb-client/client-py/tests/integration/utils.py
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import time
+
+
+def wait_for_time_series_deletion(session, paths, timeout=60):
+ deadline = time.monotonic() + timeout
+ while True:
+ remaining_paths = [
+ path for path in paths if session.check_time_series_exists(path)
+ ]
+ if not remaining_paths:
+ return
+ if time.monotonic() >= deadline:
+ raise AssertionError(
+ "Time series were not deleted within "
+ f"{timeout} seconds: {remaining_paths}"
+ )
+ time.sleep(0.1)