From 4dd97aa1d8fe460e8c16aa2601da0bfc7e790aad Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 10 Jun 2010 16:25:28 +0200
Subject: [PATCH] Test client timeout for import-export daemon

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 test/import-export_unittest.bash | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test/import-export_unittest.bash b/test/import-export_unittest.bash
index 453d2148f..0d5675a0d 100755
--- a/test/import-export_unittest.bash
+++ b/test/import-export_unittest.bash
@@ -118,6 +118,7 @@ $impexpd $src_statusfile invalidmode >/dev/null 2>&1 &&
 $impexpd $src_statusfile import --compression=rot13 >/dev/null 2>&1 &&
   err "daemon-util succeeded with invalid compression"
 
+upto 'Generate test data'
 cat $(get_testfile proc_drbd8.txt) $(get_testfile cert1.pem) > $testdata
 
 # Generate about 7.5 MB of test data
@@ -269,6 +270,12 @@ do_import &>$dst_output & imppid=$!
 checkpids $exppid $imppid || \
   err 'Listening with timeout failed when it should not'
 
+upto 'Connect timeout'
+reset_status
+# Setting lower timeout as nothing will be listening on port 0
+: | connect_timeout=1 do_export_to_port 0 &>$src_output & exppid=$!
+checkpids $exppid && err 'Connection did not time out when it should'
+
 upto 'No compression'
 reset_status
 compress=none do_import > $statusdir/recv-nocompr 2>$dst_output & imppid=$!
-- 
GitLab