This function checks a return code against an expected return code return code received from command the output of the result the expected return code 'RC=%s, Result=Ok' % (returncode) 'RC=%s, Result=%s' % (returncode,result) 'RC=%s, Expected %s, Result=%s' % (returncode,expected,result) RC This function checks the return code against an expected return code for a testcase return code received from command the output of the result the expected return code 'SUCCESS: RC=%s, Expected %s' % (returncode,expected) 'ERROR : RC=%s, Expected %s, Result=%s' % (returncode,expected,result) This function set the status of the tests: PASS 'Set test status to PASS' This function set the status of the tests: FAIL 'Set test status to FAIL' This function checks the return string against an expected return substring for a testcase the substring expected from the command the return string received from command 'SUCCESS : Found substring, %s, in the return string' % (expectedString) 'ERROR : Did not find substring, %s, in the return string, %s' % (expectedString, returnString) This function checks the return string against an expected return substring that should not be present for a testcase the substring being tested from the command the return string received from command 'Did Not Find substring, %s, in the return string' % (testString) 'Found substring, %s, in the return string, %s' % (testString, returnString) This function simply searches a string for a substring the substring being tested from the command the return string received from command the expected result, 0 for false (not present), 1 for true (present), 2 for old behavior 'Did Not Find substring, %s, in the return string' % (testString) 'Found substring, %s, in the return string' % (testString) returnCode 'SUCCESS : Did Not Find substring, %s, in the return string' % (testString) 'ERROR : Did Not Find substring, %s, in the return string' % (testString) 'SUCCESS : Found substring, %s, in the return string' % (testString) 'ERROR : Found substring, %s, in the return string' % (testString) returnCode Checks that the ldap server is running Location of target host Pathname to installation root Number of iterations Number of seconds to wait between iterations Directory server hostname or IP address Directory server port number Bind DN Bind password { 'location' : mylocation, 'dsPath' : mypath, 'dsInstanceHost' : myhost , 'dsInstancePort' : myport , 'dsInstanceDn' : mydn , 'dsInstancePswd' : mypswd , 'dsScope' : 'base' , 'dsBaseDN' : 'cn=config' , 'dsFilter' : 'objectclass=*' , 'attributes' : 'dn', 'expectedRC' : 'noCheck' } { 'sleepForMilliSeconds' : noOfMilliSeconds } Sleep for number of milliseconds Location of target host Number of milliseconds to sleep '%s' % location 'delay' 'delay %i' % sleepForMilliSeconds { 'returncode' : RC , 'result' : STAFResult } Set OS related variables Name of host on which to retrieve variables '%s' % hostname 'var' 'get system var STAF/Config/OS/Name' 'OS Name= %s' % STAFResult STAFResult Pretty prints a banner at the start of a test. 'testcase: %s' % STAXCurrentTestcase '****************************************************' '*** STARTING TEST CASE %s.' % STAXCurrentTestcase '***' Pretty prints a banner at the end of a test. '***' '*** ENDING TEST CASE %s.' % STAXCurrentTestcase '****************************************************' 'testcase: %s' % STAXCurrentTestcase Performs all the preoperations for a test case Performs all the post operations for a test suite 'A signal (%s) was raised during this test case' % SignalRaised '## Test Verdict: %s ##' % _status { 'location' : STAXServiceMachine, 'logname' : 'STAX_Job_%s_User' % STAXJobID, 'startfrom' : testcaseStartTime, 'endat' : testcaseEndTime } '%s' % _message Performs all the pre operations for a test suite '#### %s/%s suite preamble ####' % (ThisGroupName,ThisSuiteName) Performs all the post operations for a test suite '#### %s/%s suite postamble ####' % (ThisGroupName,ThisSuiteName) { 'starttime' : TestSuiteStartTime, 'endtime' : TestSuiteEndTime, 'tofile' : TestLogFile } Performs all the pre operations for a test group mylog '##### %s group preamble #####' % ThisGroupName Performs all the post operations for a test group '##### %s group postamble #####' % ThisGroupName { 'name' : 'Generate coverage xml report for test group %s' % CurrentTestPath['group'], 'command' : 'java', 'arguments' : ' -Xms64M -Xmx512M -cp %s/lib/emma.jar emma report -r xml,html -in %s/coverage.em,%s/coverage/%s/coverage.ec -Dreport.xml.out.file=%s/coverage/%s/coverage.xml -Dreport.html.out.file=%s/coverage/%s/coverage.html -sp %s/../../../src' % (dsPath,dsPath,TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR,CurrentTestPath['group'],TMPDIR), 'path' : TMPDIR } Queries the staf logs for the test case and write to file as text timestamp to start logging from timestamp to start logging to name of file to write the logs { 'location' : STAXServiceMachine, 'logname' : 'STAX_Job_%s_User' % STAXJobID, 'startfrom' : starttime, 'endat' : endtime } { 'queryresult' : STAFResult, 'logfile' : tofile } Process staf log query results and write them to a file result of the staf log query name of the log file to where results are written 'Creating test log %s' % logfile { 'location' : STAXServiceMachine, 'foldername' : NewLogDir } { 'returncode' : '1' , 'result' : output, 'expected' : '0' } check the number of matching sub-string in a string the sub-string to check the main string where the search is done comparison using case sensitive, or not value is : True/False number of expected sub-string that must be in the main string '%s' % myMessage '%s' % myMessage myRC,myMessage Name of the function to run Arguments to be passed on to the called function. This can be a map or a list of arguments, whatever the called function expects will be carried on here. . for a map, pass the arguments like this: { 'argumentA' : 'argumentAvalue' , 'argumentB' : 1 , ... } . for a list, pass the arguments like this: [ 'argumentAvalue, 1, ... ] The expected return code of the function to run. This is then passed onto the checkRC function. It is also used to throw an exception if the argument functionException is provided and set the test case status if the argument functionSetsTCStatus is provided The exception to throw if the return code differs from the expected RC. The exception is appended to STAXException. An optional message to display before running the function Whether the function to run sets the testcase status or not. If this is set, the test case status is set according to whether or not the function meets the expected return code. True or False should be used for this argument. If this argument is provided, a testcase will be created with this argument's value for name and set to fail only upon failure If this argument is provided, a signal will be raised upon unsuccesful execution of the function to run If this argument is provided then functionCallBack will be called after the execution of function name. This allows to specify arguments for the call back function '%s' % functionMessage 'runFunction: %s: called with parameters [%s]' % (functionName,functionArguments) functionArguments 'runFunction: %s: returned [%s] with [%s]' % (functionName,RC,STAXResult) _functionRC A general wrapper to run a command without having to write a dedicated function for it the command to run the path where the command is to be run from the path where the command is to be found the environment variables to set. The default set here should just work for OpenDS commands Which machine should the command be executed on The name to give the process (only matters in the STAX Monitor really) A boolean (use True or False here, case matters) to enable disable stripping the output of a command TODO: consider allowing passing a function name to enable custom output manipulation (overkill?) This argument can only have boolean values The duration that the process is allowed to run A boolean (use True or False here, case matters) to output the outputs of the command '%s: Running command:\n %s %s\nlocation: %s\nenv: %s\nworkdir: %s' % (_id,command,arguments,location,env,path) location command arguments path env '%s: Command returned:\n%s' % (_id,STAXResult[0][1]) STAXResult Kill the ldap server Location of target host Pathname to installation root 'Kill server running on %s at %s' % (location, dsPath) { 'name' : 'Read server pid file', 'location' : location, 'service' : 'FS', 'request' : 'GET FILE', 'arguments' : _args } { 'name' : 'Kill DS server', 'location' : location, 'command' : _cmd, 'arguments' : _args } STAXResult A general wrapper to run a STAF command without having to write a dedicated function for it Which machine should the command be executed on The name to give the process the command to run the command to run the arguments for the service request '%s: Running STAF command:\n %s %s %s\nlocation: %s\n' % (_id,service,request,arguments,location) '%s' % location service '%s %s' % (request,arguments) '%s: STAF Command returned:\n%s' % (_id,STAFResult) STAFResult