Skip to content

Commit 226b96d

Browse files
committed
test(compaction): pass the log directory through the fixture constructor
- making location a plain non-static member left manifest_path and compaction_catalog_path initialized from the default directory even when a derived fixture overrode location in its constructor body (Copilot review) - add a compaction_test constructor that takes the location so the dependent paths are derived from the actual value; offline_compaction_test now passes /tmp/offline_compaction_test through it
1 parent 8952373 commit 226b96d

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

test/limestone/compaction/compaction_test_fixture.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ extern const std::string_view data_nondurable;
4848

4949
class compaction_test : public ::testing::Test {
5050
public:
51-
// Non-static so that derived fixtures can use a distinct directory; sharing one
52-
// directory across separate test suites causes a race when ctest runs them in
53-
// parallel. Derived fixtures may override this in their constructor.
51+
compaction_test() = default;
52+
// Derived fixtures pass a distinct directory through this constructor so that the
53+
// dependent paths below are derived from the actual location. Sharing one directory
54+
// across separate test suites causes a race when ctest runs them in parallel.
55+
explicit compaction_test(const char* location) : location(location) {}
56+
5457
const char* location = "/tmp/compaction_test";
5558
const boost::filesystem::path manifest_path = boost::filesystem::path(location) / std::string(limestone::internal::manifest::file_name);
5659
const boost::filesystem::path compaction_catalog_path = boost::filesystem::path(location) / "compaction_catalog";

test/limestone/compaction/offline_compaction_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class offline_compaction_test : public compaction_test {
4242
public:
4343
// Use a dedicated directory so this suite does not collide with compaction_test,
4444
// which shares the same fixture base; ctest runs the two suites in parallel.
45-
offline_compaction_test() { location = "/tmp/offline_compaction_test"; }
45+
offline_compaction_test() : compaction_test("/tmp/offline_compaction_test") {}
4646

4747
// Path to the offline compaction utility (tglogutil), relative to the test
4848
// executable's working directory. This matches the convention used by

0 commit comments

Comments
 (0)