Make tests platform independent

- Force all platforms to use the same collation
- Force all platforms to use the same locale
- Use /dev/null or NUL, depending on platform
- Use /tmp or %TEMP%, dpeending on platform
pull/2056/head^2
Brian Cloutier 2018-02-22 11:28:45 -08:00 committed by Brian Cloutier
parent 2140b5d82d
commit 9aff4384a1
9 changed files with 43 additions and 27 deletions

View File

@ -52,7 +52,8 @@ CREATE OPERATOR citus_mx_test_schema.=== (
HASHES, MERGES
);
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
SELECT quote_ident(current_setting('lc_collate')) as current_locale \gset
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);
CREATE TYPE order_side_mx AS ENUM ('buy', 'sell');
-- now create required stuff in the worker 1
@ -95,7 +96,7 @@ CREATE OPERATOR citus_mx_test_schema.=== (
HASHES, MERGES
);
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
SET search_path TO public;
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);
CREATE TYPE order_side_mx AS ENUM ('buy', 'sell');
@ -139,7 +140,7 @@ CREATE OPERATOR citus_mx_test_schema.=== (
HASHES, MERGES
);
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
SET search_path TO public;
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);
CREATE TYPE order_side_mx AS ENUM ('buy', 'sell');

View File

@ -443,13 +443,14 @@ SELECT * FROM nation_hash;
--test COLLATION with schema
SET search_path TO public;
CREATE COLLATION test_schema_support.english FROM "en_US";
SELECT quote_ident(current_setting('lc_collate')) as current_locale \gset
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
-- create COLLATION in worker node 1 in schema
\c - - - :worker_1_port
CREATE COLLATION test_schema_support.english FROM "en_US";
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
-- create COLLATION in worker node 2 in schema
\c - - - :worker_2_port
CREATE COLLATION test_schema_support.english FROM "en_US";
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
\c - - - :master_port
CREATE TABLE test_schema_support.nation_hash_collation(
n_nationkey integer not null,

View File

@ -132,7 +132,7 @@ COPY (
-- check copying to file
-- (quiet off to force number of copied records to be displayed)
\set QUIET off
COPY nation TO '/dev/null';
COPY nation TO :'dev_null';
COPY 25
\set QUIET on
-- stdout

View File

@ -482,8 +482,8 @@ CREATE TABLE packed_numbers_hash (
SELECT master_create_distributed_table('packed_numbers_hash', 'id', 'hash');
SELECT master_create_worker_shards('packed_numbers_hash', 4, 1);
COPY (SELECT 1, ARRAY[ROW(42, 42), ROW(42, 42)]) TO '/tmp/copy_test_array_of_composite';
COPY packed_numbers_hash FROM '/tmp/copy_test_array_of_composite';
COPY (SELECT 1, ARRAY[ROW(42, 42), ROW(42, 42)]) TO :'temp_dir''copy_test_array_of_composite';
COPY packed_numbers_hash FROM :'temp_dir''copy_test_array_of_composite';
-- Verify data is actually copied
SELECT * FROM packed_numbers_hash;
@ -497,8 +497,8 @@ CREATE TABLE super_packed_numbers_hash (
SELECT master_create_distributed_table('super_packed_numbers_hash', 'id', 'hash');
SELECT master_create_worker_shards('super_packed_numbers_hash', 4, 1);
COPY (SELECT 1, ROW(ROW(42, 42), ROW(42, 42))) TO '/tmp/copy_test_composite_of_composite';
COPY super_packed_numbers_hash FROM '/tmp/copy_test_composite_of_composite';
COPY (SELECT 1, ROW(ROW(42, 42), ROW(42, 42))) TO :'temp_dir''copy_test_composite_of_composite';
COPY super_packed_numbers_hash FROM :'temp_dir''copy_test_composite_of_composite';
-- Verify data is actually copied
SELECT * FROM super_packed_numbers_hash;
@ -510,7 +510,7 @@ CREATE TABLE packed_numbers_append (
);
SELECT master_create_distributed_table('packed_numbers_append', 'id', 'append');
COPY packed_numbers_append FROM '/tmp/copy_test_array_of_composite';
COPY packed_numbers_append FROM :'temp_dir''copy_test_array_of_composite';
-- Verify data is actually copied
SELECT * FROM packed_numbers_append;
@ -523,7 +523,7 @@ CREATE TABLE super_packed_numbers_append (
);
SELECT master_create_distributed_table('super_packed_numbers_append', 'id', 'append');
COPY super_packed_numbers_append FROM '/tmp/copy_test_composite_of_composite';
COPY super_packed_numbers_append FROM :'temp_dir''copy_test_composite_of_composite';
-- Verify data is actually copied
SELECT * FROM super_packed_numbers_append;

View File

@ -614,8 +614,8 @@ SELECT master_create_worker_shards('packed_numbers_hash', 4, 1);
(1 row)
COPY (SELECT 1, ARRAY[ROW(42, 42), ROW(42, 42)]) TO '/tmp/copy_test_array_of_composite';
COPY packed_numbers_hash FROM '/tmp/copy_test_array_of_composite';
COPY (SELECT 1, ARRAY[ROW(42, 42), ROW(42, 42)]) TO :'temp_dir''copy_test_array_of_composite';
COPY packed_numbers_hash FROM :'temp_dir''copy_test_array_of_composite';
-- Verify data is actually copied
SELECT * FROM packed_numbers_hash;
id | packed_numbers
@ -640,8 +640,8 @@ SELECT master_create_worker_shards('super_packed_numbers_hash', 4, 1);
(1 row)
COPY (SELECT 1, ROW(ROW(42, 42), ROW(42, 42))) TO '/tmp/copy_test_composite_of_composite';
COPY super_packed_numbers_hash FROM '/tmp/copy_test_composite_of_composite';
COPY (SELECT 1, ROW(ROW(42, 42), ROW(42, 42))) TO :'temp_dir''copy_test_composite_of_composite';
COPY super_packed_numbers_hash FROM :'temp_dir''copy_test_composite_of_composite';
-- Verify data is actually copied
SELECT * FROM super_packed_numbers_hash;
id | super_packed_number
@ -660,7 +660,7 @@ SELECT master_create_distributed_table('packed_numbers_append', 'id', 'append');
(1 row)
COPY packed_numbers_append FROM '/tmp/copy_test_array_of_composite';
COPY packed_numbers_append FROM :'temp_dir''copy_test_array_of_composite';
-- Verify data is actually copied
SELECT * FROM packed_numbers_append;
id | packed_numbers
@ -679,7 +679,7 @@ SELECT master_create_distributed_table('super_packed_numbers_append', 'id', 'app
(1 row)
COPY super_packed_numbers_append FROM '/tmp/copy_test_composite_of_composite';
COPY super_packed_numbers_append FROM :'temp_dir''copy_test_composite_of_composite';
-- Verify data is actually copied
SELECT * FROM super_packed_numbers_append;
id | super_packed_number

View File

@ -377,6 +377,18 @@ for my $workeroff (0 .. $#followerWorkerPorts)
print $fh "--variable=follower_worker_".($workeroff+1)."_port=$port ";
}
if ($usingWindows)
{
print $fh "--variable=dev_null=\"/nul\" ";
print $fh "--variable=temp_dir=\"%TEMP%\\\"";
}
else
{
print $fh "--variable=dev_null=\"/dev/null\" ";
print $fh "--variable=temp_dir=\"/tmp/\"";
}
if ($usingWindows)
{
print $fh "%*\n"; # pass on the commandline arguments
@ -399,7 +411,7 @@ if ($followercluster)
make_path(catfile('tmp_check', 'master-follower', 'log')) or die "Could not create follower directory";
for my $port (@followerWorkerPorts)
{
make_path(catfile("tmp_check", "follower.$port", "log")) == 0
make_path(catfile("tmp_check", "follower.$port", "log"))
or die "Could not create worker directory";
}
}

View File

@ -50,7 +50,8 @@ CREATE OPERATOR citus_mx_test_schema.=== (
);
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
SELECT quote_ident(current_setting('lc_collate')) as current_locale \gset
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);
CREATE TYPE order_side_mx AS ENUM ('buy', 'sell');
@ -101,7 +102,7 @@ CREATE OPERATOR citus_mx_test_schema.=== (
);
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
SET search_path TO public;
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);
@ -155,7 +156,7 @@ CREATE OPERATOR citus_mx_test_schema.=== (
SET search_path TO public;
CREATE COLLATION citus_mx_test_schema.english FROM "en_US";
CREATE COLLATION citus_mx_test_schema.english (LOCALE=:current_locale);
SET search_path TO public;
CREATE TYPE citus_mx_test_schema.new_composite_type as (key1 text, key2 text);

View File

@ -319,15 +319,16 @@ SELECT * FROM nation_hash;
--test COLLATION with schema
SET search_path TO public;
CREATE COLLATION test_schema_support.english FROM "en_US";
SELECT quote_ident(current_setting('lc_collate')) as current_locale \gset
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
-- create COLLATION in worker node 1 in schema
\c - - - :worker_1_port
CREATE COLLATION test_schema_support.english FROM "en_US";
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
-- create COLLATION in worker node 2 in schema
\c - - - :worker_2_port
CREATE COLLATION test_schema_support.english FROM "en_US";
CREATE COLLATION test_schema_support.english (LOCALE = :current_locale);
\c - - - :master_port

View File

@ -101,7 +101,7 @@ COPY (
-- check copying to file
-- (quiet off to force number of copied records to be displayed)
\set QUIET off
COPY nation TO '/dev/null';
COPY nation TO :'dev_null';
\set QUIET on
-- stdout
COPY nation TO STDOUT;