Skip to content

Commit 6060ccd

Browse files
committed
net_tests: adapt to ipv6 only clusters
1 parent 8559084 commit 6060ccd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/testcases/030_check-network.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,19 @@
9191
command: "{{ bin_dir }}/kubectl rollout status deploy --namespace test agnhost --timeout=180s"
9292
changed_when: false
9393
- name: Get pod names
94-
command: "{{ bin_dir }}/kubectl get pods -n test -o json"
94+
command: "{{ bin_dir }}/kubectl get pods -n test --field-selector status.phase=Running -o json"
9595
changed_when: false
9696
register: pods_json
9797

9898
- name: Check pods IP are in correct network
9999
assert:
100-
that: pods
101-
| selectattr('status.phase', '==', 'Running')
102-
| selectattr('status.podIP', 'ansible.utils.in_network', kube_pods_subnet)
103-
| length == 2
100+
that:
101+
- not ipv4_stack or
102+
(pods | map(attribute='status.podIPs') | flatten | map(attribute='ip)
103+
| select('ansible.utils.in_network', kube_pods_subnet)) | length == 2
104+
- not ipv6_stack or
105+
(pods | map(attribute='status.podIPs') | flatten | map(attribute='ip)
106+
| select('ansible.utils.in_network', kube_pods_subnet_ipv6)) | length == 2
104107

105108
- name: Curl between pods is working
106109
command: "{{ bin_dir }}/kubectl -n test exec {{ item[0].metadata.name }} -- curl {{ item[1].status.podIP | ansible.utils.ipwrap}}:8080"

0 commit comments

Comments
 (0)