Skip to content

Commit 9fed575

Browse files
Remove extraneous StorageManager objects from tests (#5140)
This PR removes some `StorageManager` objects from tests. In some cases these objects were not used at all anymore. In others they were replaced with `ContextResources` objects, which is all the tests needed. [sc-50127] --- TYPE: NO_HISTORY DESC: Remove extraneous `StorageManager` objects from tests
1 parent dd18016 commit 9fed575

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

test/src/unit-cppapi-consolidation-with-timestamps.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct ConsolidationWithTimestampsFx {
5151
// TileDB context.
5252
Context ctx_;
5353
VFS vfs_;
54-
sm::StorageManager* sm_;
54+
sm::ContextResources* resources_;
5555

5656
// Constructors/destructors.
5757
ConsolidationWithTimestampsFx();
@@ -99,7 +99,7 @@ ConsolidationWithTimestampsFx::ConsolidationWithTimestampsFx()
9999
Config config;
100100
config.set("sm.consolidation.buffer_size", "1000");
101101
ctx_ = Context(config);
102-
sm_ = ctx_.ptr().get()->storage_manager();
102+
resources_ = &ctx_.ptr().get()->resources();
103103
vfs_ = VFS(ctx_);
104104
}
105105

@@ -113,7 +113,7 @@ void ConsolidationWithTimestampsFx::set_legacy() {
113113
config.set("sm.query.sparse_unordered_with_dups.reader", "legacy");
114114

115115
ctx_ = Context(config);
116-
sm_ = ctx_.ptr().get()->storage_manager();
116+
resources_ = &ctx_.ptr().get()->resources();
117117
vfs_ = VFS(ctx_);
118118
}
119119

@@ -419,7 +419,7 @@ TEST_CASE_METHOD(
419419
};
420420

421421
for (auto& ts : test_timestamps) {
422-
sm::ArrayDirectory array_dir(sm_->resources(), array_uri, ts[0], ts[1]);
422+
sm::ArrayDirectory array_dir(*resources_, array_uri, ts[0], ts[1]);
423423

424424
// Check that only the consolidated fragment is visible.
425425
auto filtered_fragment_uris = array_dir.filtered_fragment_uris(false);
@@ -437,7 +437,7 @@ TEST_CASE_METHOD(
437437
};
438438

439439
for (auto& ts : test_timestamps) {
440-
sm::ArrayDirectory array_dir(sm_->resources(), array_uri, ts[0], ts[1]);
440+
sm::ArrayDirectory array_dir(*resources_, array_uri, ts[0], ts[1]);
441441

442442
// Check that no fragment is visible
443443
auto filtered_fragment_uris = array_dir.filtered_fragment_uris(false);
@@ -525,7 +525,7 @@ TEST_CASE_METHOD(
525525
};
526526

527527
for (auto& ts : test_timestamps) {
528-
sm::ArrayDirectory array_dir(sm_->resources(), array_uri, ts[0], ts[1]);
528+
sm::ArrayDirectory array_dir(*resources_, array_uri, ts[0], ts[1]);
529529

530530
// Check that only the first fragment is visible on an old array.
531531
auto filtered_fragment_uris = array_dir.filtered_fragment_uris(false);
@@ -543,7 +543,7 @@ TEST_CASE_METHOD(
543543
};
544544

545545
for (auto& ts : test_timestamps) {
546-
sm::ArrayDirectory array_dir(sm_->resources(), array_uri, ts[0], ts[1]);
546+
sm::ArrayDirectory array_dir(*resources_, array_uri, ts[0], ts[1]);
547547

548548
// Check that no fragment is visible
549549
auto filtered_fragment_uris = array_dir.filtered_fragment_uris(false);
@@ -1274,7 +1274,7 @@ TEST_CASE_METHOD(
12741274
cfg["sm.mem.consolidation.reader_weight"] = "5000";
12751275
cfg["sm.mem.consolidation.writer_weight"] = "5000";
12761276
ctx_ = Context(cfg);
1277-
sm_ = ctx_.ptr().get()->storage_manager();
1277+
resources_ = &ctx_.ptr().get()->resources();
12781278
vfs_ = VFS(ctx_);
12791279

12801280
// Write first fragment.

test/src/unit-cppapi-deletes.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct DeletesFx {
5959
VFSTestSetup vfs_test_setup_;
6060
Context ctx_;
6161
VFS vfs_;
62-
sm::StorageManager* sm_;
6362

6463
const std::string array_name_;
6564
// to be used for direct VFS operations in [rest] testcases where array_name_
@@ -126,7 +125,6 @@ DeletesFx::DeletesFx()
126125
vfs_test_setup_.update_config(config.ptr().get());
127126
ctx_ = vfs_test_setup_.ctx();
128127
vfs_ = VFS(ctx_);
129-
sm_ = ctx_.ptr().get()->storage_manager();
130128
}
131129

132130
void DeletesFx::set_purge_deleted_cells() {
@@ -136,7 +134,6 @@ void DeletesFx::set_purge_deleted_cells() {
136134
vfs_test_setup_.update_config(config.ptr().get());
137135
ctx_ = vfs_test_setup_.ctx();
138136
vfs_ = VFS(ctx_);
139-
sm_ = ctx_.ptr().get()->storage_manager();
140137
}
141138

142139
void DeletesFx::set_legacy() {
@@ -147,7 +144,6 @@ void DeletesFx::set_legacy() {
147144
vfs_test_setup_.update_config(config.ptr().get());
148145
ctx_ = vfs_test_setup_.ctx();
149146
vfs_ = VFS(ctx_);
150-
sm_ = ctx_.ptr().get()->storage_manager();
151147
}
152148

153149
void DeletesFx::create_dir(const std::string& path) {
@@ -184,7 +180,6 @@ void DeletesFx::create_sparse_array(bool allows_dups, bool encrypt) {
184180
vfs_test_setup_.update_config(config.ptr().get());
185181
ctx_ = vfs_test_setup_.ctx();
186182
vfs_ = VFS(ctx_);
187-
sm_ = ctx_.ptr().get()->storage_manager();
188183

189184
// Create dimensions.
190185
auto d1 = Dimension::create<uint64_t>(ctx_, "d1", {{1, 4}}, 2);

test/src/unit-cppapi-update-queries.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ struct UpdatesFx {
5151
// TileDB context.
5252
Context ctx_;
5353
VFS vfs_;
54-
sm::StorageManager* sm_;
5554

5655
std::string key_ = "0123456789abcdeF0123456789abcdeF";
5756
const tiledb_encryption_type_t enc_type_ = TILEDB_AES_256_GCM;
@@ -84,7 +83,6 @@ UpdatesFx::UpdatesFx()
8483
config.set("sm.consolidation.buffer_size", "1000");
8584
config["sm.allow_updates_experimental"] = "true";
8685
ctx_ = Context(config);
87-
sm_ = ctx_.ptr().get()->storage_manager();
8886
vfs_ = VFS(ctx_);
8987
}
9088

0 commit comments

Comments
 (0)