Add more tests that check the timeout behavior of relayd.
authorbluhm <bluhm@openbsd.org>
Thu, 4 Jan 2018 22:58:25 +0000 (22:58 +0000)
committerbluhm <bluhm@openbsd.org>
Thu, 4 Jan 2018 22:58:25 +0000 (22:58 +0000)
16 files changed:
regress/usr.sbin/relayd/args-timeget-http.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeget-https.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeget-ssl.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeget.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timein-http.pl
regress/usr.sbin/relayd/args-timein-https.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timein-ssl.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timein.pl
regress/usr.sbin/relayd/args-timeout-http.pl
regress/usr.sbin/relayd/args-timeout-https.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeout-ssl.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeout.pl
regress/usr.sbin/relayd/args-timeput-http.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeput-https.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeput-ssl.pl [new file with mode: 0644]
regress/usr.sbin/relayd/args-timeput.pl [new file with mode: 0644]

diff --git a/regress/usr.sbin/relayd/args-timeget-http.pl b/regress/usr.sbin/relayd/args-timeget-http.pl
new file mode 100644 (file)
index 0000000..0e18d2f
--- /dev/null
@@ -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 (file)
index 0000000..a2e381b
--- /dev/null
@@ -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 (file)
index 0000000..5f2fcc7
--- /dev/null
@@ -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 (file)
index 0000000..ec915b8
--- /dev/null
@@ -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;
index e3d56a5..1bc1557 100644 (file)
@@ -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 (file)
index 0000000..89e1449
--- /dev/null
@@ -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 (file)
index 0000000..caa024b
--- /dev/null
@@ -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;
index 63343ab..8107161 100644 (file)
@@ -17,6 +17,7 @@ our %args = (
     },
     relayd => {
        relay => [ "session timeout 3" ],
+       loggrep => { qr/(buffer event|splice) timeout/ => 0 },
     },
     len => 9,
 );
index bfc87cc..38f9b28 100644 (file)
@@ -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 (file)
index 0000000..449a539
--- /dev/null
@@ -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 (file)
index 0000000..3cf7492
--- /dev/null
@@ -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;
index 117a6d4..bf4319f 100644 (file)
@@ -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 (file)
index 0000000..cfe709a
--- /dev/null
@@ -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 (file)
index 0000000..bdc406b
--- /dev/null
@@ -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 (file)
index 0000000..3ae402d
--- /dev/null
@@ -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 (file)
index 0000000..8322d2e
--- /dev/null
@@ -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;