unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob dcd81005cc05076069ca6201a55e775fff4158f4 1193 bytes (raw)
$ git show HEAD:t/t9001-oob_gc.sh	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
#!/bin/sh
. ./test-lib.sh
t_plan 9 "OobGC test"

t_begin "setup and start" && {
	unicorn_setup
	unicorn -D -c $unicorn_config oob_gc.ru
	unicorn_wait_start
}

t_begin "test default interval (4 requests)" && {
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "GC starting-request returns immediately" && {
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "GC is started after 5 requests" && {
	test xtrue = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "reset GC" && {
	test xfalse = x$(curl -vsSf -X POST http://$listen/gc_reset 2>> $tmp)
}

t_begin "test default interval again (3 requests)" && {
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "GC is started after 5 requests" && {
	test xtrue = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "killing succeeds" && {
	kill -QUIT $unicorn_pid
}

t_begin "check_stderr" && check_stderr
dbgcat r_err

t_done

git clone https://yhbt.net/unicorn.git