Skip to content

Commit f627f4c

Browse files
committed
tests: t/160-disable-init-by-lua.t: hardened test suite to prevent false positives.
The test cases was not testing the result of the `nginx -t/-T/reopen` commands, and was thus not catching the segfault regression fixed by 055bb17, only that the string `run init_by_lua` was not present. We avoid testing the exit code due to incompatibilities between Lua versions in the os.execute/io.popen APIs.
1 parent 055bb17 commit f627f4c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

t/160-disable-init-by-lua.t

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use Test::Nginx::Socket::Lua;
22

33
repeat_each(2);
44

5-
plan tests => repeat_each() * (blocks() * 2);
5+
plan tests => repeat_each() * (blocks() * 3);
66

77
$ENV{TEST_NGINX_HTML_DIR} ||= html_dir();
88

@@ -57,6 +57,7 @@ add_block_preprocessor(sub {
5757
}
5858
});
5959

60+
env_to_nginx("PATH");
6061
log_level("warn");
6162
no_long_string();
6263
run_tests();
@@ -86,6 +87,8 @@ __DATA__
8687
end
8788
}
8889
}
90+
--- error_log
91+
failed (2: No such file or directory)
8992
--- no_error_log eval
9093
qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
9194
@@ -129,6 +132,8 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
129132
end
130133
}
131134
}
135+
--- error_log
136+
test is successful
132137
--- no_error_log eval
133138
qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
134139
@@ -183,5 +188,7 @@ qr/\[error\] .*? init_by_lua:\d+: run init_by_lua/
183188
end
184189
}
185190
}
191+
--- error_log
192+
test is successful
186193
--- no_error_log eval
187194
qr/\[error\] .*? init_by_lua:\d+: run init_by_lua with lua_shared_dict/

0 commit comments

Comments
 (0)