Skip to content

Commit c637872

Browse files
committed
Tests: fixed upstream zone ssl tests with LibreSSL and TLSv1.3.
LibreSSL does not support session reuse with TLSv1.3.
1 parent 6c62846 commit c637872

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

stream_upstream_zone_ssl.t

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ stream {
8282
ssl_certificate localhost.crt;
8383
ssl_session_cache builtin;
8484
}
85+
86+
server {
87+
listen 127.0.0.1:8085;
88+
proxy_pass 127.0.0.1:8086;
89+
}
90+
91+
server {
92+
listen 127.0.0.1:8086 ssl;
93+
return $ssl_protocol;
94+
95+
ssl_certificate_key localhost.key;
96+
ssl_certificate localhost.crt;
97+
}
8598
}
8699
87100
EOF
@@ -112,13 +125,33 @@ is(stream('127.0.0.1:' . port(8080))->read(), '.', 'ssl');
112125
is(stream('127.0.0.1:' . port(8080))->read(), '.', 'ssl 2');
113126

114127
is(stream('127.0.0.1:' . port(8081))->read(), '.', 'ssl session new');
128+
129+
TODO: {
130+
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
131+
if $t->has_module('LibreSSL') and test_tls13();
132+
115133
is(stream('127.0.0.1:' . port(8081))->read(), 'r', 'ssl session reused');
116134
is(stream('127.0.0.1:' . port(8081))->read(), 'r', 'ssl session reused 2');
117135

136+
}
137+
118138
is(stream('127.0.0.1:' . port(8082))->read(), '.', 'backup ssl');
119139
is(stream('127.0.0.1:' . port(8082))->read(), '.', 'backup ssl 2');
120140

121141
is(stream('127.0.0.1:' . port(8083))->read(), '.', 'backup ssl session new');
142+
143+
TODO: {
144+
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
145+
if $t->has_module('LibreSSL') and test_tls13();
146+
122147
is(stream('127.0.0.1:' . port(8083))->read(), 'r', 'backup ssl session reused');
123148

149+
}
150+
151+
###############################################################################
152+
153+
sub test_tls13 {
154+
stream('127.0.0.1:' . port(8085))->read() =~ /TLSv1.3/;
155+
}
156+
124157
###############################################################################

upstream_zone_ssl.t

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ http {
5656
5757
location / {
5858
add_header X-Session $ssl_session_reused;
59+
add_header X-Protocol $ssl_protocol;
5960
}
6061
}
6162
@@ -114,12 +115,32 @@ $t->run();
114115
like(http_get('/ssl'), qr/200 OK.*X-Session: \./s, 'ssl');
115116
like(http_get('/ssl'), qr/200 OK.*X-Session: \./s, 'ssl 2');
116117
like(http_get('/ssl_reuse'), qr/200 OK.*X-Session: \./s, 'ssl session new');
118+
119+
TODO: {
120+
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
121+
if $t->has_module('LibreSSL') and test_tls13();
122+
117123
like(http_get('/ssl_reuse'), qr/200 OK.*X-Session: r/s, 'ssl session reused');
118124
like(http_get('/ssl_reuse'), qr/200 OK.*X-Session: r/s, 'ssl session reused 2');
119125

126+
}
127+
120128
like(http_get('/backup'), qr/200 OK.*X-Session: \./s, 'backup');
121129
like(http_get('/backup'), qr/200 OK.*X-Session: \./s, 'backup 2');
122130
like(http_get('/backup_reuse'), qr/200 OK.*X-Session: \./s, 'backup new');
131+
132+
TODO: {
133+
local $TODO = 'no TLSv1.3 sessions in LibreSSL'
134+
if $t->has_module('LibreSSL') and test_tls13();
135+
123136
like(http_get('/backup_reuse'), qr/200 OK.*X-Session: r/s, 'backup reused');
124137

138+
}
139+
140+
###############################################################################
141+
142+
sub test_tls13 {
143+
http_get('/ssl') =~ /TLSv1.3/;
144+
}
145+
125146
###############################################################################

0 commit comments

Comments
 (0)