Skip to content

Commit f953f0a

Browse files
committed
test: make ssl/xrpc tests work with OpenResty 1.29.2.4 runtime
t/ssl.t TEST 3 and TEST 5 assert error messages emitted by our own lua-resty-core-tlshandshake patch, whose wording differs between the OpenResty 1.21.x patch and the 1.29.2.4 patch. Detect the running openresty version via 'nginx -v' and assert the exact message for that version instead of a loose regex, so a wrong-message regression is still caught. xrpc downstream/upstream tests assert stream-lua internal buffer-allocation debug logs that changed in stream-lua 0.0.19 (OpenResty 1.29.2.4); exclude them on apisix-runtime only.
1 parent 68c2219 commit f953f0a

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ jobs:
1515
- name: apisix-runtime
1616
script_url: "https://raw.githubusercontent.com/api7/apisix-build-tools/master/build-apisix-runtime.sh"
1717
script_name: "build-apisix-runtime.sh"
18-
exclude_tests: ""
18+
# These assert stream-lua internal buffer-allocation debug logs that
19+
# changed in OpenResty 1.29.2.4 (stream-lua 0.0.19); they still run on
20+
# api7ee-runtime (OR 1.21, stream-lua 0.0.16) for functional coverage.
21+
exclude_tests: "t/stream/xrpc/downstream.t t/stream/xrpc/upstream.t"
1922
- name: api7ee-runtime
2023
script_url: "https://raw.githubusercontent.com/api7/apisix-build-tools/release/api7ee-runtime/build-api7ee-runtime.sh"
2124
script_name: "build-api7ee-runtime.sh"

t/ssl.t

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ log_level('debug');
44
no_root_location();
55
no_long_string();
66

7+
# Error messages emitted by our lua-resty-core-tlshandshake patch were
8+
# reworded in OpenResty 1.29.2.4. Detect the running version once and pick
9+
# the exact expected message, so a wrong-message regression is still caught.
10+
my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx';
11+
my $version = eval { `$nginx_binary -V 2>&1` };
12+
my ($major, $minor) = $version =~ m{openresty/(\d+)\.(\d+)};
13+
my $reworded = ($major > 1 or ($major == 1 and $minor >= 29));
14+
15+
$::err_cert_both_set = $reworded
16+
? "client_cert_path and client_cert cannot both be set"
17+
: "client client_cert_path and client_cert both setting";
18+
$::err_bad_cert_path_type = $reworded
19+
? "bad client_cert_path option type"
20+
: "bad client_cert option type";
21+
722
add_block_preprocessor(sub {
823
my ($block) = @_;
924

@@ -186,8 +201,8 @@ location /t {
186201
}
187202
}
188203
--- error_code: 500
189-
--- error_log
190-
client client_cert_path and client_cert both setting
204+
--- error_log eval
205+
$::err_cert_both_set
191206
192207
193208
@@ -275,5 +290,5 @@ location /t {
275290
}
276291
}
277292
--- error_code: 500
278-
--- error_log
279-
bad client_cert option type
293+
--- error_log eval
294+
$::err_bad_cert_path_type

0 commit comments

Comments
 (0)