3030 * Tests the C++ API for schema evolution.
3131 */
3232
33+ #include < test/support/src/vfs_helpers.h>
3334#include < test/support/tdb_catch.h>
3435#include " test/support/src/mem_helpers.h"
3536#include " tiledb/sm/array_schema/array_schema.h"
4748
4849TEST_CASE (
4950 " C++ API: SchemaEvolution, add and drop attributes" ,
50- " [cppapi][schema][evolution][add][drop]" ) {
51+ " [cppapi][schema][evolution][add][drop][rest] " ) {
5152 using namespace tiledb ;
52- Context ctx;
53- VFS vfs (ctx);
54-
55- std::string array_uri = " test_schema_evolution_array" ;
53+ test::VFSTestSetup vfs_test_setup;
54+ Context ctx{vfs_test_setup.ctx ()};
55+ auto array_uri{vfs_test_setup.array_uri (" test_schema_evolution_array" )};
5656
5757 Domain domain (ctx);
5858 auto id1 = Dimension::create<int >(ctx, " d1" , {{-100 , 100 }}, 10 );
@@ -71,10 +71,6 @@ TEST_CASE(
7171 schema.set_cell_order (TILEDB_ROW_MAJOR);
7272 schema.set_tile_order (TILEDB_COL_MAJOR);
7373
74- if (vfs.is_dir (array_uri)) {
75- vfs.remove_dir (array_uri);
76- }
77-
7874 Array::create (array_uri, schema);
7975
8076 auto evolution = ArraySchemaEvolution (ctx);
@@ -100,21 +96,15 @@ TEST_CASE(
10096 CHECK (attrs.count (" a1" ) == 0 );
10197 CHECK (attrs.count (" a2" ) == 1 );
10298 CHECK (attrs.count (" a3" ) == 1 );
103-
104- // Clean up
105- if (vfs.is_dir (array_uri)) {
106- vfs.remove_dir (array_uri);
107- }
10899}
109100
110101TEST_CASE (
111102 " C++ API: SchemaEvolution, check error when dropping dimension" ,
112- " [cppapi][schema][evolution][drop]" ) {
103+ " [cppapi][schema][evolution][drop][rest] " ) {
113104 using namespace tiledb ;
114- Context ctx;
115- VFS vfs (ctx);
116-
117- std::string array_uri = " test_schema_evolution_array" ;
105+ test::VFSTestSetup vfs_test_setup;
106+ Context ctx{vfs_test_setup.ctx ()};
107+ auto array_uri{vfs_test_setup.array_uri (" test_schema_evolution_array" )};
118108
119109 Domain domain (ctx);
120110 auto id1 = Dimension::create<int >(ctx, " d1" , {{-100 , 100 }}, 10 );
@@ -131,10 +121,6 @@ TEST_CASE(
131121 schema.set_cell_order (TILEDB_ROW_MAJOR);
132122 schema.set_tile_order (TILEDB_COL_MAJOR);
133123
134- if (vfs.is_dir (array_uri)) {
135- vfs.remove_dir (array_uri);
136- }
137-
138124 Array::create (array_uri, schema);
139125
140126 auto evolution = ArraySchemaEvolution (ctx);
@@ -144,27 +130,22 @@ TEST_CASE(
144130
145131 // check that an exception is thrown
146132 CHECK_THROWS (evolution.array_evolve (array_uri));
147-
148- // Clean up
149- if (vfs.is_dir (array_uri)) {
150- vfs.remove_dir (array_uri);
151- }
152133}
153134
154135TEST_CASE (
155136 " C++ API: SchemaEvolution, add attributes and read" ,
156- " [cppapi][schema][evolution][add]" ) {
137+ " [cppapi][schema][evolution][add][rest] " ) {
157138 using namespace tiledb ;
158- Context ctx;
159- VFS vfs (ctx);
139+ test::VFSTestSetup vfs_test_setup;
140+ Context ctx{vfs_test_setup.ctx ()};
141+
160142 auto layout = GENERATE (
161143 TILEDB_ROW_MAJOR,
162144 TILEDB_COL_MAJOR,
163145 TILEDB_UNORDERED,
164146 TILEDB_GLOBAL_ORDER);
165147 bool duplicates = GENERATE (true , false );
166-
167- std::string array_uri = " test_schema_evolution_array_read" ;
148+ auto array_uri{vfs_test_setup.array_uri (" test_schema_evolution_array" )};
168149
169150 // Create
170151 {
@@ -183,10 +164,6 @@ TEST_CASE(
183164 schema.set_cell_order (TILEDB_ROW_MAJOR);
184165 schema.set_tile_order (TILEDB_COL_MAJOR);
185166
186- if (vfs.is_dir (array_uri)) {
187- vfs.remove_dir (array_uri);
188- }
189-
190167 Array::create (array_uri, schema);
191168 }
192169
@@ -464,9 +441,11 @@ TEST_CASE(
464441 // test case.
465442 Config cfg;
466443 cfg[" sm.merge_overlapping_ranges_experimental" ] = " false" ;
444+ vfs_test_setup.update_config (cfg.ptr ().get ());
467445 // + Global order does not support multi-range subarrays
468446 if (layout != TILEDB_GLOBAL_ORDER) {
469- ctx = Context (cfg);
447+ ctx = vfs_test_setup.ctx ();
448+
470449 Array array (ctx, array_uri, TILEDB_READ);
471450
472451 std::vector<int > a_data (8 );
@@ -683,19 +662,14 @@ TEST_CASE(
683662 1 , 1 , 1 , 1 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 1 , 1 , 1 , 1 }));
684663 }
685664 }
686-
687- // Clean up
688- if (vfs.is_dir (array_uri)) {
689- vfs.remove_dir (array_uri);
690- }
691665}
692666
693667TEST_CASE (
694668 " C++ API: SchemaEvolution, add and drop attributes" ,
695- " [cppapi][schema][evolution][add][query-condition]" ) {
669+ " [cppapi][schema][evolution][add][query-condition][rest] " ) {
696670 using namespace tiledb ;
697- Context ctx ;
698- VFS vfs ( ctx) ;
671+ test::VFSTestSetup vfs_test_setup ;
672+ Context ctx{vfs_test_setup. ctx ()} ;
699673 auto layout = GENERATE (
700674 TILEDB_ROW_MAJOR,
701675 TILEDB_COL_MAJOR,
@@ -705,7 +679,8 @@ TEST_CASE(
705679
706680 const char * out_str = nullptr ;
707681 tiledb_layout_to_str (layout, &out_str);
708- std::string array_uri = " test_schema_evolution_query_condition" ;
682+ auto array_uri{
683+ vfs_test_setup.array_uri (" test_schema_evolution_query_condition" )};
709684
710685 {
711686 Domain domain (ctx);
@@ -723,10 +698,6 @@ TEST_CASE(
723698 schema.set_cell_order (TILEDB_ROW_MAJOR);
724699 schema.set_tile_order (TILEDB_COL_MAJOR);
725700
726- if (vfs.is_dir (array_uri)) {
727- vfs.remove_dir (array_uri);
728- }
729-
730701 Array::create (array_uri, schema);
731702 }
732703
@@ -833,11 +804,6 @@ TEST_CASE(
833804 CHECK_THAT (d1_data, Catch::Matchers::Equals (std::vector<int >{4 }));
834805 CHECK_THAT (d2_data, Catch::Matchers::Equals (std::vector<int >{1 }));
835806 }
836-
837- // Cleanup.
838- if (vfs.is_dir (array_uri)) {
839- vfs.remove_dir (array_uri);
840- }
841807}
842808
843809TEST_CASE (
0 commit comments