From 326314a0bb5c306d70e29db4bf22dfc1055e06b5 Mon Sep 17 00:00:00 2001 From: Ypatia Tsavliri Date: Thu, 28 Mar 2024 15:17:33 +0000 Subject: [PATCH] Various fixes to stabilize CI --- test/src/test-capi-consolidation-plan.cc | 14 ++++------- test/src/unit-capi-array.cc | 4 ++- test/src/unit-capi-dense_array.cc | 25 ------------------- test/src/unit-capi-dense_neg.cc | 4 --- test/src/unit-capi-query-aggregate.cc | 6 ++--- ...-capi-serialized_queries_using_subarray.cc | 2 +- test/src/unit-query-plan.cc | 11 +++----- test/src/unit-sparse-global-order-reader.cc | 19 ++++---------- 8 files changed, 20 insertions(+), 65 deletions(-) diff --git a/test/src/test-capi-consolidation-plan.cc b/test/src/test-capi-consolidation-plan.cc index 11e6ea64e6b..82058c72402 100644 --- a/test/src/test-capi-consolidation-plan.cc +++ b/test/src/test-capi-consolidation-plan.cc @@ -43,12 +43,6 @@ using namespace tiledb; using namespace tiledb::test; -#ifndef TILEDB_TESTS_ENABLE_REST -constexpr bool rest_tests = false; -#else -constexpr bool rest_tests = true; -#endif - struct ConsolidationPlanFx { // Constructors/destructors. ConsolidationPlanFx(); @@ -89,7 +83,7 @@ ConsolidationPlanFx::ConsolidationPlanFx() test::vfs_test_init(fs_vec_, &ctx_c_, &vfs_c_, config.ptr().get()).ok()); ctx_ = Context(ctx_c_); std::string temp_dir = fs_vec_[0]->temp_dir(); - if constexpr (rest_tests) { + if (fs_vec_[0]->is_rest()) { array_name_ = "tiledb://unit/"; } array_name_ += temp_dir + "test_consolidation_plan_array"; @@ -97,8 +91,10 @@ ConsolidationPlanFx::ConsolidationPlanFx() } ConsolidationPlanFx::~ConsolidationPlanFx() { - Array::delete_array(ctx_, array_name_); - REQUIRE(test::vfs_test_close(fs_vec_, ctx_c_, vfs_c_).ok()); + test::vfs_test_remove_temp_dir(ctx_c_, vfs_c_, fs_vec_[0]->temp_dir()); + test::vfs_test_close(fs_vec_, ctx_c_, vfs_c_).ok(); + tiledb_ctx_free(&ctx_c_); + tiledb_vfs_free(&vfs_c_); } void ConsolidationPlanFx::create_sparse_array(bool allows_dups, bool encrypt) { diff --git a/test/src/unit-capi-array.cc b/test/src/unit-capi-array.cc index 4d7bb37dcf3..9d4bb2f41bf 100644 --- a/test/src/unit-capi-array.cc +++ b/test/src/unit-capi-array.cc @@ -462,7 +462,9 @@ TEST_CASE_METHOD( } TEST_CASE_METHOD( - ArrayFx, "C API: Test array with encryption", "[capi][array][encryption]") { + ArrayFx, + "C API: Test array with encryption", + "[capi][array][encryption][non-rest]") { // Create array schema tiledb_array_schema_t* array_schema; int rc = tiledb_array_schema_alloc(ctx_, TILEDB_SPARSE, &array_schema); diff --git a/test/src/unit-capi-dense_array.cc b/test/src/unit-capi-dense_array.cc index 573c736f33d..66be3b6d1e6 100644 --- a/test/src/unit-capi-dense_array.cc +++ b/test/src/unit-capi-dense_array.cc @@ -3387,7 +3387,6 @@ TEST_CASE_METHOD( // Create and write dense array std::string array_name = path + "with_ending_slash/"; - create_temp_dir(temp_dir); create_dense_array(array_name); write_dense_array(array_name); read_dense_array_with_coords_full_global(array_name, true); @@ -3404,7 +3403,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_write_missing_attributes/"; - create_temp_dir(temp_dir); create_dense_array(array_name); write_dense_array_missing_attributes(array_name); remove_temp_dir(temp_dir); @@ -3420,8 +3418,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_read_empty/"; - create_temp_dir(temp_dir); - create_dense_array_1_attribute(array_name); // Write a slice @@ -3508,8 +3504,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_read_empty_merge/"; - create_temp_dir(temp_dir); - create_dense_array_1_attribute(array_name); // Write a slice @@ -3595,8 +3589,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_multi_fragment/"; - create_temp_dir(temp_dir); - create_dense_array_1_attribute(array_name); // Write slice [1,2], [3,4] @@ -3704,7 +3696,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_is_open/"; - create_temp_dir(temp_dir); create_dense_array(array_name); tiledb_array_t* array; @@ -3745,7 +3736,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_get_schema/"; - create_temp_dir(temp_dir); create_dense_array(array_name); // Open array @@ -3781,7 +3771,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense-col-updates"; - create_temp_dir(temp_dir); create_dense_array_1_attribute(array_name); // ------ WRITE QUERIES ------ // @@ -3933,7 +3922,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "unary-range"; - create_temp_dir(temp_dir); // Create and write dense array create_dense_array(array_name); @@ -4016,9 +4004,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "default-dim"; - create_temp_dir(temp_dir); // Create and write dense array create_dense_array(array_name); @@ -4076,7 +4062,6 @@ TEST_CASE_METHOD( fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; std::string array_name = path + "dense_read_same_tile"; - create_temp_dir(temp_dir); create_dense_array_same_tile(array_name); @@ -4194,9 +4179,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "dense_read_multi_index_simple"; - create_temp_dir(temp_dir); create_large_dense_array_1_attribute(array_name); @@ -4247,9 +4230,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "dense_read_multi_index_complex"; - create_temp_dir(temp_dir); create_large_dense_array_1_attribute(array_name); @@ -4317,9 +4298,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "dense_read_multi_index_cross_tile"; - create_temp_dir(temp_dir); create_large_dense_array_1_attribute(array_name); @@ -4370,9 +4349,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "dense_read_multi_out_of_order"; - create_temp_dir(temp_dir); create_large_dense_array_1_attribute(array_name); @@ -4423,9 +4400,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string array_name = path + "dense_read_multi_index_coalesce"; - create_temp_dir(temp_dir); create_large_dense_array_1_attribute(array_name); diff --git a/test/src/unit-capi-dense_neg.cc b/test/src/unit-capi-dense_neg.cc index 51404923ca9..1a872100565 100644 --- a/test/src/unit-capi-dense_neg.cc +++ b/test/src/unit-capi-dense_neg.cc @@ -499,9 +499,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string vector_name = path + "dense_neg_vector"; - create_temp_dir(temp_dir); create_dense_vector(vector_name); write_dense_vector(vector_name); @@ -518,9 +516,7 @@ TEST_CASE_METHOD( create_temp_dir(temp_dir); std::string path = fs_vec_[0]->is_rest() ? "tiledb://unit/" + temp_dir : temp_dir; - std::string vector_name = path + "dense_neg_array"; - create_temp_dir(temp_dir); create_dense_array(vector_name); write_dense_array_global(vector_name); diff --git a/test/src/unit-capi-query-aggregate.cc b/test/src/unit-capi-query-aggregate.cc index 2fee8caa3fa..20872fd35f3 100644 --- a/test/src/unit-capi-query-aggregate.cc +++ b/test/src/unit-capi-query-aggregate.cc @@ -40,9 +40,9 @@ using namespace tiledb::test; -struct QueryAggregateFx : TemporaryDirectoryFixture { +struct QueryAggregateFx { QueryAggregateFx() - : ctx_(vfs_test_setup_.ctx_c) + : ctx(vfs_test_setup_.ctx_c) , array_name_(vfs_test_setup_.array_uri("queryaggregate_array")) { create_sparse_array(); write_sparse_array(); @@ -52,7 +52,7 @@ struct QueryAggregateFx : TemporaryDirectoryFixture { void write_sparse_array(); VFSTestSetup vfs_test_setup_; - tiledb_ctx_t* ctx_; + tiledb_ctx_t* ctx; std::string array_name_; }; diff --git a/test/src/unit-capi-serialized_queries_using_subarray.cc b/test/src/unit-capi-serialized_queries_using_subarray.cc index edce0255c7c..eb82c91a029 100644 --- a/test/src/unit-capi-serialized_queries_using_subarray.cc +++ b/test/src/unit-capi-serialized_queries_using_subarray.cc @@ -324,7 +324,7 @@ struct SerializationFx { TEST_CASE_METHOD( SerializationFx, "subarray - Query serialization, dense", - "[query][dense][serialization][rest]") { + "[query][dense][serialization][rest-fails][sc-40489]") { create_array(TILEDB_DENSE); auto expected_results = write_dense_array(); check_subarray_stats(2, 2); diff --git a/test/src/unit-query-plan.cc b/test/src/unit-query-plan.cc index f3fe5ec7fe0..01c20b63833 100644 --- a/test/src/unit-query-plan.cc +++ b/test/src/unit-query-plan.cc @@ -39,12 +39,6 @@ using namespace tiledb; -#ifndef TILEDB_TESTS_ENABLE_REST -constexpr bool rest_tests = false; -#else -constexpr bool rest_tests = true; -#endif - struct QueryPlanFx { QueryPlanFx(); ~QueryPlanFx(); @@ -268,11 +262,12 @@ QueryPlanFx::QueryPlanFx() QueryPlanFx::~QueryPlanFx() { test::vfs_test_remove_temp_dir(ctx_c_, vfs_c_, temp_dir_); test::vfs_test_close(fs_vec_, ctx_c_, vfs_c_).ok(); + tiledb_ctx_free(&ctx_c_); tiledb_vfs_free(&vfs_c_); } void QueryPlanFx::create_dense_array(const std::string& array_name) { - if constexpr (rest_tests) { + if (fs_vec_[0]->is_rest()) { uri_ = "tiledb://unit/"; } @@ -347,7 +342,7 @@ void QueryPlanFx::create_dense_array(const std::string& array_name) { } void QueryPlanFx::create_sparse_array(const std::string& array_name) { - if constexpr (rest_tests) { + if (fs_vec_[0]->is_rest()) { uri_ = "tiledb://unit/"; } diff --git a/test/src/unit-sparse-global-order-reader.cc b/test/src/unit-sparse-global-order-reader.cc index e3faa1e2f78..d2ddfcbd652 100644 --- a/test/src/unit-sparse-global-order-reader.cc +++ b/test/src/unit-sparse-global-order-reader.cc @@ -1193,16 +1193,12 @@ TEST_CASE( TEST_CASE( "Sparse global order reader: attribute copy memory limit", - "[sparse-global-order][attribute-copy][memory-limit]") { - std::string array_name = "test_sparse_global_order"; + "[sparse-global-order][attribute-copy][memory-limit][rest]") { Config config; config["sm.mem.total_budget"] = "10000"; - Context ctx(config); - VFS vfs(ctx); - - if (vfs.is_dir(array_name)) { - vfs.remove_dir(array_name); - } + VFSTestSetup vfs_test_setup(config.ptr().get()); + std::string array_name = vfs_test_setup.array_uri("test_sparse_global_order"); + auto ctx = vfs_test_setup.ctx(); // Create array with var-sized attribute. Domain dom(ctx); @@ -1237,8 +1233,7 @@ TEST_CASE( query.set_data_buffer("d1", d1); query.set_data_buffer("a", a1_data); query.set_offsets_buffer("a", a1_offsets); - CHECK_NOTHROW(query.submit()); - CHECK_NOTHROW(query.finalize()); + CHECK_NOTHROW(query.submit_and_finalize()); // Read using a budget that can only fit one of the var size tiles. Array array2(ctx, array_name, TILEDB_READ); @@ -1267,10 +1262,6 @@ TEST_CASE( CHECK(result_num == 4); array2.close(); - - if (vfs.is_dir(array_name)) { - vfs.remove_dir(array_name); - } } TEST_CASE_METHOD(