Skip to content

Commit

Permalink
Fix cleaning up the test directory on windows CI
Browse files Browse the repository at this point in the history
The windows CI runs 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 windows runner
  • Loading branch information
benjaminwinger committed Apr 16, 2024
1 parent ab0db8f commit 191bb4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 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 @@ -575,6 +577,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 191bb4c

Please sign in to comment.