def client_03(port, prefix): c = RemoteControl(('', port), None, timeout=10) while True: if random.random() > 0.7: c = RemoteControl(('', port), None, timeout=10) try: c.raise_ave_exception({'message': 'hello', 'recognize': 'me'}) except Exit: os._exit(0) except AveException, e: if 'recognize' in e.details: continue print('client PID=%d got exception: %s' % (os.getpid(), e)) os._exit(2) except Exception, e: print('client PID=%d got exception: %s' % (os.getpid(), e)) os._exit(1)
try: c.raise_ave_exception({'message': 'foo', 'extras': 'bar'}) except AveException, e: pass # expected except Exception, e: print('FAIL %s: could not raise RPC exception: %s' % (pretty, e)) return False # set the client side GUID and make another failed call. this exception # should be logged to panotti. vcsjob.set_guid('example_guid') c = RemoteControl(c.address, None, 1, home=factory.HOME.path) exc = None try: c.raise_ave_exception({'message': 'cow', 'extras': 'cat'}) except AveException, e: exc = e # expected except Exception, e: print('FAIL %s: could not raise RPC exception: %s' % (pretty, e)) return False time.sleep(1) # give asynchronous events some time to settle # expect to find the same exception in the panotti server log, with the # guid and time stamp patched in log = s.get_log('foo') if len(log) != 1: print('FAIL %s: wrong number of log entries: %s' % (pretty, log)) return False