mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-28 09:39:12 +03:00
Add complete test integration
This commit is contained in:
12
tests/testcases/010_check-apiserver.yml
Normal file
12
tests/testcases/010_check-apiserver.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- hosts: kube-master
|
||||
|
||||
tasks:
|
||||
- name: Check the API servers are responding
|
||||
local_action:
|
||||
module: uri
|
||||
url: https://{{ansible_ssh_host}}/api/v1
|
||||
user: kube
|
||||
password: changeme
|
||||
validate_certs: no
|
||||
status_code: 200
|
||||
13
tests/testcases/020_check-create-pod.yml
Normal file
13
tests/testcases/020_check-create-pod.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
- hosts: node1
|
||||
|
||||
tasks:
|
||||
- name: Run a replica controller composed of 2 pods
|
||||
shell: "kubectl run test --image=busybox --replicas=2 --command -- tail -f /dev/null"
|
||||
|
||||
- name: Pods are running
|
||||
shell: "kubectl get pods --no-headers -o json"
|
||||
register: run_pods_log
|
||||
until: (run_pods_log.stdout | from_json)['items'] | map(attribute = 'status.phase') | join(',') == "Running,Running"
|
||||
retries: 24
|
||||
delay: 5
|
||||
21
tests/testcases/030_check-network.yml
Normal file
21
tests/testcases/030_check-network.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- hosts: node1
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Get pod names
|
||||
shell: "kubectl get pods -o json"
|
||||
register: pods
|
||||
|
||||
- set_fact:
|
||||
pod_names: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'metadata.name') | list }}"
|
||||
pod_ips: "{{ (pods.stdout | from_json)['items'] | map(attribute = 'status.podIP') | list }}"
|
||||
|
||||
- name: Check pods IP are in correct network
|
||||
assert:
|
||||
that: item | ipaddr(kube_pods_subnet)
|
||||
with_items: pod_ips
|
||||
|
||||
|
||||
- name: Ping between pods is working
|
||||
shell: "kubectl exec {{pod_names[0]}} -- ping -c 4 {{ pod_ips[1] }}"
|
||||
Reference in New Issue
Block a user