From: bluhm Date: Thu, 4 Jan 2018 22:58:25 +0000 (+0000) Subject: Add more tests that check the timeout behavior of relayd. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=090644eea0e90f4bfe2f81bf0092f7b7f350fca7;p=openbsd Add more tests that check the timeout behavior of relayd. --- diff --git a/regress/usr.sbin/relayd/args-timeget-http.pl b/regress/usr.sbin/relayd/args-timeget-http.pl new file mode 100644 index 00000000000..0e18d2f14ab --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeget-http.pl @@ -0,0 +1,25 @@ +# test that 2 seconds timeout does not occur while server writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + method => "GET", + timefile => "", + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, + }, + server => { + func => \&http_server, + sleep => 1, + method => "GET", + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeget-https.pl b/regress/usr.sbin/relayd/args-timeget-https.pl new file mode 100644 index 00000000000..a2e381b5243 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeget-https.pl @@ -0,0 +1,30 @@ +# test that 2 seconds timeout does not occur while server writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + method => "GET", + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + func => \&http_server, + sleep => 1, + method => "GET", + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeget-ssl.pl b/regress/usr.sbin/relayd/args-timeget-ssl.pl new file mode 100644 index 00000000000..5f2fcc7ed59 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeget-ssl.pl @@ -0,0 +1,28 @@ +# test that 2 seconds timeout does not occur while server writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&read_char, + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + func => \&write_char, + len => 5, + sleep => 1, + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeget.pl b/regress/usr.sbin/relayd/args-timeget.pl new file mode 100644 index 00000000000..ec915b86ab5 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeget.pl @@ -0,0 +1,23 @@ +# test that 2 seconds timeout does not occur while server writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&read_char, + timefile => "", + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, + }, + server => { + func => \&write_char, + len => 5, + sleep => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timein-http.pl b/regress/usr.sbin/relayd/args-timein-http.pl index e3d56a5103a..1bc155761b7 100644 --- a/regress/usr.sbin/relayd/args-timein-http.pl +++ b/regress/usr.sbin/relayd/args-timein-http.pl @@ -12,6 +12,7 @@ our %args = ( relayd => { protocol => [ "http" ], relay => [ "session timeout 3" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, }, server => { func => sub { diff --git a/regress/usr.sbin/relayd/args-timein-https.pl b/regress/usr.sbin/relayd/args-timein-https.pl new file mode 100644 index 00000000000..89e14493c4f --- /dev/null +++ b/regress/usr.sbin/relayd/args-timein-https.pl @@ -0,0 +1,35 @@ +# test that 3 seconds timeout does not occur within 2 seconds idle in http + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + protocol => [ "http" ], + relay => [ "session timeout 3" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + func => sub { + errignore(); + http_server(@_); + sleep 2; + write_char(@_, 4); + }, + sleep => 1, + nocheck => 1, + ssl => 1, + }, + len => 9, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timein-ssl.pl b/regress/usr.sbin/relayd/args-timein-ssl.pl new file mode 100644 index 00000000000..caa024bcf20 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timein-ssl.pl @@ -0,0 +1,32 @@ +# test that 3 seconds timeout does not occur within 2 seconds idle + +use strict; +use warnings; + +our %args = ( + client => { + func => sub { + errignore(); + write_char(@_, 5); + sleep 2; + write_char(@_, 4); + }, + sleep => 1, + timefile => "", + nocheck => 1, + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 3" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + ssl => 1, + }, + len => 9, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timein.pl b/regress/usr.sbin/relayd/args-timein.pl index 63343abe00a..81071616a88 100644 --- a/regress/usr.sbin/relayd/args-timein.pl +++ b/regress/usr.sbin/relayd/args-timein.pl @@ -17,6 +17,7 @@ our %args = ( }, relayd => { relay => [ "session timeout 3" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, }, len => 9, ); diff --git a/regress/usr.sbin/relayd/args-timeout-http.pl b/regress/usr.sbin/relayd/args-timeout-http.pl index bfc87cce3ae..38f9b28e96d 100644 --- a/regress/usr.sbin/relayd/args-timeout-http.pl +++ b/regress/usr.sbin/relayd/args-timeout-http.pl @@ -12,6 +12,7 @@ our %args = ( relayd => { protocol => [ "http" ], relay => [ "session timeout 3" ], + loggrep => { qr/(buffer event|splice) timeout/ => 1 }, }, server => { func => sub { diff --git a/regress/usr.sbin/relayd/args-timeout-https.pl b/regress/usr.sbin/relayd/args-timeout-https.pl new file mode 100644 index 00000000000..449a5391c77 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeout-https.pl @@ -0,0 +1,36 @@ +# test that 3 seconds timeout occurs within 4 seconds idle in http + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + protocol => [ "http" ], + relay => [ "session timeout 3" ], + loggrep => { qr/buffer event timeout/ => 1 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + func => sub { + errignore(); + http_server(@_); + sleep 4; + write_char(@_, 4); + }, + sleep => 1, + down => "Broken pipe", + nocheck => 1, + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeout-ssl.pl b/regress/usr.sbin/relayd/args-timeout-ssl.pl new file mode 100644 index 00000000000..3cf7492d973 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeout-ssl.pl @@ -0,0 +1,33 @@ +# test that 3 seconds timeout occurs within 4 seconds idle + +use strict; +use warnings; + +our %args = ( + client => { + func => sub { + errignore(); + write_char(@_, 5); + sleep 4; + write_char(@_, 4); + }, + sleep => 1, + down => "Broken pipe", + timefile => "", + nocheck => 1, + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 3" ], + loggrep => { qr/buffer event timeout/ => 1 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeout.pl b/regress/usr.sbin/relayd/args-timeout.pl index 117a6d43404..bf4319fa796 100644 --- a/regress/usr.sbin/relayd/args-timeout.pl +++ b/regress/usr.sbin/relayd/args-timeout.pl @@ -18,6 +18,7 @@ our %args = ( }, relayd => { relay => [ "session timeout 3" ], + loggrep => { qr/(buffer event|splice) timeout/ => 1 }, }, len => 5, ); diff --git a/regress/usr.sbin/relayd/args-timeput-http.pl b/regress/usr.sbin/relayd/args-timeput-http.pl new file mode 100644 index 00000000000..cfe709ab9a3 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeput-http.pl @@ -0,0 +1,25 @@ +# test that 2 seconds timeout does not occur while client writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + sleep => 1, + method => "PUT", + timefile => "", + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, + }, + server => { + func => \&http_server, + method => "PUT", + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeput-https.pl b/regress/usr.sbin/relayd/args-timeput-https.pl new file mode 100644 index 00000000000..bdc406bebfd --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeput-https.pl @@ -0,0 +1,30 @@ +# test that 2 seconds timeout does not occur while client writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&http_client, + len => 5, + sleep => 1, + method => "PUT", + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + func => \&http_server, + method => "PUT", + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeput-ssl.pl b/regress/usr.sbin/relayd/args-timeput-ssl.pl new file mode 100644 index 00000000000..3ae402dff4a --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeput-ssl.pl @@ -0,0 +1,27 @@ +# test that 2 seconds timeout does not occur while client writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&write_char, + len => 5, + sleep => 1, + timefile => "", + ssl => 1, + loggrep => 'Issuer.*/OU=relayd/', + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/buffer event timeout/ => 0 }, + forwardssl => 1, + listenssl => 1, + }, + server => { + ssl => 1, + }, + len => 5, +); + +1; diff --git a/regress/usr.sbin/relayd/args-timeput.pl b/regress/usr.sbin/relayd/args-timeput.pl new file mode 100644 index 00000000000..8322d2e9107 --- /dev/null +++ b/regress/usr.sbin/relayd/args-timeput.pl @@ -0,0 +1,20 @@ +# test that 2 seconds timeout does not occur while client writes for 4 seconds + +use strict; +use warnings; + +our %args = ( + client => { + func => \&write_char, + len => 5, + sleep => 1, + timefile => "", + }, + relayd => { + relay => [ "session timeout 2" ], + loggrep => { qr/(buffer event|splice) timeout/ => 0 }, + }, + len => 5, +); + +1;