You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
789 B

  1. import os
  2. import testinfra.utils.ansible_runner
  3. testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
  4. os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
  5. def test_run(host):
  6. gvisorruntime = "/usr/local/bin/runsc"
  7. with host.sudo():
  8. cmd = host.command(gvisorruntime + " --version")
  9. assert cmd.rc == 0
  10. assert "runsc version" in cmd.stdout
  11. def test_run_pod(host):
  12. runtime = "runsc"
  13. run_command = "/usr/local/bin/crictl run --with-pull --runtime {} /tmp/container.json /tmp/sandbox.json".format(runtime)
  14. with host.sudo():
  15. cmd = host.command(run_command)
  16. assert cmd.rc == 0
  17. with host.sudo():
  18. log_f = host.file("/tmp/gvisor1.0.log")
  19. assert log_f.exists
  20. assert b"Hello from Docker!" in log_f.content