Merge 020_check and 030_check (#4623)
* Merge 020_check and 030_check * Fix pods output and fail if test pods is not readypull/4450/head
parent
76db060afb
commit
6df8111cd4
|
@ -32,10 +32,7 @@ ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH}
|
||||||
## Test that all pods are Running
|
## Test that all pods are Running
|
||||||
ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER -b --become-user=root --limit "all:!fake_hosts" tests/testcases/015_check-pods-running.yml $LOG_LEVEL
|
ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER -b --become-user=root --limit "all:!fake_hosts" tests/testcases/015_check-pods-running.yml $LOG_LEVEL
|
||||||
|
|
||||||
## Test pod creation
|
## Test pod creation and ping between them
|
||||||
ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER -b --become-user=root --limit "all:!fake_hosts" tests/testcases/020_check-create-pod.yml $LOG_LEVEL
|
|
||||||
|
|
||||||
## Ping the between 2 pod
|
|
||||||
ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER -b --become-user=root --limit "all:!fake_hosts" tests/testcases/030_check-network.yml $LOG_LEVEL
|
ansible-playbook -i ${ANSIBLE_INVENTORY} -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER -b --become-user=root --limit "all:!fake_hosts" tests/testcases/030_check-network.yml $LOG_LEVEL
|
||||||
|
|
||||||
## Advanced DNS checks
|
## Advanced DNS checks
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
---
|
|
||||||
- hosts: kube-master[0]
|
|
||||||
|
|
||||||
vars:
|
|
||||||
test_image_repo: busybox
|
|
||||||
test_image_tag: latest
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
|
|
||||||
- name: Force binaries directory for Container Linux by CoreOS
|
|
||||||
set_fact:
|
|
||||||
bin_dir: "/opt/bin"
|
|
||||||
when: ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
bin_dir: "/usr/local/bin"
|
|
||||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
|
||||||
|
|
||||||
- name: Create test namespace
|
|
||||||
shell: "{{bin_dir}}/kubectl create namespace test"
|
|
||||||
|
|
||||||
- name: Run a replica controller composed of 2 pods in test ns
|
|
||||||
shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --namespace test --replicas=2 --command -- tail -f /dev/null"
|
|
||||||
|
|
||||||
- name: Pods are running
|
|
||||||
shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o json"
|
|
||||||
register: run_pods_log
|
|
||||||
until: [ '(run_pods_log.stdout | from_json)["items"] | map(attribute = "status.phase") | join(",") == "Running,Running"' ]
|
|
||||||
retries: 18
|
|
||||||
delay: 10
|
|
|
@ -1,8 +1,10 @@
|
||||||
---
|
---
|
||||||
- hosts: kube-master[0]
|
- hosts: kube-master[0]
|
||||||
|
vars:
|
||||||
|
test_image_repo: busybox
|
||||||
|
test_image_tag: latest
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Force binaries directory for Container Linux by CoreOS
|
- name: Force binaries directory for Container Linux by CoreOS
|
||||||
set_fact:
|
set_fact:
|
||||||
bin_dir: "/opt/bin"
|
bin_dir: "/opt/bin"
|
||||||
|
@ -12,6 +14,12 @@
|
||||||
bin_dir: "/usr/local/bin"
|
bin_dir: "/usr/local/bin"
|
||||||
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
when: not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"]
|
||||||
|
|
||||||
|
- name: Create test namespace
|
||||||
|
shell: "{{bin_dir}}/kubectl create namespace test"
|
||||||
|
|
||||||
|
- name: Run a replica controller composed of 2 pods in test ns
|
||||||
|
shell: "{{bin_dir}}/kubectl run test --image={{test_image_repo}}:{{test_image_tag}} --namespace test --replicas=2 --command -- tail -f /dev/null"
|
||||||
|
|
||||||
- name: Check that all pods are running and ready
|
- name: Check that all pods are running and ready
|
||||||
shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o yaml"
|
shell: "{{bin_dir}}/kubectl get pods --namespace test --no-headers -o yaml"
|
||||||
register: run_pods_log
|
register: run_pods_log
|
||||||
|
@ -30,6 +38,9 @@
|
||||||
register: pods
|
register: pods
|
||||||
no_log: true
|
no_log: true
|
||||||
|
|
||||||
|
- debug: msg="{{pods.stdout.split('\n')}}"
|
||||||
|
failed_when: not run_pods_log is success
|
||||||
|
|
||||||
- name: Get hostnet pods
|
- name: Get hostnet pods
|
||||||
command: "{{bin_dir}}/kubectl get pods -n test -o
|
command: "{{bin_dir}}/kubectl get pods -n test -o
|
||||||
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
jsonpath='{range .items[?(.spec.hostNetwork)]}{.metadata.name} {.status.podIP} {.status.containerStatuses} {end}'"
|
||||||
|
@ -79,3 +90,6 @@
|
||||||
with_nested:
|
with_nested:
|
||||||
- "{{pod_names}}"
|
- "{{pod_names}}"
|
||||||
- "{{pod_ips}}"
|
- "{{pod_ips}}"
|
||||||
|
|
||||||
|
- name: Delete test namespace
|
||||||
|
shell: "{{bin_dir}}/kubectl delete namespace test"
|
||||||
|
|
Loading…
Reference in New Issue