You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by hu...@apache.org on 2016/06/15 05:14:33 UTC
incubator-hawq git commit: HAWQ-816. Redefine semantics of execute
interface of feature test library.
Repository: incubator-hawq
Updated Branches:
refs/heads/master ab5fc167e -> 24a1d0114
HAWQ-816. Redefine semantics of execute interface of feature test library.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/24a1d011
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/24a1d011
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/24a1d011
Branch: refs/heads/master
Commit: 24a1d0114da95eb0f4a86b03b79ca087ae0f7a6d
Parents: ab5fc16
Author: xunzhang <xu...@gmail.com>
Authored: Wed Jun 15 01:56:31 2016 +0800
Committer: Ruilong Huo <rh...@pivotal.io>
Committed: Wed Jun 15 13:15:02 2016 +0800
----------------------------------------------------------------------
src/test/feature/lib/sql_util.cpp | 6 ++++++
src/test/feature/lib/sql_util.h | 10 ++++++++--
src/test/feature/testlib/test_lib.cpp | 2 ++
3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/24a1d011/src/test/feature/lib/sql_util.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/sql_util.cpp b/src/test/feature/lib/sql_util.cpp
index 8f2f208..9537f0c 100644
--- a/src/test/feature/lib/sql_util.cpp
+++ b/src/test/feature/lib/sql_util.cpp
@@ -58,9 +58,15 @@ string SQLUtility::execute(const string &sql, bool check) {
EXPECT_EQ(0, conn->getLastStatus()) << conn->getLastResult();
return "";
}
+ EXPECT_NE(0, conn->getLastStatus());
return conn.get()->getLastResult();
}
+void SQLUtility::executeIgnore(const string &sql) {
+ conn->runSQLCommand("SET SEARCH_PATH=" + schemaName + ";" + sql);
+ EXPECT_NE(conn.get(), nullptr);
+}
+
void SQLUtility::query(const string &sql, int expectNum) {
const hawq::test::PSQLQueryResult &result = executeQuery(sql);
ASSERT_FALSE(result.isError()) << result.getErrorMessage();
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/24a1d011/src/test/feature/lib/sql_util.h
----------------------------------------------------------------------
diff --git a/src/test/feature/lib/sql_util.h b/src/test/feature/lib/sql_util.h
index 48a4c2c..13ad2ec 100644
--- a/src/test/feature/lib/sql_util.h
+++ b/src/test/feature/lib/sql_util.h
@@ -29,18 +29,24 @@ class SQLUtility {
// Execute sql command
// @param sql The given sql command
+ // @param check true(default) if expected correctly executing, false otherwise
// @return error or notice message if check is false, else return empty
std::string execute(const std::string &sql, bool check = true);
+ // Execute sql command and ignore the behavior of its running status
+ // @param sql The given sql command
+ // @return void
+ void executeIgnore(const std::string &sql);
+
// Execute query command and check the rowCount
// @param sql The given query command
- // @expectNum The expected rowCount
+ // @param expectNum The expected rowCount
// @return void
void query(const std::string &sql, int expectNum);
// Execute query command and check query result
// @param sql The given query command
- // @expectStr The given query result
+ // @param expectStr The given query result
// @return void
void query(const std::string &sql, const std::string &expectStr);
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/24a1d011/src/test/feature/testlib/test_lib.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/testlib/test_lib.cpp b/src/test/feature/testlib/test_lib.cpp
index 63ade3e..3b18b11 100644
--- a/src/test/feature/testlib/test_lib.cpp
+++ b/src/test/feature/testlib/test_lib.cpp
@@ -69,6 +69,8 @@ TEST_F(TestCommonLib, TestSqlUtil) {
hawq::test::SQLUtility util;
util.execute("create table test(p int, q float)");
util.execute("insert into test values(1,1.1),(2,2.2)");
+ util.execute("select * from no_exist_table;", false);
+ util.executeIgnore("select * from no_exist_table;");
util.query("select * from test", 2);
util.query("select * from test", "1|1.1|\n2|2.2|\n");
util.execSQLFile("testlib/sql/sample.sql", "testlib/ans/sample.ans");