Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c70b193

Browse files
committed
[PGPRO-4074] Pgbench routines to PostgresNode
(cherry picked from commit 6d6f53ca5982deaf85ee00e12a9ed5b9d6f4354f) tags: multimaster (cherry picked from commit 3f887be71cc8ad0bafebdfebae880b506b3ea1f7)
1 parent a8dfe41 commit c70b193

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/test/perl/PostgresNode.pm

+31
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,37 @@ sub pg_recvlogical_upto
21362136
}
21372137
}
21382138

2139+
sub pgbench()
2140+
{
2141+
my ($self, $node, @args) = @_;
2142+
my $pgbench_handle = $self->pgbench_async($node, @args);
2143+
$self->pgbench_await($pgbench_handle);
2144+
}
2145+
2146+
sub pgbench_async()
2147+
{
2148+
my ($self, @args) = @_;
2149+
2150+
my ($in, $out, $err, $rc);
2151+
$in = '';
2152+
$out = '';
2153+
2154+
my @pgbench_command = (
2155+
'pgbench',
2156+
-h => $self->host,
2157+
-p => $self->port,
2158+
@args
2159+
);
2160+
my $handle = IPC::Run::start(\@pgbench_command, $in, $out);
2161+
return $handle;
2162+
}
2163+
2164+
sub pgbench_await()
2165+
{
2166+
my ($self, $pgbench_handle) = @_;
2167+
IPC::Run::finish($pgbench_handle) || BAIL_OUT("pgbench exited with $?");
2168+
}
2169+
21392170
=pod
21402171
21412172
=back

0 commit comments

Comments
 (0)