Skip to content

Commit

Permalink
Work around iRODS generating invalid SQL when coercing AVU values to a
Browse files Browse the repository at this point in the history
numeric form.

Report the operator name in search operator test results.
  • Loading branch information
kjsanger committed Oct 16, 2015
1 parent d40cfdc commit 06e49fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/check_baton.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,29 +1915,29 @@ START_TEST(test_regression_github_issue137) {

for (size_t i = 0; i < 11; i++) {
json_t *avu = json_pack("{s:s, s:s, s:s}",
JSON_ATTRIBUTE_KEY, "attr1000",
JSON_VALUE_KEY, "value1000",
JSON_ATTRIBUTE_KEY, "numattr1",
JSON_VALUE_KEY, "10",
JSON_OPERATOR_KEY, operators[i]);
json_t *query = json_pack("{s:[o]}", JSON_AVUS_KEY, avu);

baton_error_t error;
json_t *results = search_metadata(conn, query, NULL, flags, &error);
ck_assert_int_eq(error.code, 0);
ck_assert_msg(error.code == 0, operators[i]);

json_decref(query);
json_decref(results);
}

// Test 'in' here
json_t *avu = json_pack("{s:s, s:[s], s:s}",
JSON_ATTRIBUTE_KEY, "attr1000",
JSON_VALUE_KEY, "value1000",
JSON_ATTRIBUTE_KEY, "numattr1",
JSON_VALUE_KEY, "10",
JSON_OPERATOR_KEY, "in");
json_t *query = json_pack("{s:[o]}", JSON_AVUS_KEY, avu);

baton_error_t error;
json_t *results = search_metadata(conn, query, NULL, flags, &error);
ck_assert_int_eq(error.code, 0);
ck_assert_msg(error.code == 0, "in");
json_decref(query);
json_decref(results);

Expand Down
4 changes: 4 additions & 0 deletions tests/metadata/meta1.imeta
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ add -d __IRODS_TEST_ROOT__/r1.txt a y
add -d __IRODS_TEST_ROOT__/r1.txt b x
add -d __IRODS_TEST_ROOT__/r1.txt b y
add -d __IRODS_TEST_ROOT__/r1.txt b z

add -d __IRODS_TEST_ROOT__/r1.txt numattr1 1
add -d __IRODS_TEST_ROOT__/r1.txt numattr1 10
add -d __IRODS_TEST_ROOT__/r1.txt numattr1 100

0 comments on commit 06e49fe

Please sign in to comment.