Skip to content

Commit

Permalink
Move VFS read log modes tests (#4403)
Browse files Browse the repository at this point in the history
  • Loading branch information
davisp authored Oct 9, 2023
1 parent 561c8b6 commit a71acfc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ set(TILEDB_UNIT_TEST_SOURCES
src/unit-SubarrayPartitioner-dense.cc
src/unit-SubarrayPartitioner-error.cc
src/unit-SubarrayPartitioner-sparse.cc
src/unit-vfs-read-log-modes.cc
src/unit-vfs.cc
src/unit-win-filesystem.cc
)
Expand Down
5 changes: 5 additions & 0 deletions tiledb/sm/filesystem/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ commence(unit_test vfs)
this_target_object_libraries(vfs)
this_target_sources(main.cc unit_uri.cc)
conclude(unit_test)

commence(unit_test vfs_read_log_modes)
this_target_object_libraries(context_resources)
this_target_sources(main.cc unit_vfs_read_log_modes.cc)
conclude(unit_test)
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
*/

#include <test/support/tdb_catch.h>
#include "tiledb/common/logger.h"
#include "tiledb/common/logger_public.h"
#include "tiledb/sm/filesystem/vfs.h"
#include "tiledb/sm/storage_manager/context.h"
#include "tiledb/sm/storage_manager/context_resources.h"

using namespace tiledb::sm;

TEST_CASE("VFS Read Log Modes", "[vfs][read-logging-modes]") {
global_logger().set_level(Logger::Level::INFO);
std::string mode = GENERATE(
"",
"Don't set config",
Expand All @@ -56,8 +58,8 @@ TEST_CASE("VFS Read Log Modes", "[vfs][read-logging-modes]") {
throw_if_not_ok(cfg.set("vfs.read_logging_mode", mode));
}

Context ctx(cfg);
VFS vfs(&ctx.resources().stats(), ctx.compute_tp(), ctx.io_tp(), cfg);
auto logger = make_shared<Logger>(HERE(), "");
ContextResources res(cfg, logger, 1, 1, "test");

std::vector<std::string> uris_to_read = {
"foo",
Expand All @@ -71,7 +73,7 @@ TEST_CASE("VFS Read Log Modes", "[vfs][read-logging-modes]") {
for (int i = 0; i < 2; i++) {
char buffer[123];
for (auto& uri : uris_to_read) {
auto st = vfs.read(URI(uri), 123, buffer, 456);
auto st = res.vfs().read(URI(uri), 123, buffer, 456);
// None of these files exist, so we expect every read to fail.
REQUIRE(!st.ok());
}
Expand Down

0 comments on commit a71acfc

Please sign in to comment.