@@ -511,6 +511,17 @@ TEST_F(RemoteConnectionTest, ImageTransactionRollback) {
511511 std::array<char , 8 > buffer;
512512 std::string result;
513513
514+ std::string string_query_simple_add_image (" [ \
515+ { \
516+ \" AddImage\" : { \
517+ \" properties\" : { \
518+ \" name\" : \" SampleImage\" \
519+ }, \
520+ \" format\" : \" png\" \
521+ } \
522+ } \
523+ ]" );
524+
514525 std::string string_query_image_rollback (" [" );
515526 string_query_image_rollback += " \
516527 { \
@@ -546,7 +557,7 @@ TEST_F(RemoteConnectionTest, ImageTransactionRollback) {
546557 // been initialized
547558
548559 VDMS::protobufs::queryMessage proto_query;
549- proto_query.set_json (string_query_image_rollback );
560+ proto_query.set_json (string_query_simple_add_image );
550561
551562 std::string image;
552563 std::ifstream file (" test_images/brain.png" ,
@@ -559,7 +570,9 @@ TEST_F(RemoteConnectionTest, ImageTransactionRollback) {
559570 std::cout << " error" << std::endl;
560571
561572 proto_query.add_blobs (image);
562- proto_query.add_blobs (image);
573+
574+ VDMS::protobufs::queryMessage response;
575+ query_handler.process_query (proto_query, response);
563576
564577 // Get initial number of objects stored in S3
565578 std::unique_ptr<FILE, decltype (&pclose)> pipe1 (popen (s3_num_objects_cmd, " r" ), pclose);
@@ -570,8 +583,12 @@ TEST_F(RemoteConnectionTest, ImageTransactionRollback) {
570583 result += buffer.data ();
571584 }
572585 s3_num_objects = stoi (result);
586+ result.clear ();
573587
574- VDMS::protobufs::queryMessage response;
588+ proto_query.clear_blobs ();
589+ proto_query.set_json (string_query_image_rollback);
590+ proto_query.add_blobs (image);
591+ proto_query.add_blobs (image);
575592 query_handler.process_query (proto_query, response);
576593
577594 Json::Reader json_reader;
@@ -619,7 +636,6 @@ TEST_F(RemoteConnectionTest, ImageTransactionRollback) {
619636 EXPECT_EQ (json_response[1 ][" FindImage" ][" info" ], " No entities found" );
620637
621638 // Make sure number of objects in S3 is still the same
622- result.clear ();
623639 std::unique_ptr<FILE, decltype (&pclose)> pipe2 (popen (s3_num_objects_cmd, " r" ), pclose);
624640 if (!pipe2) {
625641 throw std::runtime_error (" popen() failed!" );
0 commit comments