summaryrefslogtreecommitdiffstats
path: root/reg-tests/peers/tls_basic_sync_wo_stkt_backend.vtc
blob: 7e1bfd38d889e345714c8603fba111e3fa77e8e9 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
vtest "Basic test for peers protocol over SSL/TLS with stick-table declared in peers sections"
feature ignore_unknown_macro

#REQUIRE_VERSION=2.0
#REQUIRE_OPTIONS=OPENSSL
#REGTEST_TYPE=slow

haproxy h1 -arg "-L A" -conf {
    defaults
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    peers peers
        table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
        default-server ssl crt ${testdir}/common.pem verify none
        bind "fd@${A}" ssl crt ${testdir}/common.pem
        server A
        server B ${h2_B_addr}:${h2_B_port}
        server C ${h3_C_addr}:${h3_C_port}
        server D ${h4_D_addr}:${h4_D_port}

    frontend fe
        bind "fd@${fe}"
	tcp-request inspect-delay 100ms
        tcp-request content track-sc0 url table peers/stkt
        tcp-request content sc-inc-gpc0(0)
}

haproxy h2 -arg "-L B" -conf {
    defaults
        mode http
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    peers peers
        table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
        default-server ssl crt ${testdir}/common.pem verify none
        bind "fd@${B}" ssl crt ${testdir}/common.pem
        server A ${h1_A_addr}:${h1_A_port}
        server B
        server C ${h3_C_addr}:${h3_C_port}
        server D ${h4_D_addr}:${h4_D_port}

    frontend fe
        bind "fd@${fe}"
        http-request track-sc0 url table peers/stkt
        http-request sc-inc-gpc0(0)
}

haproxy h3 -arg "-L C" -conf {
    defaults
        mode http
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    peers peers
        table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
        default-server ssl crt ${testdir}/common.pem verify none
        bind "fd@${C}" ssl crt ${testdir}/common.pem
        server A ${h1_A_addr}:${h1_A_port}
        server B ${h2_B_addr}:${h2_B_port}
        server C
        server D ${h4_D_addr}:${h4_D_port}

    frontend fe
        bind "fd@${fe}"
        http-request track-sc0 url table peers/stkt
        http-request sc-inc-gpc0(0)
}

haproxy h4 -arg "-L D" -conf {
    defaults
        mode http
        timeout client  "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
        timeout server  "${HAPROXY_TEST_TIMEOUT-5s}"

    backend stkt

    peers peers
        table stkt type string size 10m store server_id,gpc0,conn_cur,conn_rate(50000)
        bind "fd@${D}"
        server A ${h1_A_addr}:${h1_A_port}
        server B ${h2_B_addr}:${h2_B_port}
        server C ${h3_C_addr}:${h3_C_port}
        server D

    frontend fe
        bind "fd@${fe}"
        http-request track-sc0 url table peers/stkt
        http-request sc-inc-gpc0(0)
}

client c1 -connect ${h1_fe_sock} {
    txreq -url "/c1_client"
    expect_close
} -start

client c2 -connect ${h1_fe_sock} {
    txreq -url "/c2_client"
    expect_close
} -start

client c3 -connect ${h1_fe_sock} {
    txreq -url "/c3_client"
    expect_close
} -start

client c4 -connect ${h1_fe_sock} {
    txreq -url "/c4_client"
    expect_close
} -start

haproxy h1 -start
delay 0.02
haproxy h2 -start
delay 0.02
haproxy h3 -start
delay 0.02
haproxy h4 -start
delay 0.02

client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait

delay 3

haproxy h1 -cli {
    send "show table peers/stkt"
    expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}

haproxy h2 -cli {
    send "show table peers/stkt"
    expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}

haproxy h3 -cli {
    send "show table peers/stkt"
    expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:4(\n0x[0-9a-f]*: key=/c[1-4]_client use=0 exp=0 server_id=0 gpc0=1 conn_rate\\(50000\\)=1 conn_cur=0){4}"
}

haproxy h4 -cli {
    send "show table peers/stkt"
    expect ~ "# table: peers/stkt, type: string, size:1048[0-9]{4}, used:0\n"
}