|
86 | 86 | # Now that we have a server that supports replication commands, test whether |
87 | 87 | # certain invalid compression commands fail on the client side with client-side |
88 | 88 | # compression and on the server side with server-side compression. |
89 | | -my $client_fails = 'pg_basebackup: error: '; |
90 | | -my $server_fails = |
91 | | - 'pg_basebackup: error: could not initiate base backup: ERROR: '; |
92 | | -my @compression_failure_tests = ( |
93 | | - [ |
94 | | - 'extrasquishy', |
95 | | - 'unrecognized compression algorithm "extrasquishy"', |
96 | | - 'failure on invalid compression algorithm' |
97 | | - ], |
98 | | - [ |
99 | | - 'gzip:', |
100 | | - 'invalid compression specification: found empty string where a compression option was expected', |
101 | | - 'failure on empty compression options list' |
102 | | - ], |
103 | | - [ |
104 | | - 'gzip:thunk', |
105 | | - 'invalid compression specification: unknown compression option "thunk"', |
106 | | - 'failure on unknown compression option' |
107 | | - ], |
108 | | - [ |
109 | | - 'gzip:level', |
110 | | - 'invalid compression specification: compression option "level" requires a value', |
111 | | - 'failure on missing compression level' |
112 | | - ], |
113 | | - [ |
114 | | - 'gzip:level=', |
115 | | - 'invalid compression specification: value for compression option "level" must be an integer', |
116 | | - 'failure on empty compression level' |
117 | | - ], |
118 | | - [ |
119 | | - 'gzip:level=high', |
120 | | - 'invalid compression specification: value for compression option "level" must be an integer', |
121 | | - 'failure on non-numeric compression level' |
122 | | - ], |
123 | | - [ |
124 | | - 'gzip:level=236', |
125 | | - 'invalid compression specification: compression algorithm "gzip" expects a compression level between 1 and 9', |
126 | | - 'failure on out-of-range compression level' |
127 | | - ], |
128 | | - [ |
129 | | - 'gzip:level=9,', |
130 | | - 'invalid compression specification: found empty string where a compression option was expected', |
131 | | - 'failure on extra, empty compression option' |
132 | | - ], |
133 | | - [ |
134 | | - 'gzip:workers=3', |
135 | | - 'invalid compression specification: compression algorithm "gzip" does not accept a worker count', |
136 | | - 'failure on worker count for gzip' |
137 | | - ],); |
138 | | -for my $cft (@compression_failure_tests) |
| 89 | +SKIP: |
139 | 90 | { |
140 | | - my $cfail = quotemeta($client_fails . $cft->[1]); |
141 | | - my $sfail = quotemeta($server_fails . $cft->[1]); |
142 | | - $node->command_fails_like( |
143 | | - [ 'pg_basebackup', '-D', "$tempdir/backup", '--compress', $cft->[0] ], |
144 | | - qr/$cfail/, |
145 | | - 'client ' . $cft->[2]); |
146 | | - $node->command_fails_like( |
| 91 | + skip "postgres was not built with ZLIB support", 6 |
| 92 | + if (!check_pg_config("#define HAVE_LIBZ 1")); |
| 93 | + |
| 94 | + my $client_fails = 'pg_basebackup: error: '; |
| 95 | + my $server_fails = |
| 96 | + 'pg_basebackup: error: could not initiate base backup: ERROR: '; |
| 97 | + my @compression_failure_tests = ( |
147 | 98 | [ |
148 | | - 'pg_basebackup', '-D', |
149 | | - "$tempdir/backup", '--compress', |
150 | | - 'server-' . $cft->[0] |
| 99 | + 'extrasquishy', |
| 100 | + 'unrecognized compression algorithm "extrasquishy"', |
| 101 | + 'failure on invalid compression algorithm' |
151 | 102 | ], |
152 | | - qr/$sfail/, |
153 | | - 'server ' . $cft->[2]); |
| 103 | + [ |
| 104 | + 'gzip:', |
| 105 | + 'invalid compression specification: found empty string where a compression option was expected', |
| 106 | + 'failure on empty compression options list' |
| 107 | + ], |
| 108 | + [ |
| 109 | + 'gzip:thunk', |
| 110 | + 'invalid compression specification: unknown compression option "thunk"', |
| 111 | + 'failure on unknown compression option' |
| 112 | + ], |
| 113 | + [ |
| 114 | + 'gzip:level', |
| 115 | + 'invalid compression specification: compression option "level" requires a value', |
| 116 | + 'failure on missing compression level' |
| 117 | + ], |
| 118 | + [ |
| 119 | + 'gzip:level=', |
| 120 | + 'invalid compression specification: value for compression option "level" must be an integer', |
| 121 | + 'failure on empty compression level' |
| 122 | + ], |
| 123 | + [ |
| 124 | + 'gzip:level=high', |
| 125 | + 'invalid compression specification: value for compression option "level" must be an integer', |
| 126 | + 'failure on non-numeric compression level' |
| 127 | + ], |
| 128 | + [ |
| 129 | + 'gzip:level=236', |
| 130 | + 'invalid compression specification: compression algorithm "gzip" expects a compression level between 1 and 9', |
| 131 | + 'failure on out-of-range compression level' |
| 132 | + ], |
| 133 | + [ |
| 134 | + 'gzip:level=9,', |
| 135 | + 'invalid compression specification: found empty string where a compression option was expected', |
| 136 | + 'failure on extra, empty compression option' |
| 137 | + ], |
| 138 | + [ |
| 139 | + 'gzip:workers=3', |
| 140 | + 'invalid compression specification: compression algorithm "gzip" does not accept a worker count', |
| 141 | + 'failure on worker count for gzip' |
| 142 | + ],); |
| 143 | + for my $cft (@compression_failure_tests) |
| 144 | + { |
| 145 | + my $cfail = quotemeta($client_fails . $cft->[1]); |
| 146 | + my $sfail = quotemeta($server_fails . $cft->[1]); |
| 147 | + $node->command_fails_like( |
| 148 | + [ |
| 149 | + 'pg_basebackup', '-D', |
| 150 | + "$tempdir/backup", '--compress', |
| 151 | + $cft->[0] |
| 152 | + ], |
| 153 | + qr/$cfail/, |
| 154 | + 'client ' . $cft->[2]); |
| 155 | + $node->command_fails_like( |
| 156 | + [ |
| 157 | + 'pg_basebackup', '-D', |
| 158 | + "$tempdir/backup", '--compress', |
| 159 | + 'server-' . $cft->[0] |
| 160 | + ], |
| 161 | + qr/$sfail/, |
| 162 | + 'server ' . $cft->[2]); |
| 163 | + } |
154 | 164 | } |
155 | 165 |
|
156 | 166 | # Write some files to test that they are not copied. |
|
0 commit comments