From 95d8e2f9555351e80a87eac9f2d74c2dc622a165 Mon Sep 17 00:00:00 2001 From: wangyunlai Date: Tue, 18 Aug 2026 19:41:10 +0800 Subject: [PATCH] Keep embedded test data off system temp dirs --- .github/workflows/ci.yml | 2 +- .gitignore | 1 + tests/integration_tests/conftest.py | 4 +++- .../test_get_or_create_collection_multiprocess.py | 6 +++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ae7c501..7b7b6cf9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,7 +148,7 @@ jobs: - name: Run integration tests for ${{ matrix.test_mode }} env: CI: 1 - SEEKDB_PATH: ${{ runner.temp }}/seekdb.db + SEEKDB_TEST_DATA_ROOT: ${{ github.workspace }}/.seekdb-test-data OB_PORT: 10000 SERVER_PORT: 2881 run: | diff --git a/.gitignore b/.gitignore index 63135547..3c774da3 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ docs/_build/ # tests seekdb.db/ +.seekdb-test-data/ # demo .env diff --git a/tests/integration_tests/conftest.py b/tests/integration_tests/conftest.py index eecd049d..5eda1f80 100644 --- a/tests/integration_tests/conftest.py +++ b/tests/integration_tests/conftest.py @@ -23,7 +23,9 @@ # ==================== Environment Variable Configuration ==================== # Embedded mode -SEEKDB_PATH = os.environ.get("SEEKDB_PATH", os.path.join(repo_root, "seekdb.db")) +# Keep database files off system temp directories, which may be tmpfs and reject O_DIRECT. +SEEKDB_TEST_DATA_ROOT = Path(os.environ.get("SEEKDB_TEST_DATA_ROOT", str(repo_root / ".seekdb-test-data"))) +SEEKDB_PATH = os.environ.get("SEEKDB_PATH", str(SEEKDB_TEST_DATA_ROOT / "seekdb.db")) SEEKDB_DATABASE = os.environ.get("SEEKDB_DATABASE", "test") # Server mode diff --git a/tests/integration_tests/test_get_or_create_collection_multiprocess.py b/tests/integration_tests/test_get_or_create_collection_multiprocess.py index 3b84defe..248a5028 100644 --- a/tests/integration_tests/test_get_or_create_collection_multiprocess.py +++ b/tests/integration_tests/test_get_or_create_collection_multiprocess.py @@ -55,6 +55,9 @@ OB_USER = os.environ.get("OB_USER", "root") OB_PASSWORD = os.environ.get("OB_PASSWORD", "") +# Keep database files off system temp directories, which may be tmpfs and reject O_DIRECT. +SEEKDB_TEST_DATA_ROOT = Path(os.environ.get("SEEKDB_TEST_DATA_ROOT", str(repo_root / ".seekdb-test-data"))) + pytestmark = pytest.mark.parametrize( "_mode", ["embedded", "server", "oceanbase"], ids=["embedded", "server", "oceanbase"] ) @@ -484,7 +487,8 @@ def _build_client_config(mode: str) -> tuple[dict[str, Any], Path | None, Any]: if mode == "embedded": _require_embedded_pylibseekdb() - temp_db_path = Path(tempfile.mkdtemp(prefix="seekdb-mp-")) + SEEKDB_TEST_DATA_ROOT.mkdir(parents=True, exist_ok=True) + temp_db_path = Path(tempfile.mkdtemp(prefix="seekdb-mp-", dir=SEEKDB_TEST_DATA_ROOT)) client_config = {"mode": "embedded", "path": str(temp_db_path), "database": database} elif mode == "server": client_config = {