Add molecule tests to containerd role (#6037)
parent
db5f83f8c9
commit
e4c820c35e
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
provider:
|
||||
name: libvirt
|
||||
lint:
|
||||
name: yamllint
|
||||
options:
|
||||
config-file: ../../../.yamllint
|
||||
platforms:
|
||||
- name: ubuntu18
|
||||
box: generic/ubuntu1804
|
||||
cpus: 2
|
||||
memory: 1024
|
||||
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
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
roles:
|
||||
- role: kubespray-defaults
|
||||
- role: containerd
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
gather_facts: False
|
||||
roles:
|
||||
- role: bootstrap-os
|
|
@ -0,0 +1,21 @@
|
|||
import os
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
|
||||
def test_service(host):
|
||||
svc = host.service("containerd")
|
||||
assert svc.is_running
|
||||
assert svc.is_enabled
|
||||
|
||||
|
||||
def test_run(host):
|
||||
crictl = "/usr/local/bin/crictl"
|
||||
path = "unix:///var/run/containerd/containerd.sock"
|
||||
with host.sudo():
|
||||
cmd = host.command(crictl + " --runtime-endpoint " + path + " version")
|
||||
assert cmd.rc == 0
|
||||
assert "RuntimeName: containerd" in cmd.stdout
|
|
@ -21,7 +21,13 @@
|
|||
group: no
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
|
||||
- name: Get crictl completion
|
||||
shell: "{{ bin_dir }}/crictl completion"
|
||||
changed_when: False
|
||||
register: cri_completion
|
||||
|
||||
- name: Install crictl completion
|
||||
shell: "{{ bin_dir }}/crictl completion >/etc/bash_completion.d/crictl"
|
||||
ignore_errors: True
|
||||
when: ansible_distribution in ["CentOS","RedHat", "Ubuntu", "Debian"]
|
||||
copy:
|
||||
dest: /etc/bash_completion.d/crictl
|
||||
content: "{{ cri_completion.stdout }}"
|
||||
become: True
|
Loading…
Reference in New Issue