summaryrefslogtreecommitdiff
path: root/src/bin/pg_rewind/t/006_options.pl
blob: c3c27e9894cc28a99a7ff0f70f970d24089e514c (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

# Copyright (c) 2021-2022, PostgreSQL Global Development Group

#
# Test checking options of pg_rewind.
#
use strict;
use warnings;
use PostgreSQL::Test::Utils;
use Test::More;

program_help_ok('pg_rewind');
program_version_ok('pg_rewind');
program_options_handling_ok('pg_rewind');

my $primary_pgdata = PostgreSQL::Test::Utils::tempdir;
my $standby_pgdata = PostgreSQL::Test::Utils::tempdir;
command_fails(
	[
		'pg_rewind',       '--debug',
		'--target-pgdata', $primary_pgdata,
		'--source-pgdata', $standby_pgdata,
		'extra_arg1'
	],
	'too many arguments');
command_fails([ 'pg_rewind', '--target-pgdata', $primary_pgdata ],
	'no source specified');
command_fails(
	[
		'pg_rewind',       '--debug',
		'--target-pgdata', $primary_pgdata,
		'--source-pgdata', $standby_pgdata,
		'--source-server', 'incorrect_source'
	],
	'both remote and local sources specified');
command_fails(
	[
		'pg_rewind',       '--debug',
		'--target-pgdata', $primary_pgdata,
		'--source-pgdata', $standby_pgdata,
		'--write-recovery-conf'
	],
	'no local source with --write-recovery-conf');

done_testing();