summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qethernet.py
diff options
context:
space:
mode:
Diffstat (limited to 'test-cli/test/tests/qethernet.py')
-rw-r--r--test-cli/test/tests/qethernet.py47
1 files changed, 36 insertions, 11 deletions
diff --git a/test-cli/test/tests/qethernet.py b/test-cli/test/tests/qethernet.py
index d7354bf..878c0a0 100644
--- a/test-cli/test/tests/qethernet.py
+++ b/test-cli/test/tests/qethernet.py
@@ -11,6 +11,7 @@ class Qethernet(unittest.TestCase):
__port = None
params = None
__bwreal = None
+ __resultlist = None # resultlist is a python list of python dictionaries
# varlist content: serverip, bwexpected, port
def __init__(self, testname, testfunc, varlist):
@@ -34,6 +35,7 @@ class Qethernet(unittest.TestCase):
raise Exception('port param inside Qethernet must be defined')
self.__numbytestx = "10M"
self._testMethodDoc = testname
+ self.__resultlist = []
def execute(self):
# execute iperf command against the server
@@ -53,20 +55,43 @@ class Qethernet(unittest.TestCase):
# save result file
with open('/tmp/ethernet-iperf.json', 'w') as outfile:
json.dump(data, outfile, indent=4)
+ self.__resultlist.append(
+ {
+ "desc": "iperf3 output",
+ "data": "/tmp/ethernet-iperf.json",
+ "type": "file"
+ }
+ )
# check if BW is in the expected range
- self.failUnless(self.__bwreal > float(self.__bwexpected) * 0.9,
- "failed: speed is lower than spected. Speed(Mbits/s)" + str(self.__bwreal))
+ if self.__bwreal < float(self.__bwexpected):
+ self.__resultlist.append(
+ {
+ "desc": "Test result",
+ "data": "FAILED: speed is lower than spected. Speed(Mbits/s): " + str(self.__bwreal),
+ "type": "string"
+ }
+ )
+ self.fail("failed: speed is lower than spected. Speed(Mbits/s): " + str(self.__bwreal))
else:
- self.fail("failed: could not complete iperf command")
+ self.__resultlist.append(
+ {
+ "desc": "Test result",
+ "data": "FAILED: could not complete iperf command.",
+ "type": "string"
+ }
+ )
+ self.fail("failed: could not complete iperf command.")
- def getresults(self):
- # resultlist is a python list of python dictionaries
- resultlist = [
+ # Test successful
+ self.__resultlist.append(
{
- "desc": "iperf3 output",
- "data": "/tmp/ethernet-iperf.json",
- "type": "file"
+ "desc": "Test result",
+ "data": "OK",
+ "type": "string"
}
- ]
- return resultlist
+ )
+
+ def getresults(self):
+
+ return self.__resultlist