ci: Fix VPP back2back TCs 89/35789/1
authorMartin Klozik <martinx.klozik@intel.com>
Mon, 5 Jun 2017 14:49:54 +0000 (15:49 +0100)
committerMartin Klozik <martinx.klozik@intel.com>
Mon, 5 Jun 2017 15:03:05 +0000 (16:03 +0100)
There was a generic issue with restoration of original environment
after execution of testcase. Thus in case that multiple tests were
executed, their settings could be corrupted. This issue was detected
after VPP testcases were added into VSPERF DAILY CI job.

There were two issues:

* setttings.load_from_dict() method was used to restore original
  configuration values; However this method updates dict content
  with supplied values. If TC has introduced new dict item,
  then it was not removed from settings after TC execution
  and modified settings was applied also for next test(s).
* test configuration passed to testcase constructor is used
  for initialization of TC members, which are later updated;
  As python does shallow copy on dict members by default,
  modification of such testcase members led to corruption
  of configuration of other testcases. Thus deepcopy of testcase
  configuration was introduced into vsperf constructor to
  avoid TC configuration corruption.

JIRA: VSPERF-511

Change-Id: I45fb49d48743015353652de12db4692333043733
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Al Morton <acmorton@att.com>
Reviewed-by: Christian Trautman <ctrautma@redhat.com>
Reviewed-by: Sridhar Rao <sridhar.rao@spirent.com>
Reviewed-by: Trevor Cooper <trevor.cooper@intel.com>
testcases/testcase.py

index 75ed1a5..3a86f77 100644 (file)
@@ -45,14 +45,18 @@ class TestCase(object):
     In this basic form runs RFC2544 throughput test
     """
     # pylint: disable=too-many-statements
-    def __init__(self, cfg):
+    def __init__(self, test_cfg):
         """Pull out fields from test config
 
-        :param cfg: A dictionary of string-value pairs describing the test
+        :param test_cfg: A dictionary of string-value pairs describing the test
             configuration. Both the key and values strings use well-known
             values.
         :param results_dir: Where the csv formatted results are written.
         """
+        # make a local copy of test configuration to avoid modification of
+        # original content used in vsperf main script
+        cfg = copy.deepcopy(test_cfg)
+
         self._testcase_start_time = time.time()
         self._hugepages_mounted = False
         self._traffic_ctl = None
@@ -336,7 +340,8 @@ class TestCase(object):
         self.run_report()
 
         # restore original settings
-        S.load_from_dict(self._settings_original)
+        for key in self._settings_original:
+            S.setValue(key, self._settings_original[key])
 
     def _update_settings(self, param, value):
         """ Check value of given configuration parameter