|
13 | 13 | use PostgreSQL::Test::Utils;
|
14 | 14 | use Test::More;
|
15 | 15 |
|
| 16 | +# Can be changed to test the other modes. |
| 17 | +my $mode = $ENV{PG_TEST_PG_COMBINEBACKUP_MODE} || '--copy'; |
| 18 | + |
| 19 | +note "testing using mode $mode"; |
| 20 | + |
16 | 21 | # Set up a new database instance.
|
17 | 22 | my $node1 = PostgreSQL::Test::Cluster->new('node1');
|
18 | 23 | $node1->init(has_archiving => 1, allows_streaming => 1);
|
|
79 | 84 |
|
80 | 85 | # Can't combine 2 full backups.
|
81 | 86 | $node1->command_fails_like(
|
82 |
| - [ 'pg_combinebackup', $backup1path, $backup1path, '-o', $resultpath ], |
| 87 | + [ 'pg_combinebackup', $backup1path, $backup1path, '-o', $resultpath, $mode ], |
83 | 88 | qr/is a full backup, but only the first backup should be a full backup/,
|
84 | 89 | "can't combine full backups");
|
85 | 90 |
|
86 | 91 | # Can't combine 2 incremental backups.
|
87 | 92 | $node1->command_fails_like(
|
88 |
| - [ 'pg_combinebackup', $backup2path, $backup2path, '-o', $resultpath ], |
| 93 | + [ 'pg_combinebackup', $backup2path, $backup2path, '-o', $resultpath, $mode ], |
89 | 94 | qr/is an incremental backup, but the first backup should be a full backup/,
|
90 | 95 | "can't combine full backups");
|
91 | 96 |
|
92 | 97 | # Can't combine full backup with an incremental backup from a different system.
|
93 | 98 | $node1->command_fails_like(
|
94 | 99 | [
|
95 | 100 | 'pg_combinebackup', $backup1path, $backupother2path, '-o',
|
96 |
| - $resultpath |
| 101 | + $resultpath, $mode |
97 | 102 | ],
|
98 | 103 | qr/expected system identifier.*but found/,
|
99 | 104 | "can't combine backups from different nodes");
|
|
106 | 111 | $node1->command_fails_like(
|
107 | 112 | [
|
108 | 113 | 'pg_combinebackup', $backup1path, $backup2path, $backup3path,
|
109 |
| - '-o', $resultpath |
| 114 | + '-o', $resultpath, $mode |
110 | 115 | ],
|
111 | 116 | qr/ manifest system identifier is .*, but control file has /,
|
112 | 117 | "can't combine backups with different manifest system identifier ");
|
|
116 | 121 |
|
117 | 122 | # Can't omit a required backup.
|
118 | 123 | $node1->command_fails_like(
|
119 |
| - [ 'pg_combinebackup', $backup1path, $backup3path, '-o', $resultpath ], |
| 124 | + [ 'pg_combinebackup', $backup1path, $backup3path, '-o', $resultpath, $mode ], |
120 | 125 | qr/starts at LSN.*but expected/,
|
121 | 126 | "can't omit a required backup");
|
122 | 127 |
|
123 | 128 | # Can't combine backups in the wrong order.
|
124 | 129 | $node1->command_fails_like(
|
125 | 130 | [
|
126 | 131 | 'pg_combinebackup', $backup1path, $backup3path, $backup2path,
|
127 |
| - '-o', $resultpath |
| 132 | + '-o', $resultpath, $mode |
128 | 133 | ],
|
129 | 134 | qr/starts at LSN.*but expected/,
|
130 | 135 | "can't combine backups in the wrong order");
|
|
133 | 138 | $node1->command_ok(
|
134 | 139 | [
|
135 | 140 | 'pg_combinebackup', $backup1path, $backup2path, $backup3path,
|
136 |
| - '-o', $resultpath |
| 141 | + '-o', $resultpath, $mode |
137 | 142 | ],
|
138 | 143 | "can combine 3 matching backups");
|
139 | 144 | rmtree($resultpath);
|
|
143 | 148 | $node1->command_ok(
|
144 | 149 | [
|
145 | 150 | 'pg_combinebackup', $backup1path, $backup2path, '-o',
|
146 |
| - $synthetic12path |
| 151 | + $synthetic12path, $mode |
147 | 152 | ],
|
148 | 153 | "can combine 2 matching backups");
|
149 | 154 |
|
150 | 155 | # Can combine result of previous step with second incremental.
|
151 | 156 | $node1->command_ok(
|
152 |
| - [ 'pg_combinebackup', $synthetic12path, $backup3path, '-o', $resultpath ], |
| 157 | + [ 'pg_combinebackup', $synthetic12path, $backup3path, '-o', $resultpath, $mode ], |
153 | 158 | "can combine synthetic backup with later incremental");
|
154 | 159 | rmtree($resultpath);
|
155 | 160 |
|
156 | 161 | # Can't combine result of 1+2 with 2.
|
157 | 162 | $node1->command_fails_like(
|
158 |
| - [ 'pg_combinebackup', $synthetic12path, $backup2path, '-o', $resultpath ], |
| 163 | + [ 'pg_combinebackup', $synthetic12path, $backup2path, '-o', $resultpath, $mode ], |
159 | 164 | qr/starts at LSN.*but expected/,
|
160 | 165 | "can't combine synthetic backup with included incremental");
|
161 | 166 |
|
|
0 commit comments