blob: ec942e54eee872c56d9a2d2c75af5faba9557b6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# Copyright (c) 2021-2025, PostgreSQL Global Development Group
use strict;
use warnings FATAL => 'all';
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use Test::More;
my $tempdir = PostgreSQL::Test::Utils::tempdir;
# For nearly all pg_basebackup invocations some options should be specified,
# to keep test times reasonable. Using @pg_basebackup_defs as the first
# element of the array passed to IPC::Run interpolate the array (as it is
# not a reference to an array)...
my @pg_basebackup_defs =
('pg_basebackup', '--no-sync', '--checkpoint' => 'fast');
# Set up an instance.
my $node = PostgreSQL::Test::Cluster->new('main');
$node->init(allows_streaming => 1);
$node->start();
# Create an in-place tablespace.
$node->safe_psql('postgres', <<EOM);
SET allow_in_place_tablespaces = on;
CREATE TABLESPACE inplace LOCATION '';
EOM
# Back it up.
my $backupdir = $tempdir . '/backup';
$node->command_ok(
[
@pg_basebackup_defs,
'--pgdata' => $backupdir,
'--format' => 'tar',
'--wal-method' => 'none'
],
'pg_basebackup runs');
# Make sure we got base.tar and one tablespace.
ok(-f "$backupdir/base.tar", 'backup tar was created');
my @tblspc_tars = glob "$backupdir/[0-9]*.tar";
is(scalar(@tblspc_tars), 1, 'one tablespace tar was created');
# All good.
done_testing();
|