def test_spam_out(self): """ Launch client in container and stress test the communication out """ ca = ContainerApp() try: serv = dbusapp.Server() serv.start() ca.start() ca.dbusGateway() clients = 100 message_size = 8192 # Bytes t0 = time.time() for x in range(0, clients): ca.launchCommand('{}/dbusapp.py client --size {}'.format( ca.getBindDir(), message_size)) t1 = time.time() self.assertTrue(serv.wait_until_requests(multiplier=clients)) t2 = time.time() print("\n") print("Clients started: {0:.4f} seconds\n".format(t1 - t0)) print("Server received all messages: {0:.4f} seconds\n".format(t2 - t1)) print("Total time: {0:.4f} seconds\n".format(t2 - t0)) finally: ca.terminate() serv.terminate() serv = None
def test_spam_out(self): """ Launch client in container and stress test the communication out """ ca = Container() try: serv = dbusapp.Server(TESTOUTPUT_DIR) serv.start() ca.start(DATA) ca.set_capabilities(["test.cap.gwconfig"]) clients = 100 message_size = 8192 # Bytes t0 = time.time() for x in range(0, clients): ca.launch_command('{}/dbusapp.py client --size {}'.format( ca.get_bind_dir(), message_size)) t1 = time.time() assert serv.wait_until_requests(multiplier=clients) is True t2 = time.time() print("\n") print("Clients started: {0:.4f} seconds\n".format(t1 - t0)) print("Server received all messages: {0:.4f} seconds\n".format(t2 - t1)) print("Total time: {0:.4f} seconds\n".format(t2 - t0)) finally: ca.terminate() serv.terminate() serv = None
def test_enableWriteBuffer_flag(self): ca = ContainerApp() try: serv = dbusapp.Server() serv.start() ca.start(enableWriteBuffer=True) ca.dbusGateway() ca.launchCommand('{}/dbusapp.py client'.format(ca.getBindDir())) self.assertTrue(serv.wait_until_requests()) finally: ca.terminate() serv.terminate() serv = None
def test_query_out(self): """ Launch client in container and test if it communicates out """ for x in range(0, 10): serv = dbusapp.Server() serv.start() ca = ContainerApp() try: ca.start() ca.dbusGateway() ca.launchCommand('{}/dbusapp.py client'.format( ca.getBindDir())) self.assertTrue(serv.wait_until_requests()) finally: ca.terminate() serv.terminate() serv = None
def test_query_out(self): """ Launch client in container and test if it communicates out """ for x in range(0, 10): serv = dbusapp.Server() serv.start() ca = Container() try: ca.start(DATA) ca.set_capabilities(["test.cap.gwconfig"]) ca.launch_command('{}/dbusapp.py client'.format( ca.get_bind_dir())) assert serv.wait_until_requests() is True finally: ca.terminate() serv.terminate() serv = None