You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wl...@apache.org on 2017/03/15 07:03:13 UTC

incubator-hawq git commit: HAWQ-1359. Remove getRangerHost() function from ranger test, still use environment variable to specify the Ranger Admin.

Repository: incubator-hawq
Updated Branches:
  refs/heads/master e21401257 -> 4eb6f0ab0


HAWQ-1359. Remove getRangerHost() function from ranger test, still use environment variable to specify the Ranger Admin.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/4eb6f0ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/4eb6f0ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/4eb6f0ab

Branch: refs/heads/master
Commit: 4eb6f0ab0d53d477902c4bc329fcf52f617a5142
Parents: e214012
Author: Wen Lin <wl...@pivotal.io>
Authored: Wed Mar 15 14:30:27 2017 +0800
Committer: Wen Lin <wl...@pivotal.io>
Committed: Wed Mar 15 15:02:07 2017 +0800

----------------------------------------------------------------------
 ranger-plugin/.gitignore                |  1 -
 src/test/feature/Ranger/test_ranger.cpp | 14 +-------------
 src/test/feature/Ranger/test_ranger.h   | 10 +++-------
 src/test/feature/lib/sql_util.cpp       |  9 +++------
 4 files changed, 7 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4eb6f0ab/ranger-plugin/.gitignore
----------------------------------------------------------------------
diff --git a/ranger-plugin/.gitignore b/ranger-plugin/.gitignore
index 3ed4d88..9f5b5c2 100644
--- a/ranger-plugin/.gitignore
+++ b/ranger-plugin/.gitignore
@@ -1,3 +1,2 @@
 target/
 Makefile.global
-/bin/

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4eb6f0ab/src/test/feature/Ranger/test_ranger.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/test_ranger.cpp b/src/test/feature/Ranger/test_ranger.cpp
index 0aa61dd..7461d66 100644
--- a/src/test/feature/Ranger/test_ranger.cpp
+++ b/src/test/feature/Ranger/test_ranger.cpp
@@ -34,17 +34,7 @@ using hawq::test::Command;
 TestHawqRanger::TestHawqRanger()
 {
 	initfile = hawq::test::stringFormat("Ranger/sql/init_file");
-	rangerHost = getRangerHost();
-}
-
-std::string& TestHawqRanger::getRangerHost()
-{
-	string cmd = hawq::test::stringFormat("hawq config -s hawq_rps_address_host");
-	string rangerHostStr = Command::getCommandOutput(cmd);
-	rangerHostStr = rangerHostStr.substr(rangerHostStr.find("Value") + 5);
-	rangerHostStr = rangerHostStr.substr(rangerHostStr.find(":") + 1);
-	rangerHostStr = rangerHostStr.substr(rangerHostStr.find_first_not_of(' '));
-	return hawq::test::trimNewLine(rangerHostStr);
+	rangerHost = RANGER_HOST;
 }
 
 TEST_F(TestHawqRanger, BasicTest) {
@@ -56,11 +46,9 @@ TEST_F(TestHawqRanger, BasicTest) {
 		gpdfist.init_gpfdist();
 
 		string rootPath(util.getTestRootPath());
-		string initfile = "Ranger/sql/init_file";
 		auto cmd = hawq::test::stringFormat("ls -l %s/Ranger/sql/normal/*.sql 2>/dev/null | grep \"^-\" | wc -l", rootPath.c_str());
 		int sql_num = std::atoi(Command::getCommandOutput(cmd).c_str());
 		int writableTableCase = 28;
-		string rangerHost = getRangerHost();
 		cmd = hawq::test::stringFormat("cp %s/Ranger/data/copydata.txt /tmp/a.txt", rootPath.c_str());
 		Command::getCommandStatus(cmd);
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4eb6f0ab/src/test/feature/Ranger/test_ranger.h
----------------------------------------------------------------------
diff --git a/src/test/feature/Ranger/test_ranger.h b/src/test/feature/Ranger/test_ranger.h
index 9c1e82c..31283f3 100644
--- a/src/test/feature/Ranger/test_ranger.h
+++ b/src/test/feature/Ranger/test_ranger.h
@@ -29,6 +29,9 @@ public:
 	~TestHawqRanger() {
 	}
 
+	std::string rangerHost;
+	std::string initfile;
+
 	void clearEnv(hawq::test::SQLUtility* util, std::string case_name, int user_index);
 	void runSQLFile(hawq::test::SQLUtility* util, std::string case_name,
 			std::string ans_suffix, int sql_index = -1);
@@ -36,13 +39,6 @@ public:
 	void addPolicy(hawq::test::SQLUtility* util, std::string case_name, int policy_index);
 	void addUser(hawq::test::SQLUtility* util, std::string case_name, int user_index = -1, bool full_policy = false,
 			int writable_index = -1);
-
-	std::string& getRangerHost();
-
-private:
-	std::string rangerHost = "";
-	std::string initfile = "";
-
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/4eb6f0ab/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 7a62ac2..9bb3613 100644
--- a/src/test/feature/lib/sql_util.cpp
+++ b/src/test/feature/lib/sql_util.cpp
@@ -136,9 +136,8 @@ void SQLUtility::query(const string &sql, const string &expectStr) {
 void SQLUtility::execSQLFile(const string &sqlFile,
                              const string &ansFile,
                              const string &initFile,
-							 bool usingDefaultSchema,
-							 bool printTupleOnly) {
-	printf("dd2d%s\n",schemaName.c_str());
+                             bool usingDefaultSchema,
+                             bool printTupleOnly) {
   FilePath fp;
 
   // do precheck for sqlFile & ansFile
@@ -225,10 +224,8 @@ const string SQLUtility::generateSQLFile(const string &sqlFile, bool usingDefaul
     EXPECT_TRUE(false) << "Error opening file " << newSqlFile;
   }
   out << "-- start_ignore" << std::endl;
-  printf("dd2d%s\n",schemaName.c_str());
   if (!usingDefaultSchema) {
-	  printf("ddd%s\n",schemaName.c_str());
-	  out << "SET SEARCH_PATH=" + schemaName + ";" << std::endl;
+      out << "SET SEARCH_PATH=" + schemaName + ";" << std::endl;
   }
   if (sql_util_mode ==  MODE_DATABASE) {
     out << "\\c " << databaseName << std::endl;