diff options
Diffstat (limited to 'baro_tests')
-rw-r--r-- | baro_tests/collectd.py | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/baro_tests/collectd.py b/baro_tests/collectd.py index 3cd55bf1..f07b4cea 100644 --- a/baro_tests/collectd.py +++ b/baro_tests/collectd.py @@ -11,6 +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 05 2017 """Executing test of plugins""" @@ -787,7 +788,6 @@ def main(bt_logger=None): out_plugins[node_id].append("SNMP") if 'Gnocchi' in out_plugins[node_id]: - logger.info("CSV will be enabled for verification") plugins_to_enable.append('csv') out_plugins[node_id].append("CSV") if plugins_to_enable: @@ -802,36 +802,40 @@ def main(bt_logger=None): logger.info( 'Testcases on node {} will not be executed'.format( node_id)) - else: - if plugins_to_enable: - collectd_restarted, collectd_warnings = \ - conf.restart_collectd(compute_node) - sleep_time = 10 - logger.info( - 'Sleeping for {} seconds'.format(sleep_time) - + ' after collectd restart...') - time.sleep(sleep_time) - if plugins_to_enable and not collectd_restarted: + + for i in out_plugins[node_id]: + if i == 'AODH': + for plugin_name in sorted(aodh_plugin_labels.keys()): + _exec_testcase( + aodh_plugin_labels, plugin_name, i, + controllers, compute_node, conf, results, + error_plugins, out_plugins[node_id]) + elif i == 'CSV': + _print_label("Node {}: Executing CSV Testcases".format( + node_name)) + logger.info("Restarting collectd for CSV tests") + collectd_restarted, collectd_warnings = \ + conf.restart_collectd(compute_node) + sleep_time = 10 + logger.info( + 'Sleeping for {} seconds'.format(sleep_time) + + ' after collectd restart...') + time.sleep(sleep_time) + if not collectd_restarted: for warning in collectd_warnings: logger.warning(warning) logger.error( 'Restart of collectd on node {} failed'.format( - node_id)) + compute_node)) logger.info( - 'Testcases on node {}'.format(node_id) + 'CSV Testcases on node {}'.format(compute_node) + ' will not be executed.') - else: - if collectd_warnings: - for warning in collectd_warnings: - logger.warning(warning) - - for i in out_plugins[node_id]: - if i == 'AODH': - for plugin_name in sorted(aodh_plugin_labels.keys()): + for plugin_name in sorted(plugin_labels.keys()): _exec_testcase( - aodh_plugin_labels, plugin_name, i, + plugin_labels, plugin_name, i, controllers, compute_node, conf, results, error_plugins, out_plugins[node_id]) + else: for plugin_name in sorted(plugin_labels.keys()): _exec_testcase( @@ -843,10 +847,12 @@ def main(bt_logger=None): print_overall_summary( compute_ids, plugin_labels, aodh_plugin_labels, results, out_plugins) - if ((len([res for res in results if not res[2]]) > 0) - or (len(results) < len(computes) * len(plugin_labels))): - logger.error('Some tests have failed or have not been executed') - return 1 + for res in results: + if res[3] is 'False' or 'None': + logger.error('Some tests have failed or have not been executed') + return 1 + else: + pass return 0 |