Skip to content

Commit 59c59ed

Browse files
committed
more tests cleanup
1 parent debdda9 commit 59c59ed

File tree

5 files changed

+18
-43
lines changed

5 files changed

+18
-43
lines changed

contrib/postgres_fdw/t/001_bank_coordinator.pl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ sub count_and_delete_rows
201201

202202
my ($hashes, $hash1, $hash2);
203203
my $stability_errors = 0;
204-
my $stable;
205204

206205
# global txses
207206
$pgb_handle1 = $master->pgbench_async(-n, -c => 5, -T => $seconds, -f => $bank, 'postgres' );

contrib/postgres_fdw/t/002_bank_participant.pl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@
2929

3030
foreach my $node (@shards)
3131
{
32-
$node->safe_psql('postgres', "CREATE EXTENSION postgres_fdw");
33-
$node->safe_psql('postgres', "CREATE TABLE accounts(id integer primary key, amount integer)");
34-
$node->safe_psql('postgres', "CREATE TABLE accounts_local() inherits(accounts)");
35-
$node->safe_psql('postgres', "CREATE TABLE global_transactions(tx_time timestamp)");
36-
$node->safe_psql('postgres', "CREATE TABLE local_transactions(tx_time timestamp)");
32+
$node->safe_psql('postgres', qq[
33+
CREATE EXTENSION postgres_fdw;
34+
CREATE TABLE accounts(id integer primary key, amount integer);
35+
CREATE TABLE accounts_local() inherits(accounts);
36+
CREATE TABLE global_transactions(tx_time timestamp);
37+
CREATE TABLE local_transactions(tx_time timestamp);
38+
]);
3739

3840
foreach my $neighbor (@shards)
3941
{
@@ -42,11 +44,15 @@
4244
my $port = $neighbor->port;
4345
my $host = $neighbor->host;
4446

45-
$node->safe_psql('postgres', "CREATE SERVER shard_$port FOREIGN DATA WRAPPER postgres_fdw options(dbname 'postgres', host '$host', port '$port')");
46-
$node->safe_psql('postgres', "CREATE FOREIGN TABLE accounts_fdw_$port() inherits (accounts) server shard_$port options(table_name 'accounts_local')");
47-
$node->safe_psql('postgres', "CREATE USER MAPPING for stas SERVER shard_$port options (user 'stas')");
47+
$node->safe_psql('postgres', qq[
48+
CREATE SERVER shard_$port FOREIGN DATA WRAPPER postgres_fdw
49+
options(dbname 'postgres', host '$host', port '$port');
50+
CREATE FOREIGN TABLE accounts_fdw_$port() inherits (accounts)
51+
server shard_$port options(table_name 'accounts_local');
52+
CREATE USER MAPPING for stas SERVER shard_$port
53+
options (user 'stas');
54+
]);
4855
}
49-
5056
}
5157

5258
$shard1->psql('postgres', "insert into accounts_local select 2*id-1, 0 from generate_series(1, 10010) as id;");
@@ -73,17 +79,11 @@
7379
sub count_and_delete_rows
7480
{
7581
my ($node, $table) = @_;
76-
my ($rc, $count, $err);
77-
78-
($rc, $count, $err) = $node->psql('postgres',"select count(*) from $table",
79-
on_error_die => 1);
80-
81-
die "count_rows: $err" if ($err ne '');
82-
83-
$node->psql('postgres',"delete from $table", on_error_die => 1);
82+
my $count;
8483

84+
$count = $node->safe_psql('postgres',"select count(*) from $table");
85+
$node->safe_psql('postgres',"delete from $table");
8586
diag($node->name, ": completed $count transactions");
86-
8787
return $count;
8888
}
8989

contrib/postgres_fdw/t/bank.sql

Lines changed: 0 additions & 10 deletions
This file was deleted.

contrib/postgres_fdw/t/bank1.sql

Lines changed: 0 additions & 7 deletions
This file was deleted.

contrib/postgres_fdw/t/bank2.sql

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)