From 0e7ffe11fcca9e59bf490607a103146f9aa1d953 Mon Sep 17 00:00:00 2001 From: yiyun-sj Date: Wed, 1 May 2024 17:14:37 -0400 Subject: [PATCH 1/3] fix old test and change regex handling --- test/test_files/copy/export_import_db.test | 4 ++-- test/test_runner/test_runner.cpp | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/test/test_files/copy/export_import_db.test b/test/test_files/copy/export_import_db.test index 97c4147a88..69d82cf7ea 100644 --- a/test/test_files/copy/export_import_db.test +++ b/test/test_files/copy/export_import_db.test @@ -88,8 +88,8 @@ Binder exception: Directory ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db5 does not -REMOVE_FILE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher" -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. +---- error +Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher does not exist. -CASE ExportImportDatabaseRelGroup diff --git a/test/test_runner/test_runner.cpp b/test/test_runner/test_runner.cpp index 8d24888a79..05f601e57e 100644 --- a/test/test_runner/test_runner.cpp +++ b/test/test_runner/test_runner.cpp @@ -102,15 +102,9 @@ bool TestRunner::checkLogicalPlan(std::unique_ptr& 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()) { From d7b17557cfeda9d835b06cc969226a30c4f735c3 Mon Sep 17 00:00:00 2001 From: yiyun-sj Date: Wed, 1 May 2024 18:19:02 -0400 Subject: [PATCH 2/3] change testcase to regex --- test/test_files/copy/export_import_db.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_files/copy/export_import_db.test b/test/test_files/copy/export_import_db.test index 69d82cf7ea..22cd259f6d 100644 --- a/test/test_files/copy/export_import_db.test +++ b/test/test_files/copy/export_import_db.test @@ -88,8 +88,8 @@ Binder exception: Directory ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db5 does not -REMOVE_FILE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher" -IMPORT_DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4" -STATEMENT IMPORT DATABASE "${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4" ----- error -Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4/schema.cypher does not exist. +---- error(regex) +^Binder exception: File ${KUZU_EXPORT_DB_DIRECTORY}_case4/demo-db4[/\\]schema.cypher does not exist.$ -CASE ExportImportDatabaseRelGroup From 679ac4977644abbea73962050f662ddba310dfe4 Mon Sep 17 00:00:00 2001 From: yiyun-sj Date: Thu, 2 May 2024 13:35:43 -0400 Subject: [PATCH 3/3] use regex on previously skipped test cases --- test/test_files/tinysnb/exception/insert_delete.test | 5 ++--- test/test_files/update_node/delete_tinysnb.test | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/test_files/tinysnb/exception/insert_delete.test b/test/test_files/tinysnb/exception/insert_delete.test index fbbe0738d9..e537aeb75d 100644 --- a/test/test_files/tinysnb/exception/insert_delete.test +++ b/test/test_files/tinysnb/exception/insert_delete.test @@ -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.$ diff --git a/test/test_files/update_node/delete_tinysnb.test b/test/test_files/update_node/delete_tinysnb.test index 2b6c984642..36a3a895df 100644 --- a/test/test_files/update_node/delete_tinysnb.test +++ b/test/test_files/update_node/delete_tinysnb.test @@ -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.