You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by li...@apache.org on 2016/09/22 01:42:43 UTC
[2/2] incubator-hawq git commit: HAWQ-1044. Add some error path test
cases for hawq register (TestUsage2Case1ErrorEncoding, TestUsage2Case1Bucket0,
TestUsage2Case1IncludeDirectory)
HAWQ-1044. Add some error path test cases for hawq register (TestUsage2Case1ErrorEncoding, TestUsage2Case1Bucket0, TestUsage2Case1IncludeDirectory)
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/01c740d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/01c740d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/01c740d9
Branch: refs/heads/master
Commit: 01c740d960389b1317022c1706712d03ecd2eb18
Parents: c8319de
Author: Chunling Wang <wa...@126.com>
Authored: Wed Sep 21 10:30:47 2016 +0800
Committer: Chunling Wang <wa...@126.com>
Committed: Wed Sep 21 16:32:54 2016 +0800
----------------------------------------------------------------------
.../test_hawq_register_usage2_case1.cpp | 55 ++++++++++++++
.../test_hawq_register_usage2_case2.cpp | 80 ++++++++++----------
.../test_hawq_register_usage2_case3.cpp | 78 ++++++++++---------
.../ManagementTool/usage2case1/bucket0_tpl.yml | 31 ++++++++
.../usage2case1/error_encoding_tpl.yml | 21 +++++
.../usage2case1/includedirectory.yml | 21 +++++
6 files changed, 211 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/test_hawq_register_usage2_case1.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register_usage2_case1.cpp b/src/test/feature/ManagementTool/test_hawq_register_usage2_case1.cpp
index c967bb0..44d2d76 100644
--- a/src/test/feature/ManagementTool/test_hawq_register_usage2_case1.cpp
+++ b/src/test/feature/ManagementTool/test_hawq_register_usage2_case1.cpp
@@ -4,6 +4,7 @@
#include "lib/sql_util.h"
#include "lib/string_util.h"
#include "lib/hdfs_config.h"
+#include "lib/file_replace.h"
#include "test_hawq_register.h"
#include "gtest/gtest.h"
@@ -50,3 +51,57 @@ TEST_F(TestHawqRegister, TestUsage2Case1Expected) {
}
}
+TEST_F(TestHawqRegister, TestUsage2Case1ErrorEncoding) {
+ SQLUtility util;
+ string test_root(util.getTestRootPath());
+ util.execute("create table t(i int) with (appendonly=true, orientation=row) distributed randomly;");
+ util.execute("insert into t select generate_series(1, 100);");
+ util.query("select * from t;", 100);
+ util.execute("create table nt(i int) with (appendonly=true, orientation=row) distributed randomly;");
+ util.execute("insert into nt select generate_series(1, 100);");
+ util.query("select * from nt;", 100);
+ string t_yml(hawq::test::stringFormat("%s/ManagementTool/usage2case1/error_encoding.yml", test_root.c_str()));
+ string t_yml_tpl(hawq::test::stringFormat("%s/ManagementTool/usage2case1/error_encoding_tpl.yml", test_root.c_str()));
+ hawq::test::FileReplace frep;
+ std::unordered_map<std::string, std::string> strs_src_dst;
+ strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
+ strs_src_dst["@TABLE_OID@"]= getTableOid("t");
+ frep.replace(t_yml_tpl, t_yml, strs_src_dst);
+ EXPECT_EQ(1, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c %s testhawqregister_testusage2case1errorencoding.nt", HAWQ_DB, t_yml.c_str())));
+
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml.c_str())));
+ util.execute("drop table t;");
+ util.execute("drop table nt;");
+}
+
+TEST_F(TestHawqRegister, TestUsage2Case1Bucket0) {
+ SQLUtility util;
+ string test_root(util.getTestRootPath());
+ util.execute("create table t(i int) with (appendonly=true, orientation=row) distributed by (i);");
+ util.execute("insert into t select generate_series(1, 100);");
+ util.query("select * from t;", 100);
+ util.execute("create table nt(i int) with (appendonly=true, orientation=row) distributed by (i);");
+ util.execute("insert into nt select generate_series(1, 100);");
+ util.query("select * from nt;", 100);
+ string t_yml(hawq::test::stringFormat("%s/ManagementTool/usage2case1/bucket0.yml", test_root.c_str()));
+ string t_yml_tpl(hawq::test::stringFormat("%s/ManagementTool/usage2case1/bucket0_tpl.yml", test_root.c_str()));
+ hawq::test::FileReplace frep;
+ std::unordered_map<std::string, std::string> strs_src_dst;
+ strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
+ strs_src_dst["@TABLE_OID@"]= getTableOid("t");
+ frep.replace(t_yml_tpl, t_yml, strs_src_dst);
+ EXPECT_EQ(1, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c %s testhawqregister_testusage2case1bucket0.nt", HAWQ_DB, t_yml.c_str())));
+
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml.c_str())));
+ util.execute("drop table t;");
+ util.execute("drop table nt;");
+}
+
+TEST_F(TestHawqRegister, TestUsage2Case1IncludeDirectory) {
+ SQLUtility util;
+ string test_root(util.getTestRootPath());
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hdfs dfs -put -f %s/ManagementTool/usage2case1 %s/", test_root.c_str(), getHdfsLocation().c_str())));
+ string t_yml(hawq::test::stringFormat("%s/ManagementTool/usage2case1/includedirectory.yml", test_root.c_str()));
+ EXPECT_EQ(1, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c %s testhawqregister_testusage2case1includedirectory.nt", HAWQ_DB, t_yml.c_str())));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hdfs dfs -rm -r %s/usage2case1", getHdfsLocation().c_str())));
+}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/test_hawq_register_usage2_case2.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register_usage2_case2.cpp b/src/test/feature/ManagementTool/test_hawq_register_usage2_case2.cpp
index ab0e101..1d0bb4d 100644
--- a/src/test/feature/ManagementTool/test_hawq_register_usage2_case2.cpp
+++ b/src/test/feature/ManagementTool/test_hawq_register_usage2_case2.cpp
@@ -19,49 +19,53 @@ TEST_F(TestHawqRegister, TestUsage2Case2Expected) {
string test_root(util.getTestRootPath());
std::vector<string> create_table_matrix = {"distributed by (i)", "distributed randomly"};
std::vector<string> fmt_matrix = {"row", "parquet"};
+ std::vector<string> option_matrix = {"--force", "-F"};
int suffix=0;
- for (auto & ddl : create_table_matrix) {
- for (auto & fmt : fmt_matrix) {
- suffix++;
- string t_yml_tpl(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_tpl_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- string t_yml_tpl_new(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_tpl_new_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- string t_yml(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- string t_yml_new(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_new_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- auto t = hawq::test::stringFormat("t_usage2_case2_%s", std::to_string(suffix).c_str());
- auto nt = hawq::test::stringFormat("nt_usage2_case2_%s", std::to_string(suffix).c_str());
- util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("drop table if exists %s;", nt.c_str()));
+ for (auto & opt : option_matrix) {
+ suffix = 0;
+ for (auto & ddl : create_table_matrix) {
+ for (auto & fmt : fmt_matrix) {
+ suffix++;
+ string t_yml_tpl(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_tpl_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ string t_yml_tpl_new(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_tpl_new_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ string t_yml(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ string t_yml_new(hawq::test::stringFormat("%s/ManagementTool/usage2case2/t_new_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ auto t = hawq::test::stringFormat("t_usage2_case2_%s", std::to_string(suffix).c_str());
+ auto nt = hawq::test::stringFormat("nt_usage2_case2_%s", std::to_string(suffix).c_str());
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", nt.c_str()));
- // hawq register -d hawq_feature_test -c t_#.yml nt_usage2_case2_#
- util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 100);", t.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 200);", t.c_str()));
- util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 200);
- hawq::test::FileReplace frep;
- std::unordered_map<std::string, std::string> strs_src_dst;
- strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
- strs_src_dst["@TABLE_OID@"]= getTableOid(t);
- frep.replace(t_yml_tpl, t_yml, strs_src_dst);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c %s testhawqregister_testusage2case2expected.%s", HAWQ_DB, t_yml.c_str(), nt.c_str())));
- util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 200);
+ // hawq register -d hawq_feature_test -c t_#.yml nt_usage2_case2_#
+ util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 100);", t.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 200);", t.c_str()));
+ util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 200);
+ hawq::test::FileReplace frep;
+ std::unordered_map<std::string, std::string> strs_src_dst;
+ strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
+ strs_src_dst["@TABLE_OID@"]= getTableOid(t);
+ frep.replace(t_yml_tpl, t_yml, strs_src_dst);
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c %s testhawqregister_testusage2case2expected.%s", HAWQ_DB, t_yml.c_str(), nt.c_str())));
+ util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 200);
- // hawq register --force -d hawq_feature_test -c t_new_#.yml nt_usage2_case2_#
- util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 50);", t.c_str()));
- util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 50);
- strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
- strs_src_dst["@TABLE_OID_OLD@"]= getTableOid(nt);
- strs_src_dst["@TABLE_OID_NEW@"]= getTableOid(t);
- frep.replace(t_yml_tpl_new, t_yml_new, strs_src_dst);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register --force -d %s -c %s testhawqregister_testusage2case2expected.%s", HAWQ_DB, t_yml_new.c_str(), nt.c_str())));
- util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 150);
+ // hawq register --force/-F -d hawq_feature_test -c t_new_#.yml nt_usage2_case2_#
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 50);", t.c_str()));
+ util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 50);
+ strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
+ strs_src_dst["@TABLE_OID_OLD@"]= getTableOid(nt);
+ strs_src_dst["@TABLE_OID_NEW@"]= getTableOid(t);
+ frep.replace(t_yml_tpl_new, t_yml_new, strs_src_dst);
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register %s -d %s -c %s testhawqregister_testusage2case2expected.%s", opt.c_str(), HAWQ_DB, t_yml_new.c_str(), nt.c_str())));
+ util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 150);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml.c_str())));
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml_new.c_str())));
- util.execute(hawq::test::stringFormat("drop table %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("drop table %s;", nt.c_str()));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml.c_str())));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml_new.c_str())));
+ util.execute(hawq::test::stringFormat("drop table %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("drop table %s;", nt.c_str()));
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/test_hawq_register_usage2_case3.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/test_hawq_register_usage2_case3.cpp b/src/test/feature/ManagementTool/test_hawq_register_usage2_case3.cpp
index e2dc613..8037f0f 100644
--- a/src/test/feature/ManagementTool/test_hawq_register_usage2_case3.cpp
+++ b/src/test/feature/ManagementTool/test_hawq_register_usage2_case3.cpp
@@ -19,49 +19,53 @@ TEST_F(TestHawqRegister, TestUsage2Case3Expected) {
string test_root(util.getTestRootPath());
std::vector<string> create_table_matrix = {"distributed by (i)", "distributed randomly"};
std::vector<string> fmt_matrix = {"row", "parquet"};
+ std::vector<string> option_matrix = {"--repair", "-R"};
int suffix=0;
- for (auto & ddl : create_table_matrix) {
- for (auto & fmt : fmt_matrix) {
- suffix++;
- string t_yml_tpl_old(hawq::test::stringFormat("%s/ManagementTool/usage2case3/t_tpl_old_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- string t_yml_old(hawq::test::stringFormat("%s/ManagementTool/usage2case3/t_old_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
- auto t = hawq::test::stringFormat("t_usage2_case3_%s", std::to_string(suffix).c_str());
- auto nt = hawq::test::stringFormat("nt_usage2_case3_%s", std::to_string(suffix).c_str());
- util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("drop table if exists %s;", nt.c_str()));
+ for (auto & opt : option_matrix) {
+ suffix = 0;
+ for (auto & ddl : create_table_matrix) {
+ for (auto & fmt : fmt_matrix) {
+ suffix++;
+ string t_yml_tpl_old(hawq::test::stringFormat("%s/ManagementTool/usage2case3/t_tpl_old_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ string t_yml_old(hawq::test::stringFormat("%s/ManagementTool/usage2case3/t_old_%s.yml", test_root.c_str(), std::to_string(suffix).c_str()));
+ auto t = hawq::test::stringFormat("t_usage2_case3_%s", std::to_string(suffix).c_str());
+ auto nt = hawq::test::stringFormat("nt_usage2_case3_%s", std::to_string(suffix).c_str());
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", nt.c_str()));
- // hawq register -d hawq_feature_test -c t_usage2_case3_#.yml nt_usage2_case3_#, where nt_usage2_case3_# does not exist
- util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 100);", t.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 200);", t.c_str()));
- util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 200);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
- util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 200);
+ // hawq register -d hawq_feature_test -c t_usage2_case3_#.yml nt_usage2_case3_#, where nt_usage2_case3_# does not exist
+ util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(1, 100);", t.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 200);", t.c_str()));
+ util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 200);
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
+ util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 200);
- // hawq register -d hawq_feature_test -c t_usage2_case3_#.yml nt_usage2_case3_#, where nt_usage2_case3_# exists
- util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
- util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 150);", t.c_str()));
- util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 50);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
- util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 250);
+ // hawq register -d hawq_feature_test -c t_usage2_case3_#.yml nt_usage2_case3_#, where nt_usage2_case3_# exists
+ util.execute(hawq::test::stringFormat("drop table if exists %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("create table %s(i int) with (appendonly=true, orientation=%s) %s;", t.c_str(), fmt.c_str(), ddl.c_str()));
+ util.execute(hawq::test::stringFormat("insert into %s select generate_series(101, 150);", t.c_str()));
+ util.query(hawq::test::stringFormat("select * from %s;", t.c_str()), 50);
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq extract -d %s -o t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), t.c_str())));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register -d %s -c t_%s.yml testhawqregister_testusage2case3expected.%s", HAWQ_DB, std::to_string(suffix).c_str(), nt.c_str())));
+ util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 250);
- // hawq register --repair -d hawq_feature_test -c t_old_#.yml nt_usage2_case3_#
- hawq::test::FileReplace frep;
- std::unordered_map<std::string, std::string> strs_src_dst;
- strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
- strs_src_dst["@TABLE_OID@"]= getTableOid(nt);
- frep.replace(t_yml_tpl_old, t_yml_old, strs_src_dst);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register --repair -d %s -c %s testhawqregister_testusage2case3expected.%s", HAWQ_DB, t_yml_old.c_str(), nt.c_str())));
- util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 100);
+ // hawq register --repair/-R -d hawq_feature_test -c t_old_#.yml nt_usage2_case3_#
+ hawq::test::FileReplace frep;
+ std::unordered_map<std::string, std::string> strs_src_dst;
+ strs_src_dst["@DATABASE_OID@"]= getDatabaseOid();
+ strs_src_dst["@TABLE_OID@"]= getTableOid(nt);
+ frep.replace(t_yml_tpl_old, t_yml_old, strs_src_dst);
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("hawq register %s -d %s -c %s testhawqregister_testusage2case3expected.%s", opt.c_str(), HAWQ_DB, t_yml_old.c_str(), nt.c_str())));
+ util.query(hawq::test::stringFormat("select * from %s;", nt.c_str()), 100);
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf t_%s.yml", std::to_string(suffix).c_str())));
- EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml_old.c_str())));
- util.execute(hawq::test::stringFormat("drop table %s;", t.c_str()));
- util.execute(hawq::test::stringFormat("drop table %s;", nt.c_str()));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf t_%s.yml", std::to_string(suffix).c_str())));
+ EXPECT_EQ(0, Command::getCommandStatus(hawq::test::stringFormat("rm -rf %s", t_yml_old.c_str())));
+ util.execute(hawq::test::stringFormat("drop table %s;", t.c_str()));
+ util.execute(hawq::test::stringFormat("drop table %s;", nt.c_str()));
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/usage2case1/bucket0_tpl.yml
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/usage2case1/bucket0_tpl.yml b/src/test/feature/ManagementTool/usage2case1/bucket0_tpl.yml
new file mode 100644
index 0000000..b407317
--- /dev/null
+++ b/src/test/feature/ManagementTool/usage2case1/bucket0_tpl.yml
@@ -0,0 +1,31 @@
+AO_FileLocations:
+ Blocksize: 32768
+ Checksum: false
+ CompressionLevel: 0
+ CompressionType: null
+ Files:
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/1
+ size: 176
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/2
+ size: 168
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/3
+ size: 192
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/4
+ size: 168
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/5
+ size: 192
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/6
+ size: 216
+AO_Schema:
+- name: i
+ type: int4
+Bucketnum: 0
+DBVersion: PostgreSQL 8.2.15 (Greenplum Database 4.2.0 build 1) (HAWQ 2.0.1.0 build
+ dev) on x86_64-apple-darwin14.5.0, compiled by GCC Apple LLVM version 6.1.0 (clang-602.0.53)
+ (based on LLVM 3.6.0svn) compiled on Jul 6 2016 10:22:33
+DFS_URL: hdfs://localhost:8020
+Distribution_Policy: DISTRIBUTED BY (i)
+Encoding: UTF8
+FileFormat: AO
+TableName: public.t
+Version: 1.0.0
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/usage2case1/error_encoding_tpl.yml
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/usage2case1/error_encoding_tpl.yml b/src/test/feature/ManagementTool/usage2case1/error_encoding_tpl.yml
new file mode 100644
index 0000000..52756e1
--- /dev/null
+++ b/src/test/feature/ManagementTool/usage2case1/error_encoding_tpl.yml
@@ -0,0 +1,21 @@
+AO_FileLocations:
+ Blocksize: 32768
+ Checksum: false
+ CompressionLevel: 0
+ CompressionType: null
+ Files:
+ - path: /hawq_default/16385/@DATABASE_OID@/@TABLE_OID@/1
+ size: 1016
+AO_Schema:
+- name: i
+ type: int4
+Bucketnum: 6
+DBVersion: PostgreSQL 8.2.15 (Greenplum Database 4.2.0 build 1) (HAWQ 2.0.1.0 build
+ dev) on x86_64-apple-darwin14.5.0, compiled by GCC Apple LLVM version 6.1.0 (clang-602.0.53)
+ (based on LLVM 3.6.0svn) compiled on Jul 6 2016 10:22:33
+DFS_URL: hdfs://localhost:8020
+Distribution_Policy: DISTRIBUTED RANDOMLY
+Encoding: Unicode
+FileFormat: AO
+TableName: public.t
+Version: 1.0.0
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/01c740d9/src/test/feature/ManagementTool/usage2case1/includedirectory.yml
----------------------------------------------------------------------
diff --git a/src/test/feature/ManagementTool/usage2case1/includedirectory.yml b/src/test/feature/ManagementTool/usage2case1/includedirectory.yml
new file mode 100644
index 0000000..c9f474d
--- /dev/null
+++ b/src/test/feature/ManagementTool/usage2case1/includedirectory.yml
@@ -0,0 +1,21 @@
+AO_FileLocations:
+ Blocksize: 32768
+ Checksum: false
+ CompressionLevel: 0
+ CompressionType: null
+ Files:
+ - path: /usage2case1
+ size: 1016
+AO_Schema:
+- name: i
+ type: int4
+Bucketnum: 6
+DBVersion: PostgreSQL 8.2.15 (Greenplum Database 4.2.0 build 1) (HAWQ 2.0.1.0 build
+ dev) on x86_64-apple-darwin14.5.0, compiled by GCC Apple LLVM version 6.1.0 (clang-602.0.53)
+ (based on LLVM 3.6.0svn) compiled on Jul 6 2016 10:22:33
+DFS_URL: hdfs://localhost:8020
+Distribution_Policy: DISTRIBUTED RANDOMLY
+Encoding: UTF8
+FileFormat: AO
+TableName: public.t
+Version: 1.0.0