aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/networking
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark/scenarios/networking')
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_iperf3.py18
-rwxr-xr-xtests/unit/benchmark/scenarios/networking/test_netperf.py12
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_ping.py16
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_pktgen.py15
4 files changed, 41 insertions, 20 deletions
diff --git a/tests/unit/benchmark/scenarios/networking/test_iperf3.py b/tests/unit/benchmark/scenarios/networking/test_iperf3.py
index 8b0da655b..2ec73ebd2 100644
--- a/tests/unit/benchmark/scenarios/networking/test_iperf3.py
+++ b/tests/unit/benchmark/scenarios/networking/test_iperf3.py
@@ -67,11 +67,12 @@ class IperfTestCase(unittest.TestCase):
options = {}
args = {'options': options}
+ result = {}
sample_output = self._read_sample_output(self.output_name_tcp)
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
expected_result = json.loads(sample_output)
- result = p.run(args)
+ p.run(args, result)
self.assertEqual(result, expected_result)
def test_iperf_successful_sla(self, mock_ssh):
@@ -85,11 +86,12 @@ class IperfTestCase(unittest.TestCase):
'options': options,
'sla': {'bytes_per_second': 15000000}
}
+ result = {}
sample_output = self._read_sample_output(self.output_name_tcp)
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
expected_result = json.loads(sample_output)
- result = p.run(args)
+ p.run(args, result)
self.assertEqual(result, expected_result)
def test_iperf_unsuccessful_sla(self, mock_ssh):
@@ -103,10 +105,11 @@ class IperfTestCase(unittest.TestCase):
'options': options,
'sla': {'bytes_per_second': 25000000}
}
+ result = {}
sample_output = self._read_sample_output(self.output_name_tcp)
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
def test_iperf_successful_sla_jitter(self, mock_ssh):
@@ -119,11 +122,12 @@ class IperfTestCase(unittest.TestCase):
'options': options,
'sla': {'jitter': 10}
}
+ result = {}
sample_output = self._read_sample_output(self.output_name_udp)
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
expected_result = json.loads(sample_output)
- result = p.run(args)
+ p.run(args, result)
self.assertEqual(result, expected_result)
def test_iperf_unsuccessful_sla_jitter(self, mock_ssh):
@@ -137,10 +141,11 @@ class IperfTestCase(unittest.TestCase):
'options': options,
'sla': {'jitter': 0.0001}
}
+ result = {}
sample_output = self._read_sample_output(self.output_name_udp)
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
def test_iperf_unsuccessful_script_error(self, mock_ssh):
@@ -150,9 +155,10 @@ class IperfTestCase(unittest.TestCase):
options = {}
args = {'options': options}
+ result = {}
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args)
+ self.assertRaises(RuntimeError, p.run, args, result)
def _read_sample_output(self,filename):
curr_path = os.path.dirname(os.path.abspath(__file__))
diff --git a/tests/unit/benchmark/scenarios/networking/test_netperf.py b/tests/unit/benchmark/scenarios/networking/test_netperf.py
index d5c19918b..4bb5983c3 100755
--- a/tests/unit/benchmark/scenarios/networking/test_netperf.py
+++ b/tests/unit/benchmark/scenarios/networking/test_netperf.py
@@ -48,11 +48,12 @@ class NetperfTestCase(unittest.TestCase):
options = {}
args = {'options': options}
+ result = {}
sample_output = self._read_sample_output()
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
expected_result = json.loads(sample_output)
- result = p.run(args)
+ p.run(args, result)
self.assertEqual(result, expected_result)
def test_netperf_successful_sla(self, mock_ssh):
@@ -66,11 +67,12 @@ class NetperfTestCase(unittest.TestCase):
'options': options,
'sla': {'mean_latency': 100}
}
+ result = {}
sample_output = self._read_sample_output()
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
expected_result = json.loads(sample_output)
- result = p.run(args)
+ p.run(args, result)
self.assertEqual(result, expected_result)
def test_netperf_unsuccessful_sla(self, mock_ssh):
@@ -84,10 +86,11 @@ class NetperfTestCase(unittest.TestCase):
'options': options,
'sla': {'mean_latency': 5}
}
+ result = {}
sample_output = self._read_sample_output()
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
def test_netperf_unsuccessful_script_error(self, mock_ssh):
@@ -97,9 +100,10 @@ class NetperfTestCase(unittest.TestCase):
options = {}
args = {'options': options}
+ result = {}
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args)
+ self.assertRaises(RuntimeError, p.run, args, result)
def _read_sample_output(self):
curr_path = os.path.dirname(os.path.abspath(__file__))
diff --git a/tests/unit/benchmark/scenarios/networking/test_ping.py b/tests/unit/benchmark/scenarios/networking/test_ping.py
index d930adcee..b2c5b9859 100644
--- a/tests/unit/benchmark/scenarios/networking/test_ping.py
+++ b/tests/unit/benchmark/scenarios/networking/test_ping.py
@@ -35,10 +35,11 @@ class PingTestCase(unittest.TestCase):
'options': {'packetsize': 200},
'ipaddr': '172.16.0.138'
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- result = p.run(args)
- self.assertEqual(result, float(mock_ssh.SSH().execute.return_value[1]))
+ p.run(args, result)
+ self.assertEqual(result, {'rtt': 100.0})
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_successful_sla(self, mock_ssh):
@@ -50,10 +51,11 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 150}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- result = p.run(args)
- self.assertEqual(result, float(mock_ssh.SSH().execute.return_value[1]))
+ p.run(args, result)
+ self.assertEqual(result, {'rtt': 100.0})
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_unsuccessful_sla(self, mock_ssh):
@@ -65,9 +67,10 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 50}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (0, '100', '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
@mock.patch('yardstick.benchmark.scenarios.networking.ping.ssh')
def test_ping_unsuccessful_script_error(self, mock_ssh):
@@ -79,9 +82,10 @@ class PingTestCase(unittest.TestCase):
'ipaddr': '172.16.0.138',
'sla': {'max_rtt': 50}
}
+ result = {}
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args)
+ self.assertRaises(RuntimeError, p.run, args, result)
def main():
diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen.py b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
index a20382cb7..ae4481f0e 100644
--- a/tests/unit/benchmark/scenarios/networking/test_pktgen.py
+++ b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
@@ -113,6 +113,8 @@ class PktgenTestCase(unittest.TestCase):
'options': {'packetsize': 60, 'number_of_ports': 10},
'ipaddr': '172.16.0.139'
}
+ result = {}
+
p.server = mock_ssh.SSH()
p.client = mock_ssh.SSH()
@@ -124,7 +126,7 @@ class PktgenTestCase(unittest.TestCase):
"packets_sent": 149776, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- result = p.run(args)
+ p.run(args, result)
expected_result = json.loads(sample_output)
expected_result["packets_received"] = 149300
self.assertEqual(result, expected_result)
@@ -137,6 +139,7 @@ class PktgenTestCase(unittest.TestCase):
'ipaddr': '172.16.0.139',
'sla': {'max_ppm': 10000}
}
+ result = {}
p.server = mock_ssh.SSH()
p.client = mock_ssh.SSH()
@@ -148,7 +151,7 @@ class PktgenTestCase(unittest.TestCase):
"packets_sent": 149776, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- result = p.run(args)
+ p.run(args, result)
expected_result = json.loads(sample_output)
expected_result["packets_received"] = 149300
self.assertEqual(result, expected_result)
@@ -161,6 +164,8 @@ class PktgenTestCase(unittest.TestCase):
'ipaddr': '172.16.0.139',
'sla': {'max_ppm': 1000}
}
+ result = {}
+
p.server = mock_ssh.SSH()
p.client = mock_ssh.SSH()
@@ -171,7 +176,7 @@ class PktgenTestCase(unittest.TestCase):
sample_output = '{"packets_per_second": 9753, "errors": 0, \
"packets_sent": 149776, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, p.run, args)
+ self.assertRaises(AssertionError, p.run, args, result)
def test_pktgen_unsuccessful_script_error(self, mock_ssh):
@@ -181,11 +186,13 @@ class PktgenTestCase(unittest.TestCase):
'ipaddr': '172.16.0.139',
'sla': {'max_ppm': 1000}
}
+ result = {}
+
p.server = mock_ssh.SSH()
p.client = mock_ssh.SSH()
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, p.run, args)
+ self.assertRaises(RuntimeError, p.run, args, result)
def main():