Ejemplo n.º 1
0
def test_log_marathon_config():
    stdout, stderr, _ = ssh_output(
        'dcos service log marathon ' +
        '--ssh-config-file=tests/data/node/ssh_config')

    assert stdout == b''
    assert b'ignoring bad proto spec' in stderr
Ejemplo n.º 2
0
def test_log_marathon():
    stdout, stderr, _ = ssh_output(
        'dcos service log marathon ' +
        '--ssh-config-file=tests/data/service/ssh_config')

    assert len(stdout.decode('utf-8').split('\n')) > 10

    assert b"Running `" in stderr
    num_lines = len(stderr.decode('utf-8').split('\n'))
    assert ((num_lines == 2)
            or (num_lines == 3 and b'Warning: Permanently added' in stderr))
Ejemplo n.º 3
0
def _node_ssh_output(args):
    cli_test_ssh_key_path = os.environ['CLI_TEST_SSH_KEY_PATH']

    if os.environ.get('CLI_TEST_SSH_USER') and \
            not any("--user" in a for a in args):
        args.extend(['--user', os.environ.get('CLI_TEST_SSH_USER')])

    if os.environ.get('CLI_TEST_MASTER_PROXY') and \
            '--master-proxy' not in args:
        args.append('--master-proxy')

    cmd = ('ssh-agent /bin/bash -c "ssh-add {} 2> /dev/null && ' +
           'dcos node ssh --option StrictHostKeyChecking=no ' +
           '    --option ConnectTimeout=5 {}"').format(cli_test_ssh_key_path,
                                                       ' '.join(args))

    return ssh_output(cmd)