@@ -1374,7 +1374,8 @@ TEST(kvs_write_json_data, write_json_data_success){
13741374 auto kvs = Kvs::open (InstanceId (instance_id), OpenNeedDefaults::Optional, OpenNeedKvs::Optional, std::string (data_dir));
13751375 ASSERT_TRUE (kvs);
13761376
1377- auto result = kvs->write_json_data (filename_prefix, json_test_data);
1377+ kvs->filename_prefix = filename_prefix; /* Set the filename prefix to the test prefix */
1378+ auto result = kvs->write_json_data (json_test_data);
13781379 EXPECT_TRUE (result);
13791380 EXPECT_TRUE (std::filesystem::exists (kvs_prefix + " .json" ));
13801381 EXPECT_TRUE (std::filesystem::exists (kvs_prefix + " .hash" ));
@@ -1410,8 +1411,8 @@ TEST(kvs_write_json_data, write_json_data_failure){
14101411
14111412 auto kvs = Kvs::open (InstanceId (instance_id), OpenNeedDefaults::Optional, OpenNeedKvs::Optional, std::string (data_dir));
14121413 ASSERT_TRUE (kvs);
1413-
1414- auto result = kvs->write_json_data (unwritable_dir + " /kvs_ " + std::to_string (instance), kvs_json);
1414+ kvs-> filename_prefix = unwritable_dir + " /kvs_ " + std::to_string (instance); /* Set the filename prefix to the test prefix */
1415+ auto result = kvs->write_json_data (kvs_json);
14151416 EXPECT_FALSE (result);
14161417 EXPECT_EQ (result.error (), MyErrorCode::PhysicalStorageFailure);
14171418
@@ -1420,7 +1421,8 @@ TEST(kvs_write_json_data, write_json_data_failure){
14201421 out_hash << " data" ;
14211422 out_hash.close ();
14221423 std::filesystem::permissions (kvs_prefix + " .hash" , std::filesystem::perms::owner_read, std::filesystem::perm_options::replace);
1423- result = kvs->write_json_data (filename_prefix, kvs_json);
1424+ kvs->filename_prefix = filename_prefix; /* Reset the filename prefix to the test prefix */
1425+ result = kvs->write_json_data (kvs_json);
14241426 EXPECT_FALSE (result);
14251427 EXPECT_EQ (result.error (), MyErrorCode::PhysicalStorageFailure);
14261428
@@ -1429,13 +1431,14 @@ TEST(kvs_write_json_data, write_json_data_failure){
14291431 out_json << " data" ;
14301432 out_json.close ();
14311433 std::filesystem::permissions (kvs_prefix + " .json" , std::filesystem::perms::owner_read, std::filesystem::perm_options::replace);
1432- result = kvs->write_json_data (filename_prefix, kvs_json);
1434+ kvs->filename_prefix = filename_prefix; /* Reset the filename prefix to the test prefix */
1435+ result = kvs->write_json_data (kvs_json);
14331436 EXPECT_FALSE (result);
14341437 EXPECT_EQ (result.error (), MyErrorCode::PhysicalStorageFailure);
14351438
14361439 /* Test if path argument is missing parent path (will only occur if semantic errors will be done in flush() )*/
1437- const std::string prefix = " no_parent_path" ;
1438- result = kvs->write_json_data (prefix, kvs_json);
1440+ kvs-> filename_prefix = " no_parent_path" ; /* Set the filename prefix to the test prefix */
1441+ result = kvs->write_json_data (kvs_json);
14391442 EXPECT_FALSE (result);
14401443 EXPECT_EQ (result.error (), MyErrorCode::UnmappedError);
14411444
0 commit comments