hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iw...@apache.org
Subject incubator-hawq git commit: HAWQ-909. Add feature test for goh_database with new test framework
Date Tue, 30 Aug 2016 01:45:02 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 48d3e26a3 -> 27022e561


HAWQ-909. Add feature test for goh_database with new test framework


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

Branch: refs/heads/master
Commit: 27022e5611f21d2d8e062cd8fc3181f592fcf27c
Parents: 48d3e26
Author: ivan <iweng@pivotal.io>
Authored: Mon Aug 29 10:59:12 2016 +0800
Committer: ivan <iweng@pivotal.io>
Committed: Tue Aug 30 09:44:30 2016 +0800

----------------------------------------------------------------------
 src/test/feature/ddl/ans/goh_database.ans | 141 +++++++++++++++++++++++++
 src/test/feature/ddl/sql/goh_database.sql |  41 +++++++
 src/test/feature/ddl/sql/init_file        |   5 +
 src/test/feature/ddl/test_database.cpp    |  20 ++++
 4 files changed, 207 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/27022e56/src/test/feature/ddl/ans/goh_database.ans
----------------------------------------------------------------------
diff --git a/src/test/feature/ddl/ans/goh_database.ans b/src/test/feature/ddl/ans/goh_database.ans
new file mode 100644
index 0000000..90e211f
--- /dev/null
+++ b/src/test/feature/ddl/ans/goh_database.ans
@@ -0,0 +1,141 @@
+CREATE DATABASE goh_database;
+CREATE DATABASE
+DROP DATABASE goh_database;
+DROP DATABASE
+-- should be a clean databse
+CREATE DATABASE goh_database1;
+CREATE DATABASE
+\c goh_database1
+You are now connected to database "goh_database1" as user "ivan".
+CREATE TABLE x(c int);
+CREATE TABLE
+INSERT INTO x VALUES(generate_series(1, 10));
+INSERT 0 10
+SELECT * FROM x ORDER BY c;
+ c  
+----
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+(10 rows)
+
+DROP TABLE x;
+DROP TABLE
+\c db_testdatabase_basictest 
+You are now connected to database "db_testdatabase_basictest" as user "ivan".
+-- table should be removed
+CREATE DATABASE goh_database2;
+CREATE DATABASE
+\c goh_database2
+You are now connected to database "goh_database2" as user "ivan".
+CREATE TABLE x(c int);
+CREATE TABLE
+INSERT INTO x VALUES(generate_series(1, 10));
+INSERT 0 10
+SELECT * FROM x ORDER BY c;
+ c  
+----
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+(10 rows)
+
+\c db_testdatabase_basictest 
+You are now connected to database "db_testdatabase_basictest" as user "ivan".
+CREATE TABLESPACE goh_regression_tablespace1 FILESPACE dfs_system;
+CREATE TABLESPACE
+CREATE DATABASE goh_database3 TABLESPACE goh_regression_tablespace1;
+CREATE DATABASE
+\c goh_database3
+You are now connected to database "goh_database3" as user "ivan".
+CREATE TABLE x(c int);
+CREATE TABLE
+INSERT INTO x VALUES(generate_series(1, 10));
+INSERT 0 10
+SELECT * FROM x ORDER BY c;
+ c  
+----
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+(10 rows)
+
+\d x
+ Append-Only Table "public.x"
+ Column |  Type   | Modifiers 
+--------+---------+-----------
+ c      | integer | 
+Compression Type: None
+Compression Level: 0
+Block Size: 32768
+Checksum: f
+Distributed randomly
+
+\c db_testdatabase_basictest 
+You are now connected to database "db_testdatabase_basictest" as user "ivan".
+BEGIN;
+BEGIN
+CREATE TABLESPACE goh_regression_tablespace2 FILESPACE dfs_system;
+CREATE TABLESPACE
+CREATE TABLE x(c int) TABLESPACE goh_regression_tablespace2;
+CREATE TABLE
+INSERT INTO x VALUES(generate_series(1, 10));
+INSERT 0 10
+SELECT * FROM x ORDER BY c;
+ c  
+----
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+ 10
+(10 rows)
+
+\d x
+ Append-Only Table "public.x"
+ Column |  Type   | Modifiers 
+--------+---------+-----------
+ c      | integer | 
+Compression Type: None
+Compression Level: 0
+Block Size: 32768
+Checksum: f
+Distributed randomly
+Tablespace: "goh_regression_tablespace2"
+
+ROLLBACK;
+ROLLBACK
+DROP DATABASE goh_database1;
+DROP DATABASE
+DROP DATABASE goh_database2;
+DROP DATABASE
+DROP DATABASE goh_database3;
+DROP DATABASE
+DROP TABLESPACE goh_regression_tablespace1;
+DROP TABLESPACE

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/27022e56/src/test/feature/ddl/sql/goh_database.sql
----------------------------------------------------------------------
diff --git a/src/test/feature/ddl/sql/goh_database.sql b/src/test/feature/ddl/sql/goh_database.sql
new file mode 100644
index 0000000..1e8ccec
--- /dev/null
+++ b/src/test/feature/ddl/sql/goh_database.sql
@@ -0,0 +1,41 @@
+CREATE DATABASE goh_database;
+DROP DATABASE goh_database;
+
+-- should be a clean databse
+CREATE DATABASE goh_database1;
+\c goh_database1
+CREATE TABLE x(c int);
+INSERT INTO x VALUES(generate_series(1, 10));
+SELECT * FROM x ORDER BY c;
+DROP TABLE x;
+\c db_testdatabase_basictest 
+
+-- table should be removed
+CREATE DATABASE goh_database2;
+\c goh_database2
+CREATE TABLE x(c int);
+INSERT INTO x VALUES(generate_series(1, 10));
+SELECT * FROM x ORDER BY c;
+\c db_testdatabase_basictest 
+
+CREATE TABLESPACE goh_regression_tablespace1 FILESPACE dfs_system;
+CREATE DATABASE goh_database3 TABLESPACE goh_regression_tablespace1;
+\c goh_database3
+CREATE TABLE x(c int);
+INSERT INTO x VALUES(generate_series(1, 10));
+SELECT * FROM x ORDER BY c;
+\d x
+\c db_testdatabase_basictest 
+
+BEGIN;
+CREATE TABLESPACE goh_regression_tablespace2 FILESPACE dfs_system;
+CREATE TABLE x(c int) TABLESPACE goh_regression_tablespace2;
+INSERT INTO x VALUES(generate_series(1, 10));
+SELECT * FROM x ORDER BY c;
+\d x
+ROLLBACK;
+
+DROP DATABASE goh_database1;
+DROP DATABASE goh_database2;
+DROP DATABASE goh_database3;
+DROP TABLESPACE goh_regression_tablespace1;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/27022e56/src/test/feature/ddl/sql/init_file
----------------------------------------------------------------------
diff --git a/src/test/feature/ddl/sql/init_file b/src/test/feature/ddl/sql/init_file
new file mode 100644
index 0000000..48c1804
--- /dev/null
+++ b/src/test/feature/ddl/sql/init_file
@@ -0,0 +1,5 @@
+-- start_matchignore
+m/You are now connected to database*/
+
+
+-- end_matchignore

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/27022e56/src/test/feature/ddl/test_database.cpp
----------------------------------------------------------------------
diff --git a/src/test/feature/ddl/test_database.cpp b/src/test/feature/ddl/test_database.cpp
new file mode 100644
index 0000000..0aac5c9
--- /dev/null
+++ b/src/test/feature/ddl/test_database.cpp
@@ -0,0 +1,20 @@
+#include "gtest/gtest.h"
+
+#include "lib/sql_util.h"
+
+using std::string;
+
+class TestDatabase: public ::testing::Test
+{
+	public:
+		TestDatabase() { }
+		~TestDatabase() {}
+};
+
+TEST_F(TestDatabase, BasicTest)
+{
+	hawq::test::SQLUtility util(hawq::test::MODE_DATABASE);
+	util.execSQLFile("ddl/sql/goh_database.sql",
+	                 "ddl/ans/goh_database.ans",
+                     "ddl/sql/init_file");
+}


Mime
View raw message