Skip to content

Add idempotency to tests and update tests to check more edge cases #9

Add idempotency to tests and update tests to check more edge cases

Add idempotency to tests and update tests to check more edge cases #9

Triggered via pull request February 21, 2024 16:30
Status Failure
Total duration 19s
Artifacts

linter.yml

on: pull_request_target
Run linters
10s
Run linters
Fit to window
Zoom out
Zoom in

Annotations

2 errors and 10 warnings
Run linters
reviewdog: Too many results (annotations) in diff. You may miss some annotations due to GitHub limitation for annotation created by logging command. Please check GitHub Actions log console to see all results. Limitation: - 10 warning annotations and 10 error annotations per step - 50 annotations per job (sum of annotations from all the steps) - 50 annotations per run (separate from the job annotations, these annotations aren't created by users) Source: https://github.community/t5/GitHub-Actions/Maximum-number-of-annotations-that-can-be-created-using-GitHub/m-p/39085
Run linters
Process completed with exit code 1.
Run linters: src/lotman.cpp#L1462
[lint] reported by reviewdog 🐶 Raw Output: src/lotman.cpp:1462:- src/lotman.cpp:1463:-// Given a lot_name and a recursive flag, generate the lot's information and return it as JSON. Recursive in this case src/lotman.cpp:1464:-// indicates that we want to look up/down the tree of lots to determine the most restrictive values associated with parents/children. src/lotman.cpp:1465:-int lotman_get_lot_as_json(const char *lot_name, const bool recursive, char **output, char **err_msg) { src/lotman.cpp:1466:- try { src/lotman.cpp:1467:- if (!lot_name) { src/lotman.cpp:1468:- if (err_msg) {*err_msg = strdup("Name for the lot to be returned as JSON must not be nullpointer.");} src/lotman.cpp:1469:- return -1; src/lotman.cpp:1470:- } src/lotman.cpp:1471:- src/lotman.cpp:1472:- // Check for existence of the lot we're asking about src/lotman.cpp:1473:- auto rp = lotman::Lot::lot_exists(lot_name); src/lotman.cpp:1474:- if (!rp.first) { src/lotman.cpp:1475:- if (err_msg) { src/lotman.cpp:1476:- if (rp.second.empty()) { // function worked, but lot does not exist src/lotman.cpp:1477:- *err_msg = strdup("That was easy! The lot does not exist, so there's nothing to return."); src/lotman.cpp:1478:- } src/lotman.cpp:1479:- else { src/lotman.cpp:1480:- std::string int_err = rp.second; src/lotman.cpp:1481:- std::string ext_err = "Function call to lotman::Lot::lot_exists failed: "; src/lotman.cpp:1482:- *err_msg = strdup((ext_err + int_err).c_str()); src/lotman.cpp:1483:- } src/lotman.cpp:1484:- return -1; src/lotman.cpp:1485:- } src/lotman.cpp:1486:- } src/lotman.cpp:1487:- src/lotman.cpp:1488:- auto rp_bool_str = lotman::Lot::update_db_children_usage(); src/lotman.cpp:1489:- if (!rp_bool_str.first) { src/lotman.cpp:1490:- if (err_msg) { src/lotman.cpp:1491:- std::string int_err = rp_bool_str.second; src/lotman.cpp:1492:- std::string ext_err = "Failure on call to update_db_children_usage()"; src/lotman.cpp:1493:- *err_msg = strdup((ext_err + int_err).c_str()); src/lotman.cpp:1494:- } src/lotman.cpp:1495:- return -1; src/lotman.cpp:1496:- } src/lotman.cpp:1497:- src/lotman.cpp:1498:- lotman::Lot lot(lot_name); src/lotman.cpp:1499:- src/lotman.cpp:1500:- json output_obj; src/lotman.cpp:1501:- // Start populating fields in output_obj src/lotman.cpp:1502:- src/lotman.cpp:1503:- // Add name src/lotman.cpp:1504:- output_obj["lot_name"] = lot_name; src/lotman.cpp:1505:- src/lotman.cpp:1506:- // Add owner(s) according to recursive flag src/lotman.cpp:1507:- std::pair<std::vector<std::string>, std::string> rp_vec_str; src/lotman.cpp:1508:- rp_vec_str = lot.get_owners(recursive); src/lotman.cpp:1509:- if (!rp_vec_str.second.empty()) { // There was an error src/lotman.cpp:1510:- if (err_msg) { src/lotman.cpp:1511:- std::string int_err = rp_vec_str.second; src/lotman.cpp:1512:- std::string ext_err = "Failure on call to get_owners: "; src/lotman.cpp:1513:- *err_msg = strdup((ext_err + int_err).c_str()); src/lotman.cpp:1514:- } src/lotman.cpp:1515:- return -1; src/lotman.cpp:1516:- } src/lotman.cpp:1517:- if (recursive) { src/lotman.cpp:1518:- output_obj["owners"] = rp_vec_str.first; src/lotman.cpp:1519:- } src/lotman.cpp:1520:- else { src/lotman.cpp:1521:- output_obj["owners"] = rp_vec_str.first[0]; // Only one owner, this is where it will be. src/lotman.cpp:1522:- } src/lotman.cpp:1523:- src/lotman.cpp:1524:- // Add parents according to recursive flag src/lotman.cpp:1525:- std::pair<std::vector<lotman::Lot>, std::string> rp_lotvec_str; src/lotman.cpp:1526:- rp_lotvec_str = lot.get_parents(recursive
Run linters: test/main.cpp#L7
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:7:-#include <typeinfo> test/main.cpp:8:-#include <cstring>
Run linters: test/main.cpp#L51
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:51:- TEST_F(LotManTest, DefaultLotTests) { test/main.cpp:52:- char *err1; test/main.cpp:53:- const char *lot1 = "{\"lot_name\": \"lot1\", \"owner\": \"owner1\", \"parents\": [\"lot1\"],\"paths\": [{\"path\":\"/1/2/3\", \"recursive\":false},{\"path\":\"/foo/bar\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:54:- const char *default_lot = "{\"lot_name\": \"default\", \"owner\": \"owner2\", \"parents\": [\"default\"],\"paths\": [{\"path\":\"/default/paths\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:55:- test/main.cpp:56:- auto rv = lotman_set_context_str("caller", "owner1", &err1); test/main.cpp:52:+TEST_F(LotManTest, DefaultLotTests) { test/main.cpp:53:+ char *err1; test/main.cpp:54:+ const char *lot1 = test/main.cpp:55:+ "{\"lot_name\": \"lot1\", \"owner\": \"owner1\", \"parents\": " test/main.cpp:56:+ "[\"lot1\"],\"paths\": [{\"path\":\"/1/2/3\", " test/main.cpp:57:+ "\"recursive\":false},{\"path\":\"/foo/bar\", " test/main.cpp:58:+ "\"recursive\":true}],\"management_policy_attrs\": { " test/main.cpp:59:+ "\"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100," test/main.cpp:60:+ "\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:61:+ const char *default_lot = test/main.cpp:62:+ "{\"lot_name\": \"default\", \"owner\": \"owner2\", \"parents\": " test/main.cpp:63:+ "[\"default\"],\"paths\": [{\"path\":\"/default/paths\", " test/main.cpp:64:+ "\"recursive\":true}],\"management_policy_attrs\": { " test/main.cpp:65:+ "\"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100," test/main.cpp:66:+ "\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:67:+ test/main.cpp:68:+ auto rv = lotman_set_context_str("caller", "owner1", &err1); test/main.cpp:69:+ test/main.cpp:70:+ rv = lotman_add_lot(lot1, &err1); test/main.cpp:71:+ ASSERT_FALSE(!(rv != 0 && err1 != nullptr)) << err1; test/main.cpp:72:+ // There should be an err message, so we need to free test/main.cpp:73:+ free(err1); test/main.cpp:74:+ test/main.cpp:75:+ char *err2; test/main.cpp:76:+ rv = lotman_add_lot(default_lot, &err2); test/main.cpp:77:+ ASSERT_TRUE(rv == 0) << err2; test/main.cpp:78:+ test/main.cpp:79:+ rv = lotman_remove_lot("default", true, true, true, false, &err2); test/main.cpp:80:+ ASSERT_FALSE(rv == 0 && err2 == nullptr) << err2; test/main.cpp:81:+ // There should be an err message, so we need to free test/main.cpp:82:+ free(err2); test/main.cpp:83:+}
Run linters: test/main.cpp#L67
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:67:- rv = lotman_remove_lot("default", true, true, true, false, &err2); test/main.cpp:68:- ASSERT_FALSE(rv == 0 && err2 == nullptr) << err2; test/main.cpp:69:- // There should be an err message, so we need to free test/main.cpp:70:- free(err2); test/main.cpp:197:+TEST_F(LotManTest, InsertionTest) { test/main.cpp:198:+ char *err_msg; test/main.cpp:199:+ const char *lot5 = test/main.cpp:200:+ "{\"lot_name\": \"lot5\",\"owner\":\"owner1\",\"parents\": " test/main.cpp:201:+ "[\"lot3\"],\"children\": [\"lot4\"],\"paths\": [{\"path\":\"/456\", " test/main.cpp:202:+ "\"recursive\":false},{\"path\":\"/567\", " test/main.cpp:203:+ "\"recursive\":true}],\"management_policy_attrs\": { " test/main.cpp:204:+ "\"dedicated_GB\":10,\"opportunistic_GB\":3.5,\"max_num_objects\":20," test/main.cpp:205:+ "\"creation_time\":100,\"expiration_time\":200,\"deletion_time\":300}}"; test/main.cpp:206:+ int rv = lotman_add_lot(lot5, &err_msg); test/main.cpp:207:+ ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:208:+ test/main.cpp:209:+ // Check that lot5 is a parent to lot4 and that lot3 is a parent to lot5 test/main.cpp:210:+ char **output; test/main.cpp:211:+ rv = lotman_get_parent_names("lot4", false, false, &output, &err_msg); test/main.cpp:212:+ ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:213:+ test/main.cpp:214:+ bool check = false; test/main.cpp:215:+ test/main.cpp:216:+ for (int iter = 0; output[iter]; iter++) { test/main.cpp:217:+ if (static_cast<std::string>(output[iter]) == "lot5") { test/main.cpp:218:+ check = true;
Run linters: test/main.cpp#L73
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:73:- TEST_F(LotManTest, AddRemoveSublot) { test/main.cpp:74:- char *err_msg; test/main.cpp:75:- const char *lot1 = "{\"lot_name\": \"lot1\", \"owner\": \"owner1\", \"parents\": [\"lot1\"],\"paths\": [{\"path\":\"1/2/3\", \"recursive\":false},{\"path\":\"/foo/bar\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:76:- test/main.cpp:77:- auto rv = lotman_add_lot(lot1, &err_msg); test/main.cpp:78:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:79:- test/main.cpp:80:- const char *deleted_lot = "lot1"; test/main.cpp:81:- rv = lotman_remove_lot(deleted_lot, false, false, false, false, &err_msg); test/main.cpp:82:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:83:- test/main.cpp:84:- rv = lotman_lot_exists(deleted_lot, &err_msg); test/main.cpp:85:- ASSERT_FALSE(rv) << err_msg; test/main.cpp:86:- test/main.cpp:87:- // Try to remove a lot that doesn't exist test/main.cpp:88:- const char *non_existent_lot = "non_existent_lot"; test/main.cpp:89:- rv = lotman_remove_lot(non_existent_lot, false, false, false, false, &err_msg); test/main.cpp:90:- ASSERT_FALSE(rv == 0) << err_msg; test/main.cpp:91:- free(err_msg); test/main.cpp:92:- } test/main.cpp:222:+ ASSERT_TRUE(check); test/main.cpp:223:+ lotman_free_string_list(output);
Run linters: test/main.cpp#L94
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:94:- TEST_F(LotManTest, AddInvalidLots) { test/main.cpp:95:- char *err_msg; test/main.cpp:96:- test/main.cpp:97:- const char *lot1 = "{\"lot_name\": \"lot1\", \"owner\": \"owner1\", \"parents\": [\"lot1\"],\"paths\": [{\"path\":\"/1/2/3\", \"recursive\":false},{\"path\":\"/foo/bar\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":20,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:98:- const char *lot2 = "{\"lot_name\": \"lot2\", \"owner\": \"owner1\", \"parents\": [\"lot1\"], \"paths\": [{\"path\":\"/1/2/4\", \"recursive\":true},{\"path\":\"/foo/baz\", \"recursive\":true}], \"management_policy_attrs\": { \"dedicated_GB\":6,\"opportunistic_GB\":1.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":233,\"deletion_time\":355}}"; test/main.cpp:99:- const char *lot3 = "{ \"lot_name\": \"lot3\", \"owner\": \"owner1\", \"parents\": [\"lot3\"], \"paths\": [{\"path\":\"/another/path\", \"recursive\":false},{\"path\":\"/123\", \"recursive\":true}], \"management_policy_attrs\": { \"dedicated_GB\":3,\"opportunistic_GB\":2.0,\"max_num_objects\":60,\"creation_time\":123,\"expiration_time\":232,\"deletion_time\":325}}"; test/main.cpp:100:- const char *lot4 = "{ \"lot_name\": \"lot4\", \"owner\": \"owner1\", \"parents\": [\"lot2\",\"lot3\"], \"paths\": [{\"path\":\"/1/2/3/4\", \"recursive\":true},{\"path\":\"/345\", \"recursive\":true}], \"management_policy_attrs\": { \"dedicated_GB\":3,\"opportunistic_GB\":2.1,\"max_num_objects\":40,\"creation_time\":123,\"expiration_time\":231,\"deletion_time\":315}}"; test/main.cpp:101:- const char *sep_node = "{ \"lot_name\": \"sep_node\", \"owner\": \"owner1\", \"parents\": [\"sep_node\"], \"paths\": [{\"path\":\"/sep/node\", \"recursive\":true}], \"management_policy_attrs\": { \"dedicated_GB\":3,\"opportunistic_GB\":2.1,\"max_num_objects\":10,\"creation_time\":123,\"expiration_time\":99679525853643,\"deletion_time\":9267952553643}}"; test/main.cpp:102:- test/main.cpp:103:- auto rv = lotman_add_lot(lot1, &err_msg); test/main.cpp:104:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:105:- test/main.cpp:106:- rv = lotman_add_lot(lot2, &err_msg); test/main.cpp:107:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:108:- test/main.cpp:109:- rv = lotman_add_lot(lot3, &err_msg); test/main.cpp:110:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:111:- test/main.cpp:112:- rv = lotman_add_lot(lot4, &err_msg); test/main.cpp:113:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:114:- test/main.cpp:115:- rv = lotman_add_lot(sep_node, &err_msg); test/main.cpp:116:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:117:- test/main.cpp:118:- // Try to add a lot with cyclic dependency test/main.cpp:119:- // Cycle created by trying to add lot5 with lot1 as a child test/main.cpp:120:- const char *cyclic_lot = "{\"lot_name\": \"lot5\",\"owner\": \"owner1\",\"parents\": [\"lot4\"],\"children\": [\"lot1\"],\"paths\": [{\"path\":\"/456\", \"recursive\":false},{\"path\":\"/567\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:121:- rv = lotman_add_lot(cyclic_lot, &err_msg); test/main.cpp:122:- ASSERT_FALSE(rv == 0) << err_msg; test/main.cpp:123:- // There should be an err message, so we need to free test/main.cpp:124:- free(err_msg); test/main.cpp:125:- test/main.cpp:126:- // Try to add lot with no parent test/main.cpp:127:- char *err_msg2; test/main.cpp:128:- const char *no_parents_lot = "{\"lot_name\": \"lot5\",\"owner\": \"owner1\",\"parents\": [],\"children\": [\"lot1\"],\"paths\": [{\"path\":\"/456\", \"recursive\":false},{\"path\":\"/567\", \"recursive\":true}],\"management_policy_attrs\": { \"de
Run linters: test/main.cpp#L135
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:135:- TEST_F(LotManTest, InsertionTest) { test/main.cpp:136:- char *err_msg; test/main.cpp:137:- const char *lot5 = "{\"lot_name\": \"lot5\",\"owner\":\"owner1\",\"parents\": [\"lot3\"],\"children\": [\"lot4\"],\"paths\": [{\"path\":\"/456\", \"recursive\":false},{\"path\":\"/567\", \"recursive\":true}],\"management_policy_attrs\": { \"dedicated_GB\":10,\"opportunistic_GB\":3.5,\"max_num_objects\":20,\"creation_time\":100,\"expiration_time\":200,\"deletion_time\":300}}"; test/main.cpp:138:- int rv = lotman_add_lot(lot5, &err_msg); test/main.cpp:139:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:140:- test/main.cpp:141:- // Check that lot5 is a parent to lot4 and that lot3 is a parent to lot5 test/main.cpp:142:- char **output; test/main.cpp:143:- rv = lotman_get_parent_names("lot4", false, false, &output, &err_msg); test/main.cpp:144:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:145:- test/main.cpp:146:- bool check = false; test/main.cpp:147:- test/main.cpp:148:- for (int iter = 0; output[iter]; iter++) { test/main.cpp:149:- if (static_cast<std::string>(output[iter]) == "lot5") { test/main.cpp:150:- check = true; test/main.cpp:151:- } test/main.cpp:152:- } test/main.cpp:153:- test/main.cpp:154:- ASSERT_TRUE(check); test/main.cpp:155:- lotman_free_string_list(output); test/main.cpp:156:- test/main.cpp:157:- check = false; test/main.cpp:158:- char **output2; test/main.cpp:159:- rv = lotman_get_children_names("lot3", false, false, &output2, &err_msg); test/main.cpp:160:- ASSERT_TRUE(rv == 0) << err_msg; test/main.cpp:161:- test/main.cpp:162:- for (int iter = 0; output2[iter]; iter++) { test/main.cpp:163:- if (static_cast<std::string>(output2[iter]) == "lot5") { test/main.cpp:164:- check = true; test/main.cpp:165:- } test/main.cpp:166:- } test/main.cpp:167:- ASSERT_TRUE(check); test/main.cpp:168:- lotman_free_string_list(output2); test/main.cpp:230:+ for (int iter = 0; output2[iter]; iter++) { test/main.cpp:231:+ if (static_cast<std::string>(output2[iter]) == "lot5") { test/main.cpp:232:+ check = true;
Run linters: test/main.cpp#L171
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:171:- TEST_F(LotManTest, ModifyLotTest) { test/main.cpp:172:- // Try to modify a non-existent log test/main.cpp:173:- char *err_msg; test/main.cpp:174:- const char *non_existent_lot = "{ \"lot_name\": \"non_existent_lot\", \"owner\": \"owner1\", \"parents\": [\"lot1\"], \"paths\": [{\"path\":\"/1/2/3\", \"recursive\":false},{\"path\":\"/foo/bar\", \"recursive\":true}], \"management_policy_attrs\": { \"dedicated_GB\":5,\"opportunistic_GB\":2.5,\"max_num_objects\":100,\"creation_time\":123,\"expiration_time\":234,\"deletion_time\":345}}"; test/main.cpp:175:- int rv = lotman_update_lot(non_existent_lot, &err_msg); test/main.cpp:176:- ASSERT_FALSE(rv == 0); test/main.cpp:177:- free(err_msg); test/main.cpp:178:- test/main.cpp:179:- test/main.cpp:180:- char *err_msg2; test/main.cpp:181:- const char *modified_lot = "{ \"lot_name\": \"lot3\", \"owner\": \"not owner1\", \"parents\": [{\"current\":\"lot3\", \"new\":\"lot2\"}], \"paths\": [{\"current\": \"/another/path\", \"new\": \"/another/path\", \"recursive\": true},{\"current\":\"/123\", \"new\" : \"/updated/path\", \"recursive\" : false}], \"management_policy_attrs\": { \"dedicated_GB\":10.111,\"opportunistic_GB\":6.6,\"max_num_objects\":50,\"expiration_time\":222,\"deletion_time\":333}}"; test/main.cpp:182:- rv = lotman_update_lot(modified_lot, &err_msg2); test/main.cpp:183:- ASSERT_TRUE(rv == 0) << err_msg2; test/main.cpp:184:- test/main.cpp:185:- // Try to add a cycle --> this should fail test/main.cpp:186:- const char *modified_lot2 = "{ \"lot_name\": \"lot2\", \"parents\": [{\"current\":\"lot1\", \"new\":\"lot3\"}]}"; test/main.cpp:187:- rv = lotman_update_lot(modified_lot2, &err_msg2); test/main.cpp:188:- ASSERT_FALSE(rv == 0); test/main.cpp:189:- free(err_msg2); test/main.cpp:190:- test/main.cpp:191:- char *err_msg3; test/main.cpp:192:- char **owner_out; test/main.cpp:193:- rv = lotman_get_owners("lot3", false, &owner_out, &err_msg3); test/main.cpp:194:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:195:- test/main.cpp:196:- bool check_old = false, check_new = false; test/main.cpp:197:- for (int iter = 0; owner_out[iter]; iter++) { test/main.cpp:198:- if (strcmp(owner_out[iter], "not owner1") == 0) { test/main.cpp:199:- check_new = true; test/main.cpp:200:- } test/main.cpp:201:- if (strcmp(owner_out[iter], "owner1") == 0) { test/main.cpp:202:- check_old = true; test/main.cpp:203:- } test/main.cpp:204:- } test/main.cpp:205:- ASSERT_TRUE(check_new & !check_old); test/main.cpp:206:- lotman_free_string_list(owner_out); test/main.cpp:207:- test/main.cpp:208:- char **parents_out; test/main.cpp:209:- rv = lotman_get_parent_names("lot3", false, true, &parents_out, &err_msg3); test/main.cpp:210:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:211:- test/main.cpp:212:- check_old = false, check_new = false; test/main.cpp:213:- for (int iter = 0; parents_out[iter]; iter++) { test/main.cpp:214:- if (static_cast<std::string>(parents_out[iter]) == "lot2") { test/main.cpp:215:- check_new = true; test/main.cpp:216:- } test/main.cpp:217:- if (static_cast<std::string>(parents_out[iter]) == "lot3") { test/main.cpp:218:- check_old = true; test/main.cpp:219:- } test/main.cpp:220:- } test/main.cpp:221:- ASSERT_TRUE(check_new & !check_old); test/main.cpp:222:- lotman_free_string_list(parents_out); test/main.cpp:223:- test/main.cpp:224:- const char *addition_JSON = "{\"lot_name\":\"lot3\", \"paths\": [{\"path\":\"/foo/barr\", \"recursive\": true}], \"parents\" : [\"sep_node\"]}"; test/main.cpp:225:- rv = lotman_add_to_lot(addition_JSON, &err_msg3); test/main.cpp:226:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:227:- t
Run linters: test/main.cpp#L266
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:266:- TEST_F(LotManTest, SetGetUsageTest) { test/main.cpp:267:- // Update/Get usage for a lot that doesn't exist test/main.cpp:268:- char *err_msg; test/main.cpp:269:- const char *non_existent_lot = "non_existent_lot"; test/main.cpp:270:- bool deltaMode = false; test/main.cpp:271:- const char *bad_usage_update_JSON = "{\"lot_name\":\"non_existent_lot\", \"self_GB\":10.5, \"self_objects\":4, \"self_GB_being_written\":2.2, \"self_objects_being_written\":2}"; test/main.cpp:272:- int rv = lotman_update_lot_usage(bad_usage_update_JSON, deltaMode, &err_msg); test/main.cpp:273:- ASSERT_FALSE(rv == 0); test/main.cpp:274:- free(err_msg); test/main.cpp:275:- test/main.cpp:276:- char *err_msg2; test/main.cpp:277:- const char *bad_usage_query_JSON = "{\"lot_name\":\"non_existent_lot\", \"dedicated_GB\": true, \"opportunistic_GB\": true, \"total_GB\": true}"; test/main.cpp:278:- char *output; test/main.cpp:279:- rv = lotman_get_lot_usage(bad_usage_query_JSON, &output, &err_msg2); test/main.cpp:280:- ASSERT_FALSE(rv == 0); test/main.cpp:281:- free(err_msg2); test/main.cpp:282:- test/main.cpp:283:- // Update by lot test/main.cpp:284:- char *err_msg3; test/main.cpp:285:- const char *usage1_update_JSON = "{\"lot_name\":\"lot4\", \"self_GB\":10.5, \"self_objects\":4, \"self_GB_being_written\":2.2, \"self_objects_being_written\":2}"; test/main.cpp:286:- rv = lotman_update_lot_usage(usage1_update_JSON, deltaMode, &err_msg3); test/main.cpp:287:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:288:- test/main.cpp:289:- const char *usage2_update_JSON = "{\"lot_name\":\"lot5\",\"self_GB\":3.5, \"self_objects\":7, \"self_GB_being_written\":1.2, \"self_objects_being_written\":5}"; test/main.cpp:290:- rv = lotman_update_lot_usage(usage2_update_JSON, deltaMode, &err_msg3); test/main.cpp:291:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:292:- test/main.cpp:293:- const char *usage_query_JSON = "{\"lot_name\":\"lot5\", \"dedicated_GB\": true, \"opportunistic_GB\": true, \"total_GB\": true}"; test/main.cpp:294:- rv = lotman_get_lot_usage(usage_query_JSON, &output, &err_msg3); test/main.cpp:295:- ASSERT_TRUE(rv == 0) << err_msg3; test/main.cpp:296:- test/main.cpp:297:- json json_out = json::parse(output); test/main.cpp:298:- ASSERT_TRUE(json_out["dedicated_GB"]["children_contrib"] == 6.5 && json_out["dedicated_GB"]["self_contrib"] == 3.5 && json_out["dedicated_GB"]["total"] == 10 && test/main.cpp:299:- json_out["opportunistic_GB"]["children_contrib"] == 3.5 && json_out["opportunistic_GB"]["self_contrib"] == 0 && json_out["opportunistic_GB"]["total"] == 3.5 && test/main.cpp:300:- json_out["total_GB"]["children_contrib"] == 10.5 && json_out["total_GB"]["self_contrib"] == 3.5); test/main.cpp:301:- test/main.cpp:302:- free(output); test/main.cpp:303:- test/main.cpp:304:- // Update by dir -- This ends up updating default, lot1 and lot4 test/main.cpp:305:- const char *update_JSON_str = "[{\"includes_subdirs\": true,\"num_obj\": 40,\"path\": \"/1/2/3\",\"size_GB\": 5.12,\"subdirs\": [{\"includes_subdirs\": true,\"num_obj\": 6,\"path\": \"4\",\"size_GB\": 3.14,\"subdirs\": [{\"includes_subdirs\": false,\"num_obj\": 0,\"path\": \"5\",\"size_GB\": 1.6,\"subdirs\": []}]},{\"includes_subdirs\": false,\"num_obj\": 0,\"path\": \"5/6\",\"size_GB\": 0.5,\"subdirs\": []},{\"includes_subdirs\": false,\"num_obj\": 0,\"path\": \"6\",\"size_GB\": 0.25,\"subdirs\": []}]},{\"includes_subdirs\": true,\"num_obj\": 6,\"path\": \"foo/bar\",\"size_GB\": 9.153,\"subdirs\": [{\"includes_subdirs\": true,\"num_obj\": 0,\"path\": \"baz\",\"size_GB\": 5.35,\"subdirs\": [{\"includes_subdirs\": false,\"num_obj\": 0,\"path\": \"more_more_files\",\"size_GB\": 2.2,\"subdirs\": []}]}]}]"; test/main.cpp:306:- rv = lotman_update_lot_usage_by_dir(update_JSON_str, deltaMode, &err_
Run linters: test/main.cpp#L358
[lint] reported by reviewdog 🐶 Raw Output: test/main.cpp:358:- TEST_F(LotManTest, GetOwnersTest) { test/main.cpp:359:- // Try with a lot that doesn't exist test/main.cpp:360:- char *err_msg; test/main.cpp:361:- const char *non_existent_lot = "non_existent_lot"; test/main.cpp:362:- const bool recursive = true; test/main.cpp:363:- char **output; test/main.cpp:364:- int rv = lotman_get_owners(non_existent_lot, recursive, &output, &err_msg); test/main.cpp:365:- ASSERT_FALSE(rv == 0); test/main.cpp:366:- free(err_msg); test/main.cpp:367:- test/main.cpp:368:- char *err_msg2; test/main.cpp:369:- const char *lot_name = "lot4"; test/main.cpp:370:- rv = lotman_get_owners(lot_name, recursive, &output, &err_msg2); test/main.cpp:371:- ASSERT_TRUE(rv == 0); test/main.cpp:372:- for (int iter = 0; output[iter]; iter++) { test/main.cpp:373:- ASSERT_TRUE(static_cast<std::string>(output[iter]) == "owner1" || static_cast<std::string>(output[iter]) == "not owner1"); test/main.cpp:374:- } test/main.cpp:375:- lotman_free_string_list(output); test/main.cpp:376:- } test/main.cpp:494:+TEST_F(LotManTest, GetOwnersTest) { test/main.cpp:495:+ // Try with a lot that doesn't exist test/main.cpp:496:+ char *err_msg; test/main.cpp:497:+ const char *non_existent_lot = "non_existent_lot"; test/main.cpp:498:+ const bool recursive = true; test/main.cpp:499:+ char **output; test/main.cpp:500:+ int rv = lotman_get_owners(non_existent_lot, recursive, &output, &err_msg); test/main.cpp:501:+ ASSERT_FALSE(rv == 0); test/main.cpp:502:+ free(err_msg); test/main.cpp:503:+ test/main.cpp:504:+ char *err_msg2; test/main.cpp:505:+ const char *lot_name = "lot4"; test/main.cpp:506:+ rv = lotman_get_owners(lot_name, recursive, &output, &err_msg2); test/main.cpp:507:+ ASSERT_TRUE(rv == 0); test/main.cpp:508:+ for (int iter = 0; output[iter]; iter++) { test/main.cpp:509:+ ASSERT_TRUE(static_cast<std::string>(output[iter]) == "owner1" || test/main.cpp:510:+ static_cast<std::string>(output[iter]) == "not owner1"); test/main.cpp:511:+ } test/main.cpp:512:+ lotman_free_string_list(output); test/main.cpp:513:+}