Add molecule for Kata Containers with Containerd (#6905)
This commit is contained in:
parent
80eb1ad936
commit
f1231bb97d
4 changed files with 90 additions and 0 deletions
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
vars:
|
||||
kata_containers_enabled: true
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: containerd
|
||||
- role: kata-containers
|
|
@ -0,0 +1,44 @@
|
|||
---
|
||||
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
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
gather_facts: False
|
||||
roles:
|
||||
- role: bootstrap-os
|
|
@ -0,0 +1,30 @@
|
|||
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
|
Loading…
Reference in a new issue