summaryrefslogtreecommitdiffstats
path: root/reg-tests/connection/reverse_server.vtc
blob: 50fe8ceb8025af909d72377e8e9d2fad808f1bdb (plain)
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
varnishtest "Reverse server test"
feature ignore_unknown_macro

#REQUIRE_VERSION=2.9

barrier b1 cond 2

haproxy h_edge -conf {
global
	expose-experimental-directives

defaults
	log global
	timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
	timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
	timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
	mode http

frontend pub
	bind "fd@${pub}"
	use_backend be-reverse

backend be-reverse
	server dev rhttp@

frontend priv
	bind "fd@${priv}" proto h2
	tcp-request session attach-srv be-reverse/dev
} -start

# Run a client through public endpoint
# Reverse server has no connection available thus a 503 is expected
client c1 -connect ${h_edge_pub_sock} {
	txreq -url "/"
	rxresp
	expect resp.status == 503
} -run

# Run a client through private endpoint
# Connection will be attached to the reverse server
client c_dev -connect ${h_edge_priv_sock} {
	txpri

	stream 0 {
		txsettings
		rxsettings
		txsettings -ack
		rxsettings
		expect settings.ack == true
	} -run

	barrier b1 sync
	stream 1 {
		rxhdrs
	} -run

	sendhex "000004 01 05 00000001 88 5c 01 30"
} -start

# Wait for dev client to be ready to process connection
barrier b1 sync

# Run a client through public endpoint
# Reverse server should now be able to proceed with the request
client c2 -connect ${h_edge_pub_sock} {
	txreq -url "/"
	rxresp
	expect resp.status == 200
} -run