summaryrefslogtreecommitdiffstats
path: root/src/bin/pg_verifybackup/t/006_encoding.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_verifybackup/t/006_encoding.pl')
-rw-r--r--src/bin/pg_verifybackup/t/006_encoding.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl
new file mode 100644
index 0000000..210f269
--- /dev/null
+++ b/src/bin/pg_verifybackup/t/006_encoding.pl
@@ -0,0 +1,34 @@
+
+# Copyright (c) 2021-2022, PostgreSQL Global Development Group
+
+# Verify that pg_verifybackup handles hex-encoded filenames correctly.
+
+use strict;
+use warnings;
+use PostgreSQL::Test::Cluster;
+use PostgreSQL::Test::Utils;
+use Test::More;
+
+my $primary = PostgreSQL::Test::Cluster->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',
+ '-cfast', '--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');
+
+done_testing();