Add complete test integration

This commit is contained in:
ant31
2016-02-10 11:51:39 +01:00
parent 09851621de
commit caa2555b1d
18 changed files with 1566 additions and 25 deletions

View 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

View 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

View 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] }}"