From 77c7f324610224e808d8940aec7e6dbf19b790a5 Mon Sep 17 00:00:00 2001 From: Shwetha-H-Panduranga Date: Tue, 6 Dec 2011 14:26:59 +0530 Subject: Adding New/Updated Automation Files --- TestUnits/replicate/self_heal/Main.py | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 TestUnits/replicate/self_heal/Main.py (limited to 'TestUnits/replicate/self_heal/Main.py') diff --git a/TestUnits/replicate/self_heal/Main.py b/TestUnits/replicate/self_heal/Main.py new file mode 100644 index 0000000..4e37265 --- /dev/null +++ b/TestUnits/replicate/self_heal/Main.py @@ -0,0 +1,69 @@ +"""Main module for the testunit. + +This module "main" function is called from atfexecute to execute the testunit. +""" +import parser +import atfutils +import glusterutils +import managerutils +import testcases + +def initialize(filename): + """ + """ + return_status = 1 + if parser.parse_testenv_configfile(filename): + return return_status + if managerutils.ssh_connect_allhosts(): + return return_status + + return 0 + +def setup(): + """ + """ + return_status = 1 + if atfutils.set_active_volume("volume1"): + return return_status + return 0 + +def execute(*testcaselist): + """ + """ + passedtestcases = 0 + failedtestcases = 0 + selectedtestcases = len(testcaselist) + + for testcase in testcaselist: + function_obj = getattr(testcases, testcase) + if function_obj: + print "Starting Test: ' %s '" % testcase + return_status = function_obj() + if return_status: + print "TestCase ' %s ' Failed" % testcase + failedtestcases += 1 + else: + print "TestCase ' %s ' Passed" % testcase + passedtestcases += 1 + print "Ending Test: ' %s '" % testcase + else: + print "TestCase %s not defined in 'testcases' module" % testcase + continue + + print "Selected %d : Passed %d, Failed %d" % (selectedtestcases, + passedtestcases, + failedtestcases) + +def cleanup(): + """ + """ + pass + +def main(testenvfile, *testcaselist): + """ + """ + initialize(testenvfile) + setup() + execute(*testcaselist) + cleanup() + return -- cgit