Пример #1
0
def test_node_log_invalid_lines():
    assert_command(['dcos', 'node', 'log', '--leader', '--lines=bogus'],
                   stdout=b'',
                   stderr=b'Error parsing string as int\n',
                   returncode=1)
Пример #2
0
def test_log_config():
    assert_command(
        ['dcos', 'service', 'log', 'chronos', '--ssh-config-file=/path'],
        stderr=(b'The `--ssh-config-file` argument is invalid for '
                b'non-marathon services. SSH is not used.\n'),
        returncode=1)
Пример #3
0
def test_help():
    with open('dcoscli/data/help/service.txt') as content:
        assert_command(['dcos', 'service', '--help'],
                       stdout=content.read().encode('utf-8'))
Пример #4
0
def test_describe_nonexistent_version():
    stderr = b'Error: Version [a.b.c] of package [helloworld] not found\n'
    assert_command(['dcos', 'package', 'describe', 'helloworld',
                    '--package-version=a.b.c'],
                   stderr=stderr,
                   returncode=1)
Пример #5
0
def _repo_remove(args=[], repo_list=[]):
    assert_command(['dcos', 'package', 'repo', 'remove'] + args)
    assert_command(['dcos', 'package', 'repo', 'list'], stdout=repo_list)
Пример #6
0
def test_info():
    stdout = b'Manage your DC/OS clusters\n'
    assert_command(['dcos', 'cluster', '--info'], stdout=stdout)
Пример #7
0
def test_node_log_empty():
    stderr = b"Error: '--leader' or '<mesos-id>' must be provided\n"
    assert_command(['dcos', 'node', 'log'], returncode=1, stderr=stderr)
Пример #8
0
def test_show_job_with_invalid_jobname():
    assert_command(['dcos', 'job', 'show', 'invalid'],
                   stdout=b'',
                   stderr=b'Error: job "invalid" does not exist\n',
                   returncode=1)
Пример #9
0
def test_list_version_negative_max_count():
    assert_command(['dcos', 'marathon', 'app', 'version', 'list',
                    'missing-id', '--max-count=-1'],
                   returncode=1,
                   stderr=b'Maximum count must be a positive number: -1\n')
Пример #10
0
def test_show_job_queue_blank_for_job():
    assert_command(['dcos', 'job', 'queue', 'magikarp'],
                   stdout=b"",
                   stderr=b'Error: job "magikarp" does not exist\n',
                   returncode=1)
Пример #11
0
def _update_job(app_id, file_path):
    assert_command(['dcos', 'job', 'update', file_path])
Пример #12
0
def test_node_log_empty():
    stderr = b"You must choose one of --leader or --mesos-id.\n"
    assert_command(['dcos', 'node', 'log'], returncode=1, stderr=stderr)
Пример #13
0
def test_info():
    stdout = b"View DC/OS node information\n"
    assert_command(['dcos', 'node', '--info'], stdout=stdout)
Пример #14
0
def test_help():
    with open('dcoscli/data/help/node.txt') as content:
        stdout = six.b(content.read())
    assert_command(['dcos', 'node', '--help'], stdout=stdout)
Пример #15
0
def test_rollback_missing_deployment():
    assert_command(
        ['dcos', 'marathon', 'deployment', 'rollback', 'missing-deployment'],
        returncode=1,
        stderr=b'Error: DeploymentPlan missing-deployment does not exist\n')
Пример #16
0
def test_add_app_bad_resource():
    stderr = (b'Can\'t read from resource: bad_resource.\n'
              b'Please check that it exists.\n')
    assert_command(['dcos', 'marathon', 'app', 'add', 'bad_resource'],
                   returncode=1,
                   stderr=stderr)
Пример #17
0
def test_ping():
    assert_command(['dcos', 'marathon', 'ping'],
                   stdout=b'Marathon ping response[1x]: "pong"\n')
Пример #18
0
def test_update_missing_app():
    assert_command(['dcos', 'marathon', 'app', 'update', 'missing-id'],
                   stderr=b"Error: App '/missing-id' does not exist\n",
                   returncode=1)
Пример #19
0
def test_version():
    stdout = b'dcos-cluster version SNAPSHOT\n'
    assert_command(['dcos', 'cluster', '--version'], stdout=stdout)
Пример #20
0
def test_help():
    with open('tests/data/marathon/help.txt') as content:
        assert_command(['dcos', 'marathon', '--help'],
                       stdout=content.read().encode('utf-8'))
Пример #21
0
def test_describe_nonexistent():
    stderr = b"Error: Package [xyzzy] not found\n"
    assert_command(['dcos', 'package', 'describe', 'xyzzy'],
                   stderr=stderr,
                   returncode=1)
Пример #22
0
def test_version():
    assert_command(['dcos', 'marathon', '--version'],
                   stdout=b'dcos-marathon version SNAPSHOT\n')
Пример #23
0
def _list(args, stdout):
    assert_command(['dcos', 'package', 'list'] + args, stdout=stdout)
Пример #24
0
def test_restarting_missing_app():
    assert_command(['dcos', 'marathon', 'app', 'restart', 'missing-id'],
                   returncode=1,
                   stderr=b"Error: app '/missing-id' does not exist\n")
Пример #25
0
def test_log_marathon_file():
    assert_command(['dcos', 'service', 'log', 'marathon', 'stderr'],
                   stderr=(b'The <file> argument is invalid for marathon. ' +
                           b'The systemd journal is always used for the ' +
                           b'marathon log.\n'),
                   returncode=1)
Пример #26
0
def test_info():
    assert_command(['dcos', 'marathon', '--info'],
                   stdout=b'Deploy and manage applications to DC/OS\n')
Пример #27
0
def test_log_no_apps():
    assert_command(['dcos', 'service', 'log', 'bogus'],
                   stderr=b'No marathon apps found for service [bogus]\n',
                   returncode=1)
Пример #28
0
def test_list_version_missing_app():
    assert_command(
        ['dcos', 'marathon', 'app', 'version', 'list', 'missing-id'],
        returncode=1,
        stderr=b"Error: Marathon API error: App '/missing-id' does not exist\n"
    )
Пример #29
0
def test_info():
    stdout = b"Manage DC/OS services\n"
    assert_command(['dcos', 'service', '--info'], stdout=stdout)
Пример #30
0
def test_repo_list():
    repo_list = file_json('tests/data/package/json/test_repo_list.json')
    assert_command(['dcos', 'package', 'repo', 'list', '--json'],
                   stdout=repo_list)