def test_start_add_node(self): hub = GridHub() ip = hub.get_ip() print "Grid Hub IP: " + hub.get_ip() # sudo docker run -d -e GRID_IP=${GRID_IP} brady/${1}-node adapter = DockerAdapter() response = adapter.client.create_container('brady/firefox-node', [], environment={"GRID_IP": ip}) if response['Id']: adapter.client.start(response)
def add(browser): """ @type browser: string @param browser: Browser Name @rtype: bool @return: True on success """ hub = GridHub() return hub.add_node(browser)
def start(): """ @rtype: bool @return: True on success """ hub = GridHub() try: hub.start() # TODO: Verify Started return True except Exception: return False
def get_status(): hub = GridHub() ff_count = 0 ph_count = 0 ch_count = 0 nodes = hub.get_nodes() for node in nodes: if "firefox" in node["Image"]: ff_count += 1 elif "phantomjs" in node["Image"]: ph_count += 1 elif "chrome" in node["Image"]: ch_count += 1 status = {"Ip": hub.get_ip(), "firefox_count": ff_count, "phantomjs_count": ph_count, "chrome_count": ch_count} return status
def get_status(): hub = GridHub() ff_count = 0 ph_count = 0 ch_count = 0 nodes = hub.get_nodes() for node in nodes: if "firefox" in node['Image']: ff_count += 1 elif "phantomjs" in node['Image']: ph_count += 1 elif "chrome" in node['Image']: ch_count += 1 status = { "Ip": hub.get_ip(), "firefox_count": ff_count, "phantomjs_count": ph_count, "chrome_count": ch_count } return status
def restart_nodes(browser=None): hub = GridHub() return hub.restart_nodes(browser)
def test_grid_shutdown(self): hub = GridHub() hub.shutdown()
def is_running(): hub = GridHub() return hub.is_running()
def shutdown(): hub = GridHub() hub.shutdown()
def stop_nodes(): hub = GridHub() return hub.stop_nodes()
def test_grid_start(self): hub = GridHub() hub.start()
def __init__(self): self.hub = GridHub()