Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow fuzzy matching on test result #3432

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_files/copy/export_import_db.test
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Binder exception: Directory ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db5 does not
-IMPORT_DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4"
-STATEMENT IMPORT DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4"
---- error(regex)
Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case3/demo-db4/schema.cypher does not exist.
^Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4[/\\]schema.cypher does not exist.$


-CASE ExportImportDatabaseRelGroup
Expand Down
5 changes: 2 additions & 3 deletions test/test_files/tinysnb/exception/insert_delete.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Runtime exception: Found NULL, which violates the non-null constraint of the pri

# This can produce exception messages with different connected rel table on different platforms.
-CASE DeleteNodeWithEdgeErrorTest
-SKIP
-STATEMENT MATCH (a:person) WHERE a.ID = 0 DELETE a
---- error
Runtime exception: Node(nodeOffset: 0) has connected edges in table studyAt in the fwd direction, which cannot be deleted. Please delete the edges first or try DETACH DELETE.
---- error(regex)
^Runtime exception: Node\(nodeOffset: 0\) has connected edges in table (knows|studyAt|meets|marries) in the fwd direction, which cannot be deleted. Please delete the edges first or try DETACH DELETE.$
5 changes: 2 additions & 3 deletions test/test_files/update_node/delete_tinysnb.test
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@

# This can produce exception messages with different connected rel table on different platforms.
-CASE DeleteNodeWithConnectedRels
-SKIP
-STATEMENT MATCH (a:person {ID: 0}) DELETE a
---- error
Runtime exception: Node(nodeOffset: 0) has connected edges in table studyAt in the fwd direction, which cannot be deleted. Please delete the edges first or try DETACH DELETE.
---- error(regex)
^Runtime exception: Node\(nodeOffset: 0\) has connected edges in table (knows|studyAt|meets|marries) in the fwd direction, which cannot be deleted\. Please delete the edges first or try DETACH DELETE\.$
-STATEMENT MATCH (o:organisation {ID: 6}) DELETE o
---- error
Runtime exception: Node(nodeOffset: 2) has connected edges in table workAt in the bwd direction, which cannot be deleted. Please delete the edges first or try DETACH DELETE.
Expand Down
12 changes: 3 additions & 9 deletions test/test_runner/test_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,9 @@ bool TestRunner::checkLogicalPlan(std::unique_ptr<PreparedStatement>& preparedSt
spdlog::info("EXPECTED ERROR: {}", expectedError);
} else if (statement->expectedErrorRegex) {
std::string expectedError = StringUtils::rtrim(result->getErrorMessage());
std::regex pattern("^.*[\\\\/]+([^\\\\/]+)$");
std::smatch match1;
bool is_match1 = std::regex_match(expectedError, match1, pattern);
std::smatch match2;
bool is_match2 = std::regex_match(statement->errorMessage, match2, pattern);
if (is_match1 && is_match2) {
if (match1[1] == match2[1]) {
return true;
}
std::regex pattern(statement->errorMessage);
if (std::regex_match(expectedError, pattern)) {
return true;
}
spdlog::info("EXPECTED ERROR: {}", expectedError);
} else if (statement->expectedOk && result->isSuccess()) {
Expand Down
Loading