test_05_custom_docker_in_persistent_console.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import subprocess
  2. import pytest
  3. import rostest.util as u
  4. ssh_command = ['./scripts/ssh', '--qemu', '--key', './tests/integration/assets/test.key']
  5. cloud_config_path = './tests/integration/assets/test_05/cloud-config.yml'
  6. @pytest.fixture(scope="module")
  7. def qemu(request):
  8. q = u.run_qemu(request, ['--cloud-config', cloud_config_path])
  9. u.flush_out(q.stdout)
  10. return q
  11. docker_url = {'amd64': 'https://experimental.docker.com/builds/Linux/x86_64/docker-1.10.0-dev',
  12. 'arm': 'https://github.com/rancher/docker/releases/download/v1.10.3-arm/docker-1.10.3_arm',
  13. 'arm64': 'https://github.com/rancher/docker/releases/download/v1.10.3-arm/docker-1.10.3_arm64'}
  14. @pytest.mark.timeout(40)
  15. def test_system_docker_survives_custom_docker_install(qemu):
  16. u.wait_for_ssh(qemu, ssh_command)
  17. subprocess.check_call(ssh_command + ['curl', '-Lfo', './docker', docker_url[u.arch]],
  18. stderr=subprocess.STDOUT, universal_newlines=True)
  19. subprocess.check_call(ssh_command + ['chmod', '+x', '/home/rancher/docker'],
  20. stderr=subprocess.STDOUT, universal_newlines=True)
  21. subprocess.check_call(ssh_command + ['sudo', 'ln', '-sf', '/home/rancher/docker', '/usr/bin/docker'],
  22. stderr=subprocess.STDOUT, universal_newlines=True)
  23. subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'restart', 'docker'],
  24. stderr=subprocess.STDOUT, universal_newlines=True)
  25. subprocess.check_call(ssh_command + ['sudo', 'system-docker', 'version'],
  26. stderr=subprocess.STDOUT, universal_newlines=True)
  27. u.wait_for_ssh(qemu, ssh_command)