def test_add_existing_group(): with group(GOOD_GROUP, 'test-group'): with open(GOOD_GROUP) as fd: stderr = b"Group '/test-group' already exists\n" assert_command(['dcos', 'marathon', 'group', 'add'], returncode=1, stderr=stderr, stdin=fd)
def test_scale_group(): with group(SCALE_GROUP, 'scale-group'): returncode, stdout, stderr = exec_command( ['dcos', 'marathon', 'group', 'scale', 'scale-group', '2']) assert stderr == b'' assert returncode == 0 watch_all_deployments() returncode, stdout, stderr = exec_command( ['dcos', 'marathon', 'group', 'show', 'scale-group']) res = json.loads(stdout.decode('utf-8')) assert res['groups'][0]['apps'][0]['instances'] == 2
def test_update_group(): group_app = 'tests/data/marathon/groups/good.json' with group(group_app, 'test-group'): newapp = json.dumps([{"id": "appadded", "cmd": "sleep 0"}]) appjson = "apps={}".format(newapp) returncode, stdout, stderr = exec_command([ 'dcos', 'marathon', 'group', 'update', 'test-group/sleep', appjson ]) assert returncode == 0 assert stdout.decode().startswith('Created deployment ') assert stderr == b'' watch_all_deployments() show_app('test-group/sleep/appadded')
def test_update_group_from_stdin(): with group(GOOD_GROUP, 'test-group'): _update_group( 'test-group', 'tests/data/marathon/groups/update_good.json') show_app('test-group/updated')
def test_validate_complicated_group_and_app(): with group('tests/data/marathon/groups/complicated.json', 'test-group'): pass
def test_group_list_table(): with group(GOOD_GROUP, 'test-group'): assert_lines(['dcos', 'marathon', 'group', 'list'], 3)
def test_scale_group_when_scale_factor_not_float(): with group(SCALE_GROUP, 'scale-group'): returncode, stdout, stderr = exec_command( ['dcos', 'marathon', 'group', 'scale', 'scale-group', '1.a']) assert stderr == b'Error parsing string as float\n' assert returncode == 1
def test_scale_group_when_scale_factor_negative(): with group(SCALE_GROUP, 'scale-group'): returncode, stdout, stderr = exec_command( ['dcos', 'marathon', 'group', 'scale', 'scale-group', '-2']) assert b'Invalid subcommand usage' in stdout assert returncode == 1
def test_add_group(): group_id = 'test-group' with group('tests/data/marathon/groups/good.json', group_id): show_group(group_id)