Beispiel #1
0
def test_rancher_environment(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(
        ssh_command + ['sudo', 'rancherctl', 'env', 'printenv', 'FLANNEL_NETWORK'],
        stderr=subprocess.STDOUT, universal_newlines=True)

    assert v.strip() == cloud_config['rancher']['environment']['FLANNEL_NETWORK']
Beispiel #2
0
def test_rancher_network(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(
        ssh_command + ['ip', 'route', 'get', 'to', '10.10.2.120'],
        stderr=subprocess.STDOUT, universal_newlines=True)

    assert v.split(' ')[2] == 'eth1'
    assert v.split(' ')[5] + '/24' == cloud_config['rancher']['network']['interfaces']['eth1']['address']
Beispiel #3
0
def test_docker_args(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(
        ssh_command + ['sh', '-c', 'ps -ef | grep docker'],
        stderr=subprocess.STDOUT, universal_newlines=True)

    expected = string.join(cloud_config['rancher']['docker']['args'])

    assert v.find(expected) != -1
Beispiel #4
0
def test_rancher_network(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(ssh_command +
                                ['ip', 'route', 'get', 'to', '10.10.2.120'],
                                stderr=subprocess.STDOUT,
                                universal_newlines=True)

    assert v.split(' ')[2] == 'eth1'
    assert v.split(' ')[5] + '/24' == cloud_config['rancher']['network'][
        'interfaces']['eth1']['address']
Beispiel #5
0
def test_docker_args(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(ssh_command +
                                ['sh', '-c', 'ps -ef | grep docker'],
                                stderr=subprocess.STDOUT,
                                universal_newlines=True)

    expected = string.join(cloud_config['rancher']['docker']['args'])

    assert v.find(expected) != -1
Beispiel #6
0
def test_rancher_environment(qemu, cloud_config):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)

    v = subprocess.check_output(
        ssh_command +
        ['sudo', 'rancherctl', 'env', 'printenv', 'FLANNEL_NETWORK'],
        stderr=subprocess.STDOUT,
        universal_newlines=True)

    assert v.strip(
    ) == cloud_config['rancher']['environment']['FLANNEL_NETWORK']
Beispiel #7
0
def test_run_system_container(qemu):
    assert qemu is not None
    u.wait_for_ssh()

    ssh = subprocess.Popen(
        './scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)

    with ssh, ssh.stdout as f:
        for ln in iter(f.readline, ''):
            print(str.strip(ln))

    assert ssh.returncode == 0
Beispiel #8
0
def test_run_system_container(qemu):
    assert qemu is not None
    u.wait_for_ssh()

    ssh = subprocess.Popen(
        './scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
        stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)

    for ln in u.iter_lines(ssh.stdout):
        print(ln)
    ssh.wait()

    assert ssh.returncode == 0
def test_reboot_with_container_running(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    subprocess.check_call(ssh_command + ['docker', 'run', '-d', '--restart=always', 'nginx'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.call(ssh_command + ['sudo', 'reboot'],
                    stderr=subprocess.STDOUT, universal_newlines=True)

    u.wait_for_ssh(ssh_command)
    v = subprocess.check_output(ssh_command + ['docker', 'ps', '-f', 'status=running'],
                                stderr=subprocess.STDOUT, universal_newlines=True)

    assert v.find('nginx') != -1
Beispiel #10
0
def test_ros_install_on_formatted_disk(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    subprocess.check_call(ssh_command + ['sudo', 'mkfs.ext4', '/dev/vda'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.check_call(ssh_command + ['sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda',
                                         '-i', 'rancher/os:v0.4.0-dev-test.135'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.call(ssh_command + ['sudo', 'reboot'],
                    stderr=subprocess.STDOUT, universal_newlines=True)

    u.wait_for_ssh(ssh_command)
Beispiel #11
0
def test_run_system_container(qemu):
    assert qemu is not None
    u.wait_for_ssh()

    ssh = subprocess.Popen(
        "./scripts/ssh sudo system-docker run --rm busybox /bin/true",
        shell=True,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        universal_newlines=True,
    )

    with ssh, ssh.stdout as f:
        for ln in iter(f.readline, ""):
            print(str.strip(ln))

    assert ssh.returncode == 0
Beispiel #12
0
def test_ros_install_on_formatted_disk(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    subprocess.check_call(ssh_command + ['sudo', 'mkfs.ext4', '/dev/vda'],
                          stderr=subprocess.STDOUT,
                          universal_newlines=True)

    subprocess.check_call(ssh_command + [
        'sudo', 'ros', 'install', '-f', '--no-reboot', '-d', '/dev/vda', '-i',
        'rancher/os:v0.4.0-dev-test.135'
    ],
                          stderr=subprocess.STDOUT,
                          universal_newlines=True)

    subprocess.call(ssh_command + ['sudo', 'reboot'],
                    stderr=subprocess.STDOUT,
                    universal_newlines=True)

    u.wait_for_ssh(ssh_command)
def test_reboot_with_container_running(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    subprocess.check_call(ssh_command +
                          ['docker', 'run', '-d', '--restart=always', 'nginx'],
                          stderr=subprocess.STDOUT,
                          universal_newlines=True)

    subprocess.call(ssh_command + ['sudo', 'reboot'],
                    stderr=subprocess.STDOUT,
                    universal_newlines=True)

    u.wait_for_ssh(ssh_command)
    v = subprocess.check_output(ssh_command +
                                ['docker', 'ps', '-f', 'status=running'],
                                stderr=subprocess.STDOUT,
                                universal_newlines=True)

    assert v.find('nginx') != -1
def test_system_docker_survives_custom_docker_install(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    subprocess.check_call(ssh_command + ['curl', '-OL',
                                         'https://get.docker.com/builds/Linux/x86_64/docker-1.9.0'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker-1.9.0'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker-1.9.0', '/usr/bin/docker'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'version'],
                          stderr=subprocess.STDOUT, universal_newlines=True)

    u.wait_for_ssh(ssh_command)
Beispiel #15
0
def test_ssh_authorized_keys(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    assert True
Beispiel #16
0
def test_ssh_authorized_keys(qemu):
    assert qemu is not None
    u.wait_for_ssh(ssh_command)
    assert True