diff --git a/test/src/unit-capi-group.cc b/test/src/unit-capi-group.cc index 074c159f198..920362990ef 100644 --- a/test/src/unit-capi-group.cc +++ b/test/src/unit-capi-group.cc @@ -592,8 +592,8 @@ TEST_CASE_METHOD( rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE); REQUIRE(rc == TILEDB_OK); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { rc = tiledb_group_add_member_with_type( ctx_, group1, array1_uri.c_str(), false, nullptr, TILEDB_ARRAY); REQUIRE(rc == TILEDB_OK); @@ -736,8 +736,8 @@ TEST_CASE_METHOD( rc = tiledb_group_open(ctx_, group1, TILEDB_WRITE); REQUIRE(rc == TILEDB_OK); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { rc = tiledb_group_add_member_with_type( ctx_, group1, array1_uri.c_str(), false, "one", TILEDB_ARRAY); REQUIRE(rc == TILEDB_OK); @@ -779,7 +779,7 @@ TEST_CASE_METHOD( rc = tiledb_group_remove_member(ctx_, group1, "one"); REQUIRE(rc == TILEDB_OK); // Add one back with different URI - if (add_by_type) { + if (add_with_type) { rc = tiledb_group_add_member_with_type( ctx_, group1, array2_uri.c_str(), false, "one", TILEDB_ARRAY); REQUIRE(rc == TILEDB_OK); @@ -858,8 +858,8 @@ TEST_CASE_METHOD( rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE); REQUIRE(rc == TILEDB_OK); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { rc = tiledb_group_add_member_with_type( ctx_, group1, array1_uri.c_str(), false, "one", TILEDB_ARRAY); REQUIRE(rc == TILEDB_OK); @@ -1236,8 +1236,8 @@ TEST_CASE_METHOD( rc = tiledb_group_open(ctx_, group2, TILEDB_WRITE); REQUIRE(rc == TILEDB_OK); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { rc = tiledb_group_add_member_with_type( ctx_, group1, array1_relative_uri.c_str(), true, nullptr, TILEDB_ARRAY); REQUIRE(rc == TILEDB_OK); diff --git a/test/src/unit-cppapi-group.cc b/test/src/unit-cppapi-group.cc index 6c3bfdede40..1ac33db656f 100644 --- a/test/src/unit-cppapi-group.cc +++ b/test/src/unit-cppapi-group.cc @@ -298,13 +298,26 @@ TEST_CASE_METHOD( // Set expected std::vector group1_expected = { - tiledb::Object(tiledb::Object::Type::Array, array1_uri, "array1"), - tiledb::Object(tiledb::Object::Type::Array, array2_uri, "array2"), - tiledb::Object(tiledb::Object::Type::Group, group2_uri, "group2"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array1_uri), + "array1"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + "array2"), + tiledb::Object( + tiledb::Object::Type::Group, + vfs_test_setup_.with_prefix(group2_uri), + "group2"), }; std::vector group2_expected = { - tiledb::Object(tiledb::Object::Type::Array, array3_uri, "array3"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array3_uri), + "array3"), }; + std::cerr << group1_expected[0].uri() << std::endl; tiledb::Group group1(ctx_, group1_uri, TILEDB_WRITE); group1.close(); @@ -316,8 +329,8 @@ TEST_CASE_METHOD( set_group_timestamp(&group2, 1); group2.open(TILEDB_WRITE); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { group1.add_member(array1_uri, false, "array1", TILEDB_ARRAY); group1.add_member(array2_uri, false, "array2", TILEDB_ARRAY); group1.add_member(group2_uri, false, "group2", TILEDB_GROUP); @@ -414,12 +427,24 @@ TEST_CASE_METHOD( // Set expected std::vector group1_expected = { - tiledb::Object(tiledb::Object::Type::Array, array1_uri, std::nullopt), - tiledb::Object(tiledb::Object::Type::Array, array2_uri, std::nullopt), - tiledb::Object(tiledb::Object::Type::Group, group2_uri, std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array1_uri), + std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + std::nullopt), + tiledb::Object( + tiledb::Object::Type::Group, + vfs_test_setup_.with_prefix(group2_uri), + std::nullopt), }; std::vector group2_expected = { - tiledb::Object(tiledb::Object::Type::Array, array3_uri, std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array3_uri), + std::nullopt), }; tiledb::Group group1(ctx_, group1_uri, TILEDB_WRITE); @@ -432,8 +457,8 @@ TEST_CASE_METHOD( set_group_timestamp(&group2, 1); group2.open(TILEDB_WRITE); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { group1.add_member(array1_uri, false, std::nullopt, TILEDB_ARRAY); group1.add_member(array2_uri, false, std::nullopt, TILEDB_ARRAY); group1.add_member(group2_uri, false, std::nullopt, TILEDB_GROUP); @@ -541,12 +566,24 @@ TEST_CASE_METHOD( // Set expected std::vector group1_expected = { - tiledb::Object(tiledb::Object::Type::Array, array1_uri, std::nullopt), - tiledb::Object(tiledb::Object::Type::Array, array2_uri, std::nullopt), - tiledb::Object(tiledb::Object::Type::Group, group2_uri, std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array1_uri), + std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + std::nullopt), + tiledb::Object( + tiledb::Object::Type::Group, + vfs_test_setup_.with_prefix(group2_uri), + std::nullopt), }; std::vector group2_expected = { - tiledb::Object(tiledb::Object::Type::Array, array3_uri, std::nullopt), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array3_uri), + std::nullopt), }; tiledb::Group group1(ctx_, group1_uri, TILEDB_WRITE); @@ -559,8 +596,8 @@ TEST_CASE_METHOD( set_group_timestamp(&group2, 1); group2.open(TILEDB_WRITE); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { group1.add_member(array1_relative_uri, true, std::nullopt, TILEDB_ARRAY); group1.add_member(array2_relative_uri, true, std::nullopt, TILEDB_ARRAY); group1.add_member(group2_uri, false, std::nullopt, TILEDB_GROUP); @@ -665,12 +702,24 @@ TEST_CASE_METHOD( // Set expected std::vector group1_expected = { - tiledb::Object(tiledb::Object::Type::Array, array1_uri, "one"), - tiledb::Object(tiledb::Object::Type::Array, array2_uri, "two"), - tiledb::Object(tiledb::Object::Type::Group, group2_uri, "three"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array1_uri), + "one"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + "two"), + tiledb::Object( + tiledb::Object::Type::Group, + vfs_test_setup_.with_prefix(group2_uri), + "three"), }; std::vector group2_expected = { - tiledb::Object(tiledb::Object::Type::Array, array3_uri, "four"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array3_uri), + "four"), }; tiledb::Group group1(ctx_, group1_uri, TILEDB_WRITE); @@ -683,8 +732,8 @@ TEST_CASE_METHOD( set_group_timestamp(&group2, 1); group2.open(TILEDB_WRITE); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { group1.add_member(array1_relative_uri, true, "one", TILEDB_ARRAY); group1.add_member(array2_relative_uri, true, "two", TILEDB_ARRAY); group1.add_member(group2_uri, false, "three", TILEDB_GROUP); @@ -801,11 +850,22 @@ TEST_CASE_METHOD( // Set expected std::vector group1_expected = { - tiledb::Object(tiledb::Object::Type::Array, array1_uri, "one"), - tiledb::Object(tiledb::Object::Type::Array, array2_uri, "two"), - nameless_uri ? - tiledb::Object(tiledb::Object::Type::Array, array2_uri, nullopt) : - tiledb::Object(tiledb::Object::Type::Array, array2_uri, "three"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array1_uri), + "one"), + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + "two"), + nameless_uri ? tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + nullopt) : + tiledb::Object( + tiledb::Object::Type::Array, + vfs_test_setup_.with_prefix(array2_uri), + "three"), }; tiledb::Group group1(ctx_, group1_uri, TILEDB_WRITE); @@ -813,8 +873,8 @@ TEST_CASE_METHOD( set_group_timestamp(&group1, 1); group1.open(TILEDB_WRITE); - bool add_by_type = GENERATE(true, false); - if (add_by_type) { + bool add_with_type = GENERATE(true, false); + if (add_with_type) { group1.add_member(array1_relative_uri, true, "one", TILEDB_ARRAY); group1.add_member(array2_relative_uri, true, "two", TILEDB_ARRAY); group1.add_member( diff --git a/test/support/src/vfs_helpers.h b/test/support/src/vfs_helpers.h index 9230dade980..8d45ebe9cbb 100644 --- a/test/support/src/vfs_helpers.h +++ b/test/support/src/vfs_helpers.h @@ -166,6 +166,14 @@ class SupportedFs { * @return true if local, false if not */ virtual bool is_local() = 0; + + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + virtual std::string file_prefix() = 0; }; /** @@ -238,6 +246,16 @@ class SupportedFsS3 : public SupportedFs { return false; } + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + inline std::string file_prefix() { + return ""; + } + private: /* ********************************* */ /* ATTRIBUTES */ @@ -324,6 +342,16 @@ class SupportedFsHDFS : public SupportedFs { return false; } + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + inline std::string file_prefix() { + return ""; + } + private: /* ********************************* */ /* ATTRIBUTES */ @@ -404,6 +432,16 @@ class SupportedFsAzure : public SupportedFs { return false; } + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + inline std::string file_prefix() { + return ""; + } + private: /* ********************************* */ /* ATTRIBUTES */ @@ -489,6 +527,16 @@ class SupportedFsGCS : public SupportedFs { return false; } + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + inline std::string file_prefix() { + return ""; + } + private: /* ********************************* */ /* ATTRIBUTES */ @@ -677,6 +725,16 @@ class SupportedFsMem : public SupportedFs { return true; } + /** + * Get the name of the filesystem's file prefix. Applies only to local + * filesystems + * + * @return string prefix name + */ + inline std::string file_prefix() { + return ""; + } + private: /* ********************************* */ /* ATTRIBUTES */ @@ -934,6 +992,10 @@ struct VFSTestSetup { return uri; } + std::string with_prefix(const std::string& array_name) { + return fs_vec[0]->file_prefix() + array_name; + } + Context ctx() { return Context(ctx_c, false); }