Fix regression test 003.failover for rhel7 postgresql rpm
authorYugo Nagata <nagata@sraoss.co.jp>
Wed, 6 Jan 2016 04:13:01 +0000 (13:13 +0900)
committerYugo Nagata <nagata@sraoss.co.jp>
Wed, 6 Jan 2016 04:13:01 +0000 (13:13 +0900)
The expected result of 'show pool_nodes' is fixed to use
PGSOCKET_DIR in hostname column.

test/regression/tests/003.failover/create_expected.sql [new file with mode: 0644]
test/regression/tests/003.failover/expected.r [deleted file]
test/regression/tests/003.failover/expected.s [deleted file]
test/regression/tests/003.failover/test.sh

diff --git a/test/regression/tests/003.failover/create_expected.sql b/test/regression/tests/003.failover/create_expected.sql
new file mode 100644 (file)
index 0000000..e25ebd0
--- /dev/null
@@ -0,0 +1,18 @@
+CREATE TEMP TABLE tmp (
+  node_id text,
+  hostname text,
+  port text,
+  status text,
+  lb_weight text,
+  role text,
+  mode text);
+
+INSERT INTO tmp VALUES
+('0',:dir,'11002','2','0.500000','primary','s'),
+('1',:dir,'11003','3','0.500000','standby','s'),
+('0',:dir,'11002','2','0.500000','master','r'),
+('1',:dir,'11003','3','0.500000','slave','r');
+
+SELECT node_id,hostname,port,status,lb_weight,role
+FROM tmp
+WHERE mode = :mode
diff --git a/test/regression/tests/003.failover/expected.r b/test/regression/tests/003.failover/expected.r
deleted file mode 100644 (file)
index 8a23495..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
- node_id | hostname | port  | status | lb_weight |  role  
----------+----------+-------+--------+-----------+--------
- 0       | /tmp     | 11000 | 2      | 0.500000  | master
- 1       | /tmp     | 11001 | 3      | 0.500000  | slave
-(2 rows)
-
diff --git a/test/regression/tests/003.failover/expected.s b/test/regression/tests/003.failover/expected.s
deleted file mode 100644 (file)
index 5dba922..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
- node_id | hostname | port  | status | lb_weight |  role   
----------+----------+-------+--------+-----------+---------
- 0       | /tmp     | 11000 | 2      | 0.500000  | primary
- 1       | /tmp     | 11001 | 3      | 0.500000  | standby
-(2 rows)
-
index 460394ef020f2b8a3b4a3693c475b948e594c2aa..85ba3fc35da9d76fed9c94db8efb4c385f070c4b 100755 (executable)
@@ -30,7 +30,8 @@ do
        $PSQL -c "show pool_nodes" test > result
 
        # check the output of "show pool_nodes".
-       cmp result ../expected.$mode > /dev/null 2>&1
+       LANG=C $PSQL -f ../create_expected.sql -v mode="'$mode'" -v dir="'$PGSOCKET_DIR'" test | tail -n 6 > expected
+       cmp result expected > /dev/null 2>&1
        if [ $? != 0 ];then
                ./shutdownall
                exit 1