Skip to content

Commit

Permalink
Fix cleaning up the test directory on windows/macos CI
Browse files Browse the repository at this point in the history
The windows and macos CI run multiple tests in different build directories as the same user.
Since #3290 this means that the tests use the same temporary directory, and the cleanup_test may remove tests from other runs.
This adds an environment variable KUZU_TEST_TMP_DIR which can be used to configure the temp directory, and uses it to create job-specific test directories on the runner machines
  • Loading branch information
benjaminwinger committed Apr 17, 2024
1 parent ab0db8f commit ceb2a5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ jobs:
- name: Test
shell: cmd
env:
KUZU_TEST_TMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }}
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
make test
Expand Down Expand Up @@ -370,7 +372,7 @@ jobs:

steps:
- uses: actions/checkout@v3

# For `napi.h` header.
- name: Ensure Node.js dependencies
run: npm install --include=dev
Expand Down Expand Up @@ -417,6 +419,8 @@ jobs:
run: make all

- name: Test
env:
KUZU_TEST_TMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }}
run: |
ulimit -n 10240
make test
Expand Down Expand Up @@ -538,6 +542,8 @@ jobs:
cat postgres_scanner.test
- name: Extension test
env:
KUZU_TEST_TMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }}
run: |
cd scripts/ && python3 http-server.py &
make extension-test && make clean
Expand Down Expand Up @@ -575,6 +581,8 @@ jobs:
- name: Extension test
shell: cmd
env:
KUZU_TEST_TMP_DIR: ${{ env.TEMP }}/kuzu-${{ env.RUN_ID }}
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cd scripts/ && start /b python http-server.py && cd ..
Expand Down
7 changes: 6 additions & 1 deletion test/include/test_helper/test_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ class TestHelper {
static std::string getMillisecondsSuffix();

inline static std::filesystem::path getTempDir() {
return std::filesystem::temp_directory_path() / "kuzu";
auto tempDir = std::getenv("KUZU_TEST_TEMP_DIR");
if (tempDir != nullptr) {
return std::filesystem::path(tempDir);
} else {
return std::filesystem::temp_directory_path() / "kuzu";
}
}

inline static std::string getTempDir(const std::string& name) {
Expand Down

0 comments on commit ceb2a5e

Please sign in to comment.