ensure-kubernetes: move testing into common path

Currently we start a test pod for cri-o, but not for docker.  Move
this into post so both get coverage.

Change-Id: I768130982e22cb50e360646043ac095d77cca963
This commit is contained in:
Ian Wienand 2022-11-08 08:25:31 +11:00
parent 56e662d350
commit 64a60ea377
No known key found for this signature in database
2 changed files with 32 additions and 29 deletions

View File

@ -12,32 +12,3 @@
command: crictl version
become: yes
failed_when: false
# The default account is known to take a while to appear; see
# https://github.com/kubernetes/kubernetes/issues/66689
- name: Ensure default account created
command: kubectl -n default get serviceaccount default -o name
retries: 5
delay: 5
register: result
until: result.rc == 0
- name: Create a test pod definition
copy:
dest: test-pod.yaml
content: |
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
restartPolicy: Never
containers:
- name: test
image: k8s.gcr.io/pause:3.1
- name: Start pod
command: kubectl apply -f test-pod.yaml
- name: Check status
shell: sleep 5; kubectl get pods

View File

@ -1,3 +1,35 @@
- hosts: all
name: Post testing
tasks:
# The default account is known to take a while to appear; see
# https://github.com/kubernetes/kubernetes/issues/66689
- name: Ensure default account created
command: kubectl -n default get serviceaccount default -o name
retries: 5
delay: 5
register: result
until: result.rc == 0
- name: Create a test pod definition
copy:
dest: test-pod.yaml
content: |
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
restartPolicy: Never
containers:
- name: test
image: k8s.gcr.io/pause:3.1
- name: Start pod
command: kubectl apply -f test-pod.yaml
- name: Check status
shell: sleep 5; kubectl get pods
- hosts: all
roles:
- collect-container-logs