diff --git a/src/main/database.cpp b/src/main/database.cpp index f25dddde8b..dda8f2cc60 100644 --- a/src/main/database.cpp +++ b/src/main/database.cpp @@ -2,7 +2,6 @@ #include "main/client_context.h" #include "main/database_manager.h" -#include "main/settings.h" #include "storage/buffer_manager/buffer_manager.h" #if defined(_WIN32) diff --git a/test/c_api/database_test.cpp b/test/c_api/database_test.cpp index 89c474033b..a5eaa2a372 100644 --- a/test/c_api/database_test.cpp +++ b/test/c_api/database_test.cpp @@ -257,3 +257,33 @@ TEST_F(CApiDatabaseTest, VirtualFileSystemDeleteFilesWindowsPaths) { std::filesystem::remove_all("C:\\Desktop\\dir\\test1"); } #endif + +TEST_F(CApiDatabaseTest, VirtualFileSystemDeleteFilesWildcardNoRemoval) { + // Test Home Directory + std::string homeDir = "/tmp/dbHome_wildcard/"; + kuzu::common::VirtualFileSystem vfs(homeDir); + + // Setup files and directories + std::filesystem::create_directories("/tmp/dbHome_wildcard/test1_wildcard"); + std::filesystem::create_directories("/tmp/dbHome_wildcard/test2_wildcard"); + std::filesystem::create_directories("/tmp/dbHome_wildcard/nested_wildcard"); + std::ofstream("/tmp/dbHome_wildcard/nested_wildcard/file1.txt").close(); + std::ofstream("/tmp/dbHome_wildcard/nested_wildcard/file2.test").close(); + + // Attempt to remove files with wildcard pattern + try { + vfs.removeFileIfExists("/tmp/dbHome_wildcard/test*"); + } catch (const kuzu::common::IOException& e) { + // Verify the exception is thrown for unsupported wildcard + EXPECT_STREQ(e.what(), "Error: Wildcard patterns are not supported in paths."); + } + + // Verify files and directories still exist + ASSERT_TRUE(std::filesystem::exists("/tmp/dbHome_wildcard/test1_wildcard")); + ASSERT_TRUE(std::filesystem::exists("/tmp/dbHome_wildcard/test2_wildcard")); + ASSERT_TRUE(std::filesystem::exists("/tmp/dbHome_wildcard/nested_wildcard/file1.txt")); + ASSERT_TRUE(std::filesystem::exists("/tmp/dbHome_wildcard/nested_wildcard/file2.test")); + + // Cleanup + std::filesystem::remove_all("/tmp/dbHome_wildcard"); +}