def test_pod_status_all(): jsonobj = sdk_cmd.svc_cli(config.PACKAGE_NAME, FOLDERED_SERVICE_NAME, 'pod status', json=True) assert len(jsonobj) == config.configured_task_count(FOLDERED_SERVICE_NAME) for k, v in jsonobj.items(): assert re.match('(hello|world)-[0-9]+', k) assert len(v) == 1 task = v[0] assert len(task) == 3 assert re.match('(hello|world)-[0-9]+-server__[0-9a-f-]+', task['id']) assert re.match('(hello|world)-[0-9]+-server', task['name']) assert task['state'] == 'TASK_RUNNING'
def test_pod_status_all(): stdout = sdk_cmd.run_cli('hello-world --name={} pod status'.format(FOLDERED_SERVICE_NAME)) jsonobj = json.loads(stdout) assert len(jsonobj) == config.configured_task_count(FOLDERED_SERVICE_NAME) for k, v in jsonobj.items(): assert re.match('(hello|world)-[0-9]+', k) assert len(v) == 1 task = v[0] assert len(task) == 3 assert re.match('(hello|world)-[0-9]+-server__[0-9a-f-]+', task['id']) assert re.match('(hello|world)-[0-9]+-server', task['name']) assert task['state'] == 'TASK_RUNNING'
def test_pods_status_all(): stdout = cmd.run_cli('hello-world pods status') jsonobj = json.loads(stdout) assert len(jsonobj) == configured_task_count() for k, v in jsonobj.items(): assert re.match('(hello|world)-[0-9]+', k) assert len(v) == 1 task = v[0] assert len(task) == 3 assert re.match('(hello|world)-[0-9]+-server__[0-9a-f-]+', task['id']) assert re.match('(hello|world)-[0-9]+-server', task['name']) assert task['state'] == 'TASK_RUNNING'
def test_pod_status_all(): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) jsonobj = sdk_cmd.svc_cli(config.PACKAGE_NAME, foldered_name, 'pod status', json=True) assert len(jsonobj) == config.configured_task_count(foldered_name) for k, v in jsonobj.items(): assert re.match('(hello|world)-[0-9]+', k) assert len(v) == 1 task = v[0] assert len(task) == 3 assert re.match('(hello|world)-[0-9]+-server__[0-9a-f-]+', task['id']) assert re.match('(hello|world)-[0-9]+-server', task['name']) assert task['state'] == 'TASK_RUNNING'
def test_pod_list(): jsonobj = sdk_cmd.svc_cli(config.PACKAGE_NAME, FOLDERED_SERVICE_NAME, 'pod list', json=True) assert len(jsonobj) == config.configured_task_count(FOLDERED_SERVICE_NAME) # expect: X instances of 'hello-#' followed by Y instances of 'world-#', # in alphanumerical order first_world = -1 for i in range(len(jsonobj)): entry = jsonobj[i] if first_world < 0: if entry.startswith('world-'): first_world = i if first_world == -1: assert jsonobj[i] == 'hello-{}'.format(i) else: assert jsonobj[i] == 'world-{}'.format(i - first_world)
def test_pods_list(): stdout = cmd.run_cli('hello-world pods list') jsonobj = json.loads(stdout) assert len(jsonobj) == configured_task_count() # expect: X instances of 'hello-#' followed by Y instances of 'world-#', # in alphanumerical order first_world = -1 for i in range(len(jsonobj)): entry = jsonobj[i] if first_world < 0: if entry.startswith('world-'): first_world = i if first_world == -1: assert jsonobj[i] == 'hello-{}'.format(i) else: assert jsonobj[i] == 'world-{}'.format(i - first_world)
def test_pod_list(): foldered_name = sdk_utils.get_foldered_name(config.SERVICE_NAME) jsonobj = sdk_cmd.svc_cli(config.PACKAGE_NAME, foldered_name, 'pod list', json=True) assert len(jsonobj) == config.configured_task_count(foldered_name) # expect: X instances of 'hello-#' followed by Y instances of 'world-#', # in alphanumerical order first_world = -1 for i in range(len(jsonobj)): entry = jsonobj[i] if first_world < 0: if entry.startswith('world-'): first_world = i if first_world == -1: assert jsonobj[i] == 'hello-{}'.format(i) else: assert jsonobj[i] == 'world-{}'.format(i - first_world)
def test_pod_list(): rc, stdout, _ = sdk_cmd.svc_cli(config.PACKAGE_NAME, foldered_name, "pod list") assert rc == 0, "Pod list failed" jsonobj = json.loads(stdout) assert len(jsonobj) == config.configured_task_count(foldered_name) # expect: X instances of 'hello-#' followed by Y instances of 'world-#', # in alphanumerical order first_world = -1 for i in range(len(jsonobj)): entry = jsonobj[i] if first_world < 0: if entry.startswith("world-"): first_world = i if first_world == -1: assert jsonobj[i] == "hello-{}".format(i) else: assert jsonobj[i] == "world-{}".format(i - first_world)