Skip to content
Snippets Groups Projects
Unverified Commit f1231bb9 authored by Pasquale Toscano's avatar Pasquale Toscano Committed by GitHub
Browse files

Add molecule for Kata Containers with Containerd (#6905)

parent 80eb1ad9
No related branches found
No related tags found
No related merge requests found
---
- name: Converge
hosts: all
become: true
vars:
kata_containers_enabled: true
roles:
- role: kubespray-defaults
- role: containerd
- role: kata-containers
---
driver:
name: vagrant
provider:
name: libvirt
options:
driver: kvm
lint: |
set -e
yamllint -c ../../../.yamllint .
platforms:
- name: ubuntu18
box: generic/ubuntu1804
cpus: 1
memory: 1024
nested: true
groups:
- kube-master
- name: ubuntu20
box: generic/ubuntu2004
cpus: 1
memory: 1024
nested: true
groups:
- kube-master
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../../
config_options:
defaults:
callback_whitelist: profile_tasks
lint:
name: ansible-lint
options:
c: ../../../.ansible-lint
inventory:
group_vars:
all:
become: true
verifier:
name: testinfra
lint:
name: flake8
---
- name: Prepare
hosts: all
gather_facts: False
roles:
- role: bootstrap-os
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_run(host):
kataruntime = "/opt/kata/bin/kata-runtime"
with host.sudo():
cmd = host.command(kataruntime + " version")
assert cmd.rc == 0
assert "kata-runtime" in cmd.stdout
def test_run_pod(host):
image = "docker.io/library/hello-world:latest"
runtime = "io.containerd.kata-qemu.v2"
pull_command = "ctr image pull {}".format(image)
with host.sudo():
cmd = host.command(pull_command)
assert cmd.rc == 0
run_command = "ctr run --runtime {} {} kata1".format(runtime, image)
with host.sudo():
cmd = host.command(run_command)
assert cmd.rc == 0
assert "Hello from Docker!" in cmd.stdout
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment