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.

30 lines
846 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. kataruntime = "/opt/kata/bin/kata-runtime"
  7. with host.sudo():
  8. cmd = host.command(kataruntime + " version")
  9. assert cmd.rc == 0
  10. assert "kata-runtime" in cmd.stdout
  11. def test_run_pod(host):
  12. image = "docker.io/library/hello-world:latest"
  13. runtime = "io.containerd.kata-qemu.v2"
  14. pull_command = "ctr image pull {}".format(image)
  15. with host.sudo():
  16. cmd = host.command(pull_command)
  17. assert cmd.rc == 0
  18. run_command = "ctr run --runtime {} {} kata1".format(runtime, image)
  19. with host.sudo():
  20. cmd = host.command(run_command)
  21. assert cmd.rc == 0
  22. assert "Hello from Docker!" in cmd.stdout