diff --git a/src/include/storage/wal/wal.h b/src/include/storage/wal/wal.h index fac314a918..4c6c592182 100644 --- a/src/include/storage/wal/wal.h +++ b/src/include/storage/wal/wal.h @@ -175,7 +175,7 @@ class WAL : public BaseWALAndWALIterator { class WALIterator : public BaseWALAndWALIterator { public: - explicit WALIterator(shared_ptr fileHandle, mutex& mtx); + explicit WALIterator(const shared_ptr& fileHandle, mutex& mtx); inline bool hasNextRecord() { lock_t lck{mtx}; diff --git a/src/storage/wal/wal.cpp b/src/storage/wal/wal.cpp index 9d92013e94..412d4e35bc 100644 --- a/src/storage/wal/wal.cpp +++ b/src/storage/wal/wal.cpp @@ -155,7 +155,7 @@ void WAL::setIsLastRecordCommit() { } } -WALIterator::WALIterator(shared_ptr fileHandle, mutex& mtx) +WALIterator::WALIterator(const shared_ptr& fileHandle, mutex& mtx) : BaseWALAndWALIterator(fileHandle), mtx{mtx} { resetCurrentHeaderPagePrefix(); if (fileHandle->getNumPages() > 0) { diff --git a/test/include/main_test_helper/main_test_helper.h b/test/include/main_test_helper/main_test_helper.h index adfcc93324..2f6556c8e0 100644 --- a/test/include/main_test_helper/main_test_helper.h +++ b/test/include/main_test_helper/main_test_helper.h @@ -5,11 +5,11 @@ namespace kuzu { namespace testing { -class ApiTest : public EmptyDBTest { +class ApiTest : public BaseGraphTest { public: void SetUp() override { - EmptyDBTest::SetUp(); + BaseGraphTest::SetUp(); systemConfig->defaultPageBufferPoolSize = (1ull << 26); systemConfig->largePageBufferPoolSize = (1ull << 26); createDBAndConn(); diff --git a/test/include/test_helper/test_helper.h b/test/include/test_helper/test_helper.h index 649648e412..480eb59f4e 100644 --- a/test/include/test_helper/test_helper.h +++ b/test/include/test_helper/test_helper.h @@ -74,6 +74,9 @@ class BaseGraphTest : public Test { void TearDown() override { FileUtils::removeDir(TestHelper::getTmpTestDir()); } inline void createDBAndConn() { + if (database != nullptr) { + database.reset(); + } database = make_unique(*databaseConfig, *systemConfig); conn = make_unique(database.get()); spdlog::set_level(spdlog::level::info); diff --git a/test/main/config_test.cpp b/test/main/config_test.cpp index b7a46a2abf..6e9073e64e 100644 --- a/test/main/config_test.cpp +++ b/test/main/config_test.cpp @@ -3,19 +3,16 @@ using namespace kuzu::testing; TEST_F(ApiTest, DatabaseConfig) { - auto db = make_unique(DatabaseConfig(TestHelper::getTmpTestDir())); spdlog::set_level(spdlog::level::debug); - ASSERT_NO_THROW(db->resizeBufferManager(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2)); - ASSERT_EQ(getDefaultBMSize(*db), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 * - StorageConfig::DEFAULT_PAGES_BUFFER_RATIO)); - ASSERT_EQ(getLargeBMSize(*db), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 * - StorageConfig::LARGE_PAGES_BUFFER_RATIO)); + ASSERT_NO_THROW(database->resizeBufferManager(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2)); + ASSERT_EQ(getDefaultBMSize(*database), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 * + StorageConfig::DEFAULT_PAGES_BUFFER_RATIO)); + ASSERT_EQ(getLargeBMSize(*database), (uint64_t)(StorageConfig::DEFAULT_BUFFER_POOL_SIZE * 2 * + StorageConfig::LARGE_PAGES_BUFFER_RATIO)); } TEST_F(ApiTest, ClientConfig) { - auto db = make_unique(DatabaseConfig(TestHelper::getTmpTestDir())); spdlog::set_level(spdlog::level::debug); - auto conn = make_unique(db.get()); ASSERT_NO_THROW(conn->setMaxNumThreadForExec(2)); ASSERT_EQ(conn->getMaxNumThreadForExec(), 2); }