unicorn.git  about / heads / tags
Rack HTTP server for Unix and fast clients
blob d4e795be9be10a4b063df0bdafc894debf6fee85 2458 bytes (raw)
$ git show httpdate-nogvl:t/t9002-oob_gc-path.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 
#!/bin/sh
. ./test-lib.sh
t_plan 12 "OobGC test with limited path"

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

t_begin "test default is noop" && {
	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)
	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)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "4 bad requests to bump counter" && {
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
}

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

t_begin "GC was 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 is noop" && {
	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)
	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)
	test xfalse = x$(curl -vsSf http://$listen/ 2>> $tmp)
}

t_begin "4 bad requests to bump counter" && {
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
	test xfalse = x$(curl -vsSf http://$listen/BAD 2>> $tmp)
}

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

t_begin "GC was 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

t_done

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