diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2017-08-19 01:06:46 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-08-19 01:06:46 +0000 |
commit | f5b1be7fa01b44e5e21ad30045814edc788ae0e3 (patch) | |
tree | d4813906c6dadd25ff7bb5fe6d4de31d15fd5ec5 /tests/unit/network_services/traffic_profile | |
parent | 349366a285555f4e874ef7a827c9dbc62988a4ab (diff) | |
parent | 3ab751bf9088047b5c593acf09fc0fe865dd359b (diff) |
Merge "Fix IxLoad traffic generator issue around running the traffic."
Diffstat (limited to 'tests/unit/network_services/traffic_profile')
-rw-r--r-- | tests/unit/network_services/traffic_profile/test_http_ixload.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/unit/network_services/traffic_profile/test_http_ixload.py b/tests/unit/network_services/traffic_profile/test_http_ixload.py index 2e1b6f4ff..5110439fd 100644 --- a/tests/unit/network_services/traffic_profile/test_http_ixload.py +++ b/tests/unit/network_services/traffic_profile/test_http_ixload.py @@ -16,11 +16,33 @@ from __future__ import absolute_import import unittest import mock -import runpy from oslo_serialization import jsonutils from yardstick.network_services.traffic_profile import http_ixload +from yardstick.network_services.traffic_profile.http_ixload import \ + join_non_strings, validate_non_string_sequence + + +class TestJoinNonStrings(unittest.TestCase): + + def test_validate_non_string_sequence(self): + self.assertEqual(validate_non_string_sequence([1, 2, 3]), [1, 2, 3]) + self.assertIsNone(validate_non_string_sequence('123')) + self.assertIsNone(validate_non_string_sequence(1)) + + self.assertEqual(validate_non_string_sequence(1, 2), 2) + self.assertEqual(validate_non_string_sequence(1, default=2), 2) + + with self.assertRaises(RuntimeError): + validate_non_string_sequence(1, raise_exc=RuntimeError) + + def test_join_non_strings(self): + self.assertEqual(join_non_strings(':'), '') + self.assertEqual(join_non_strings(':', 'a'), 'a') + self.assertEqual(join_non_strings(':', 'a', 2, 'c'), 'a:2:c') + self.assertEqual(join_non_strings(':', ['a', 2, 'c']), 'a:2:c') + self.assertEqual(join_non_strings(':', 'abc'), 'abc') class TestIxLoadTrafficGen(unittest.TestCase): |