Skip to content

Commit 401dbba

Browse files
doujiang24agentzh
authored andcommitted
feature: added the --- reload_fails new section to skip checking config_version after HUP reload in the HUp reload testing mode.
We need this to test failures in init_by_lua*.
1 parent ddb1b46 commit 401dbba

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/Test/Nginx/Socket.pm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3316,6 +3316,12 @@ Below is an example from ngx_headers_more module's test suite:
33163316
33173317
Do not attempt to parse the response or run the response related subtests.
33183318
3319+
=head2 reload_fails
3320+
3321+
Allows the NGINX HUP reload fails, which means that the server will still use the previous test block's nginx configuration.
3322+
3323+
This only makes sense in the HUP reload testing mode.
3324+
33193325
=head2 user_files
33203326
33213327
With this section you can create a file that will be copied in the

lib/Test/Nginx/Util.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,12 @@ sub run_test ($) {
15171517
warn "$name\n";
15181518
}
15191519

1520-
test_config_version($name);
1520+
if (defined $block->reload_fails) {
1521+
sleep 0.1;
1522+
1523+
} else {
1524+
test_config_version($name);
1525+
}
15211526

15221527
goto request;
15231528

0 commit comments

Comments
 (0)