test_task: update task ls due to backend logging updates (#882)

This commit is contained in:
tamarrow
2017-01-19 22:29:25 -08:00
committed by GitHub
parent 95dea4e3a3
commit 4f54f2e91b
3 changed files with 21 additions and 15 deletions

Binary file not shown.

View File

@@ -69,12 +69,13 @@ def test_get_missing_property(env):
def test_dcos_url_without_scheme(env):
old = b'http://dcos.snakeoil.mesosphere.com'
new = b"abc.com"
out = b"[core.dcos_url]: changed from '%s' to 'https://%s'\n" % (old, new)
assert_command(['dcos', 'config', 'set', 'core.dcos_url', new],
returncode=0,
stderr=out,
env=env)
config_set('core.dcos_url', old, env)
out = b"[core.dcos_url]: changed from '%b' to 'https://%b'\n" % (old, new)
assert_command(
['dcos', 'config', 'set', 'core.dcos_url', new.decode('utf-8')],
returncode=0,
stderr=out,
env=env)
config_set('core.dcos_url', old.decode('utf-8'), env)
def test_get_top_property(env):

View File

@@ -242,7 +242,7 @@ def test_ls_no_params():
assert returncode == 0
assert stderr == b''
ls_line = 'stderr stdout'
ls_line = 'stderr.*stdout'
lines = stdout.decode('utf-8').split('\n')
assert len(lines) == 7
assert re.match('===>.*<===', lines[0])
@@ -254,13 +254,15 @@ def test_ls_no_params():
def test_ls():
stdout = b'stderr stdout\n'
stderr_log = b'stderr stderr.logrotate.conf stderr.logrotate.state'
stdout_log = b'stdout stdout.logrotate.conf stdout.logrotate.state'
log_line = stderr_log + b' ' + stdout_log + b'\n'
assert_command(['dcos', 'task', 'ls', 'test-app1'],
stdout=stdout)
stdout=log_line)
def test_ls_multiple_tasks():
ls_line = 'stderr stdout'
ls_line = 'stderr.*stdout'
returncode, stdout, stderr = exec_command(
['dcos', 'task', 'ls', 'test-app'])
lines = stdout.decode('utf-8').split('\n')
@@ -275,7 +277,7 @@ def test_ls_multiple_tasks():
def test_ls_long():
assert_lines(['dcos', 'task', 'ls', '--long', 'test-app1'], 2)
assert_lines(['dcos', 'task', 'ls', '--long', 'test-app1'], 6)
def test_ls_path():
@@ -308,14 +310,17 @@ def test_ls_completed():
returncode, stdout, stderr = exec_command(
['dcos', 'task', 'ls', '--completed', task_id_completed])
out = b'stderr stdout\n'
ls_line = 'stderr.*stdout'
returncode, stdout, stderr = exec_command(
['dcos', 'task', 'ls', 'test-app'])
lines = stdout.decode('utf-8').split('\n')
assert returncode == 0
assert stdout == out
assert re.match(ls_line, lines[1])
assert stderr == b''
@pytest.mark.skipif('DCOS_DEBUGGING_ENABLED' not in os.environ,
reason="Requires Agent Dbugging APIs")
reason="Requires Agent Debugging APIs")
def test_exec_non_interactive():
with open('tests/data/tasks/lorem-ipsum.txt') as text:
content = text.read()
@@ -329,7 +334,7 @@ def test_exec_non_interactive():
@pytest.mark.skipif('DCOS_DEBUGGING_ENABLED' not in os.environ,
reason="Requires Agent Dbugging APIs")
reason="Requires Agent Debugging APIs")
def test_exec_interactive():
with open('tests/data/tasks/lorem-ipsum.txt') as text:
content = bytes(text.read(), 'UTF-8')