DESCRIPTION

Adding test for checkpoint with failover

Change-Id: Ia02960513314a5bc03da8c44e385956b43dab41c


COMMENTS

author: Amani Conrad
date: 2012-05-17 00:06:28.058000000

Uploaded patch set 2.

-------------------------------------
author: Kenny Maynard
date: 2012-05-17 00:16:18.660000000

Patch Set 2: I would prefer that you didn't submit this

(4 inline comments)

A few more comments around the failover part of the test.

Line:174, pytests/checkpoint.py -> Is this TODO filed as a bug on Jira too?

Line:215, pytests/checkpoint.py -> You still aren't ending the test if the failover fails to happen. What you need to do is either have your failover function throw an error so the test case halts or you need to check the return type of this function and fail the test yourself if something went wrong. Right now if the failover errors then you will continue the test.

Line:313, pytests/checkpoint.py -> This function always returns None whether there is a success or a failure.

Line:322, pytests/checkpoint.py -> It is not good to catch Exception. The reason is that doing this can mask programming errors in the try block. You should explicitly catch the possible exceptions that can be throw by the failover function in rest_client.

-------------------------------------
author: Amani Conrad
date: 2012-05-17 03:55:59.553000000

Patch Set 2: (3 inline comments)



Line:174, pytests/checkpoint.py -> yes

Line:215, pytests/checkpoint.py -> I am adding a log.fail on the function _failover to fail if the failover does not happen - in the else/exception portion. This should take care of the test not proceeding ahead in case of any failures during failover-call.

Line:322, pytests/checkpoint.py -> The rest_client does raise an exception for the failover error. Do you recommend not having any exception call on the checkpoint._failover call? 

def fail_over(self, otpNode=None ):
        if otpNode is None:
            log.error('otpNode parameter required')
            return False
        api = self.baseUrl + 'controller/failOver'
        params = urllib.urlencode({'otpNode': otpNode})
        status, content = self._http_request(api, 'POST', params)
        if status == True:
            log.info('fail_over successful')
        else:
            log.error('fail_over error : {0}'.format(content))
            raise FailoverFailedException(content)

-------------------------------------
