@@ -126,11 +126,10 @@ struct HandleConsolidationPlanRequestFx : RequestHandlerFx {
126126TEST_CASE_METHOD (
127127 HandleLoadArraySchemaRequestFx,
128128 " tiledb_handle_load_array_schema_request - no enumerations" ,
129- " [request_handler][load_array_schema]" ) {
129+ " [request_handler][load_array_schema][default] " ) {
130130 auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
131131
132132 create_array ();
133- REQUIRE (cfg_.set (" rest.load_enumerations_on_array_open" , " false" ).ok ());
134133 auto schema_response =
135134 call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
136135 auto schema = std::get<0 >(schema_response);
@@ -148,10 +147,11 @@ TEST_CASE_METHOD(
148147TEST_CASE_METHOD (
149148 HandleLoadArraySchemaRequestFx,
150149 " tiledb_handle_load_array_schema_request - load enumerations" ,
151- " [request_handler][load_array_schema][with-enumerations][default] " ) {
150+ " [request_handler][load_array_schema][with-enumerations]" ) {
152151 auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
153152
154153 create_array ();
154+ REQUIRE (cfg_.set (" rest.load_enumerations_on_array_open" , " true" ).ok ());
155155 auto schema_response =
156156 call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
157157 auto schema = std::get<0 >(schema_response);
@@ -173,6 +173,7 @@ TEST_CASE_METHOD(
173173 " tiledb_handle_load_array_schema_request - multiple schemas" ,
174174 " [request_handler][load_array_schema][schema-evolution]" ) {
175175 auto stype = GENERATE (SerializationType::JSON, SerializationType::CAPNP);
176+ std::string load_enums = GENERATE (" true" , " false" );
176177
177178 create_array ();
178179
@@ -184,15 +185,20 @@ TEST_CASE_METHOD(
184185 auto schema_response =
185186 call_handler (serialization::LoadArraySchemaRequest (cfg_), stype);
186187 auto schema = std::get<0 >(schema_response);
187- REQUIRE (schema->has_enumeration (" enmr" ));
188- REQUIRE (schema->get_loaded_enumeration_names ().size () == 1 );
189- REQUIRE (schema->get_loaded_enumeration_names ()[0 ] == " enmr" );
190- REQUIRE (schema->get_enumeration (" enmr" ) != nullptr );
188+ if (load_enums == " true" ) {
189+ REQUIRE (schema->has_enumeration (" enmr" ));
190+ REQUIRE (schema->get_loaded_enumeration_names ().size () == 1 );
191+ REQUIRE (schema->get_loaded_enumeration_names ()[0 ] == " enmr" );
192+ REQUIRE (schema->get_enumeration (" enmr" ) != nullptr );
193+ }
191194 // The latest schema should be equal to the last applied evolution.
192195 tiledb::test::schema_equiv (*schema, *all_schemas.back ());
193196
194- // Validate all array schemas returned from the request.
195- for (int i = 0 ; const auto & s : std::get<1 >(schema_response)) {
197+ // Validate schemas returned from the request in the order they were created.
198+ auto r_all_schemas = std::get<1 >(schema_response);
199+ std::map<std::string, shared_ptr<ArraySchema>> resp (
200+ r_all_schemas.begin (), r_all_schemas.end ());
201+ for (int i = 0 ; const auto & s : resp) {
196202 tiledb::test::schema_equiv (*s.second , *all_schemas[i++]);
197203 }
198204}
@@ -468,18 +474,17 @@ shared_ptr<ArraySchema> HandleLoadArraySchemaRequestFx::schema_add_attribute(
468474 tiledb::ArraySchemaEvolution ase (ctx);
469475 auto attr = tiledb::Attribute::create<int32_t >(ctx, attr_name);
470476 ase.add_attribute (attr);
471- auto evolved = ase.ptr ()->array_schema_evolution_ ->evolve_schema (schema_);
477+ // Evolve and update the original schema member variable.
478+ schema_ = ase.ptr ()->array_schema_evolution_ ->evolve_schema (schema_);
472479 // Apply the schema evolution.
473480 Array::evolve_array_schema (
474481 this ->ctx_ .resources (),
475482 this ->uri_ ,
476483 ase.ptr ()->array_schema_evolution_ ,
477484 this ->enc_key_ );
478485
479- // Update the original schema.
480- schema_ = evolved;
481- // Return the schema for validation.
482- return evolved;
486+ // Return the new evolved schema for validation.
487+ return schema_;
483488}
484489
485490shared_ptr<ArraySchema> HandleLoadArraySchemaRequestFx::create_schema () {
0 commit comments