Skip to content

Commit 719d423

Browse files
committed
test(*) added code coverage reporting
1 parent 4086ec9 commit 719d423

File tree

6 files changed

+23
-3
lines changed

6 files changed

+23
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
t/servroot/
22
t/error.log
3+
luacov.*

.luacov

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
modules = {
2+
["resty.redis.connector"] = "lib/resty/redis/connector.lua",
3+
["resty.redis.sentinel"] = "lib/resty/redis/sentinel.lua",
4+
}

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ check_ports:
142142

143143
test_redis: flush_db
144144
util/lua-releng
145+
@rm -f luacov.stats.out
145146
$(TEST_REDIS_VARS) $(PROVE) $(TEST_FILE)
147+
@luacov
148+
@tail -7 luacov.report.out
146149

147150
test_leak: flush_db
148151
$(TEST_REDIS_VARS) TEST_NGINX_CHECK_LEAK=1 $(PROVE) $(TEST_FILE)

t/config.t

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ plan tests => repeat_each() * blocks() * 2;
88
my $pwd = cwd();
99

1010
our $HttpConfig = qq{
11-
lua_package_path "$pwd/lib/?.lua;;";
11+
lua_package_path "$pwd/lib/?.lua;;";
12+
13+
init_by_lua_block {
14+
require("luacov.runner").init()
15+
}
1216
};
1317

1418
$ENV{TEST_NGINX_REDIS_PORT} ||= 6379;

t/connector.t

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ use Cwd qw(cwd);
44
my $pwd = cwd();
55

66
our $HttpConfig = qq{
7-
lua_package_path "$pwd/lib/?.lua;;";
7+
lua_package_path "$pwd/lib/?.lua;;";
8+
9+
init_by_lua_block {
10+
require("luacov.runner").init()
11+
}
812
};
913

1014
$ENV{TEST_NGINX_RESOLVER} = '8.8.8.8';

t/sentinel.t

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ plan tests => repeat_each() * (3 * blocks());
66
my $pwd = cwd();
77

88
our $HttpConfig = qq{
9-
lua_package_path "$pwd/lib/?.lua;;";
9+
lua_package_path "$pwd/lib/?.lua;;";
10+
11+
init_by_lua_block {
12+
require("luacov.runner").init()
13+
}
1014
};
1115

1216
$ENV{TEST_NGINX_RESOLVER} = '8.8.8.8';

0 commit comments

Comments
 (0)