postgresql/src/bin/pg_verifybackup/t/006_encoding.pl
Andrew Dunstan 201a76183e
Unify PostgresNode's new() and get_new_node() methods
There is only one constructor now for PostgresNode, with the idiomatic
name 'new'. The method is not exported by the class, and must be called
as "PostgresNode->new('name',[args])". All the TAP tests that use
PostgresNode are modified accordingly. Third party scripts will need
adjusting, which is a fairly mechanical process (I just used a sed
script).
2021-07-29 05:58:08 -04:00

35 lines
923 B
Perl

# Copyright (c) 2021, PostgreSQL Global Development Group
# Verify that pg_verifybackup handles hex-encoded filenames correctly.
use strict;
use warnings;
use Cwd;
use Config;
use PostgresNode;
use TestLib;
use Test::More tests => 5;
my $primary = PostgresNode->new('primary');
$primary->init(allows_streaming => 1);
$primary->start;
my $backup_path = $primary->backup_dir . '/test_encoding';
$primary->command_ok(
[
'pg_basebackup', '-D',
$backup_path, '--no-sync',
'--manifest-force-encode'
],
"backup ok with forced hex encoding");
my $manifest = slurp_file("$backup_path/backup_manifest");
my $count_of_encoded_path_in_manifest = (() = $manifest =~ /Encoded-Path/mig);
cmp_ok($count_of_encoded_path_in_manifest,
'>', 100, "many paths are encoded in the manifest");
command_like(
[ 'pg_verifybackup', '-s', $backup_path ],
qr/backup successfully verified/,
'backup with forced encoding verified');