Commit d1415674 authored by Mohamed Fenjiro's avatar Mohamed Fenjiro
Browse files

jami_test.py fixes

Change-Id: If4c13f20b1bbf2e0cf9c6e78ffe4d68b99e98842
parent 6b0d81f4
...@@ -39,22 +39,30 @@ class JamiTest(DRingCtrl): ...@@ -39,22 +39,30 @@ class JamiTest(DRingCtrl):
self.failureRate = 0 self.failureRate = 0
self.callsCompleted = 0 self.callsCompleted = 0
ringAccounts = self.getAllAccounts('RING') ringAccounts = self.getAllAccounts('RING')
if len (ringAccounts) < 1:
callerDetails = {'Account.type':'RING', 'Account.alias':'testringaccount3'}
self.addAccount(callerDetails)
self.setAccount(ringAccounts[0]) self.setAccount(ringAccounts[0])
volatileCallerDetails = self.getVolatileAccountDetails(self.account)
if not args.peer: if volatileCallerDetails['Account.registrationStatus'] != 'REGISTERED':
peer = ringAccounts[1] raise DRingCtrlError("Caller Account not registered")
details = self.getAccountDetails(peer)
self.peer = details['Account.username'] self.peer = args.peer
else: volatilePeerDetails = self.getVolatileAccountDetails()
self.peer = args.peer
print("Using local test account: ", self.account) if volatilePeerDetails['Account.registrationStatus'] != 'REGISTERED':
print("Using test peer: ", self.peer) raise DRingCtrlError("Peer Account not registered")
print("Using local test account: ", self.account, volatileCallerDetails['Account.registrationStatus'])
print("Using test peer: ", self.peer, volatilePeerDetails['Account.registrationStatus'])
if self.testCall(): if self.testCall():
GLib.timeout_add_seconds(args.interval, self.testCall) GLib.timeout_add_seconds(args.interval, self.testCall)
def keepGoing(self): def keepGoing(self):
return self.args.calls == 0 or self.iterator < self.args.calls return not self.args.calls or self.iterator < self.args.calls
def testCall(self): def testCall(self):
print("**[BEGIN] Call Test") print("**[BEGIN] Call Test")
...@@ -94,7 +102,7 @@ class JamiTest(DRingCtrl): ...@@ -94,7 +102,7 @@ class JamiTest(DRingCtrl):
def testSucceeded(self, callId): def testSucceeded(self, callId):
self.testEnded(callId) self.testEnded(callId)
def run(self): def run(self):
super().run() super().run()
if self.failureCount == 0: if self.failureCount == 0:
...@@ -107,13 +115,15 @@ class JamiTest(DRingCtrl): ...@@ -107,13 +115,15 @@ class JamiTest(DRingCtrl):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Monitor Jami reliabilty by mesuring failure rate for making Calls/Messages and receiving them.') parser = argparse.ArgumentParser(description='Monitor Jami reliabilty by mesuring failure rate for making Calls/Messages and receiving them.')
parser.add_argument('--messages', help='Number of messages sent', type=int) optional = parser._action_groups.pop()
parser.add_argument('--calls', help='Number of calls made', default=0, type=int) required = parser.add_argument_group('required arguments')
parser.add_argument('--duration', help='Specify the duration of the test (seconds)', default=10, type=int) optional.add_argument('--messages', help = 'Number of messages to send', type = int)
parser.add_argument('--interval', help='Specify the test interval (seconds)', default=0, type=int) optional.add_argument('--duration', help = 'Specify the duration of the test (seconds)', default = 600, type = int)
parser.add_argument('--peer', help='Specify the peer account id') optional.add_argument('--interval', help = 'Specify the test interval (seconds)', default = 10, type = int)
required.add_argument('--peer', help = 'Specify the peer account ID', required = True)
required.add_argument('--calls', help = 'Number of calls to make', type = int, required = True)
parser._action_groups.append(optional)
args = parser.parse_args() args = parser.parse_args()
test = JamiTest("test", args) test = JamiTest("test", args)
test.run() test.run()
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment