commit bbb4c0315c239be3ffb70e479dabeaead6c6d70a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 8 11:09:47 2013 +0100
TestTCPConnect: option parsing bug fixes
This commit fixes two bugs during option parsing:
* option "sleep" is not mandatory but when not specified the module
* crashes
* option "port" needs to be an integer value, and the function extend
* was used on the port list, splitting the port string into individual
* characters
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
test_modules/TestTCPConnect.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/test_modules/TestTCPConnect.py b/test_modules/TestTCPConnect.py
index 4a5dc5c..4da2600 100644
--- a/test_modules/TestTCPConnect.py
+++ b/test_modules/TestTCPConnect.py
@@ -123,7 +123,7 @@ class TestTCPConnect(TestGeneric):
# either port or port_range should be set
port = self.get_opt("port")
if port:
- self._port = port
+ self._port = int(port)
else:
port_range = self.get_opt("port_range")
if port_range:
@@ -132,9 +132,11 @@ class TestTCPConnect(TestGeneric):
e = TestOptionMissing()
raise e
- sleep_time = float(self.get_opt("sleep"))
+ sleep_time = self.get_opt("sleep")
if sleep_time:
- self._sleep_time = sleep_time
+ self._sleep_time = float(sleep_time)
+ else:
+ self._sleep_time = 0
cont = self.get_opt("cont")
if cont:
@@ -177,7 +179,7 @@ class TestTCPConnect(TestGeneric):
ports = []
if self._port:
- ports.extend(self._port)
+ ports.append(self._port)
else:
r = self.parse_port_range()
ports.extend(r)