Adding improvements to the log messages 19/44719/1
authorSharada Shiddibhavi <sharada.shiddibhavi@intel.com>
Tue, 10 Oct 2017 09:40:55 +0000 (09:40 +0000)
committerSharada Shiddibhavi <sharada.shiddibhavi@intel.com>
Tue, 10 Oct 2017 09:41:59 +0000 (09:41 +0000)
This patch contains improvements to the log messages
in Barometer test suite.

Change-Id: I6f0ba5260e2ecdbc90c27a93e4901636e4f66b42
Signed-off-by: Sharada Shiddibhavi <sharada.shiddibhavi@intel.com>
baro_tests/collectd.py
baro_tests/config_server.py

index 8d12705..304b87b 100644 (file)
@@ -11,7 +11,7 @@
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 # License for the specific language governing permissions and limitations
 # under the License.
-# Patch on October 09 2017
+# Patch on October 10 2017
 
 """Executing test of plugins"""
 
@@ -255,7 +255,7 @@ def get_csv_categories_for_ipmi(conf, compute_node):
     return [category.strip()[:-11] for category in categories]
 
 
-def _process_result(compute_node, out_plugin, test, result, results_list):
+def _process_result(compute_node, out_plugin, test, result, results_list, node):
     """Print test result and append it to results list.
 
     Keyword arguments:
@@ -265,12 +265,12 @@ def _process_result(compute_node, out_plugin, test, result, results_list):
     """
     if result:
         logger.info(
-            'Test case {0} PASSED with {1}.'.format(
-                test, out_plugin))
+            'Test case for {0} with {1} PASSED on {2}.'.format(
+                node, out_plugin, test))
     else:
         logger.error(
-            'Test case {0} FAILED with {1}.'.format(
-                test, out_plugin))
+            'Test case for {0} with {1} FAILED on {2}.'.format(
+                node, out_plugin, test))
     results_list.append((compute_node, out_plugin, test, result))
 
 
@@ -540,7 +540,7 @@ def _exec_testcase(
             logger.error(' * ' + error)
         _process_result(
             compute_node.get_id(), out_plugin, test_labels[name], False,
-            results)
+            results, compute_node.get_name())
     else:
         plugin_errors = [
             error for plugin, error, critical in error_plugins
@@ -591,7 +591,7 @@ def _exec_testcase(
                 res = False
             _process_result(
                 compute_node.get_id(), out_plugin, test_labels[name],
-                res, results)
+                res, results, compute_node.get_name())
 
 
 def get_results_for_ovs_events(
@@ -851,6 +851,7 @@ def main(bt_logger=None):
     for res in results:
         if res[3] is 'False' or 'None':
             logger.error('Some tests have failed or have not been executed')
+            logger.error('Overall Result is Fail')
             return 1
         else:
             pass
index 8b597cc..f35f788 100644 (file)
@@ -383,7 +383,7 @@ class ConfigServer(object):
                     return False
                 else:
                     self.__logger.info(
-                        "Gnochi plugin available in compute node {}" .format(
+                        "Gnocchi plugin available in compute node {}" .format(
                             compute_name))
                     return True
         return True
@@ -535,6 +535,7 @@ class ConfigServer(object):
         timestamps1 = {}
         timestamps2 = {}
         nodes = get_apex_nodes()
+        sleep_time = plugin_interval + 2
         for node in nodes:
             if node.is_controller():
                 self.__logger.info('Getting gnocchi metric list on {}' .format(
@@ -564,7 +565,7 @@ class ConfigServer(object):
                         else:
                             timestamps1 = line.replace('|', "")
                             timestamps1 = timestamps1.split()[0]
-                    time.sleep(10)
+                    time.sleep(sleep_time)
                     stdout = node.run_cmd(
                         "source overcloudrc.v3;gnocchi measures show {}".format(
                             metric_id))
@@ -578,11 +579,16 @@ class ConfigServer(object):
                             timestamps2 = line.replace('|', "")
                             timestamps2 = timestamps2.split()[0]
                     if timestamps1 == timestamps2:
-                        self.__logger.info("Data not updated after 12 seconds")
+                        self.__logger.info(
+                            "Plugin Interval is {}" .format(plugin_interval))
+                        self.__logger.info(
+                            "Data not updated after {} seconds".format(
+                                sleep_time))
                         return False
                     else:
                         self.__logger.info("PASS")
                         return True
+        return False
 
     def test_plugins_with_snmp(
             self, compute, plugin_interval, logger, plugin, snmp_mib_files=[],