diff --git a/tests/testcases/030_check-network.yml b/tests/testcases/030_check-network.yml index a0b0a5c99..2acae6e8e 100644 --- a/tests/testcases/030_check-network.yml +++ b/tests/testcases/030_check-network.yml @@ -1,66 +1,10 @@ --- -- name: Create test namespace - command: "{{ bin_dir }}/kubectl create namespace test" - changed_when: false - -- name: Run 2 agnhost pods in test ns - command: - cmd: "{{ bin_dir }}/kubectl apply --namespace test -f -" - stdin: | - apiVersion: apps/v1 - kind: Deployment - metadata: - name: agnhost - spec: - replicas: 2 - selector: - matchLabels: - app: agnhost - template: - metadata: - labels: - app: agnhost - spec: - containers: - - name: agnhost - image: {{ test_image_repo }}:{{ test_image_tag }} - command: ['/agnhost', 'netexec', '--http-port=8080'] - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: ['ALL'] - runAsUser: 1000 - runAsNonRoot: true - seccompProfile: - type: RuntimeDefault - changed_when: false - -- name: Check that all pods are running and ready +- name: Run the hydrophone checks vars: - pods: "{{ (pods_json.stdout | from_json)['items'] }}" + networking_check: "\\[sig-network\\] Networking Granular Checks.+\\[Conformance\\]" block: - - name: Check Deployment is ready - command: "{{ bin_dir }}/kubectl rollout status deploy --namespace test agnhost --timeout=180s" - changed_when: false - - name: Get pod names - command: "{{ bin_dir }}/kubectl get pods -n test -o json" - changed_when: false - register: pods_json - - - name: Check pods IP are in correct network - assert: - that: pods - | selectattr('status.phase', '==', 'Running') - | selectattr('status.podIP', 'ansible.utils.in_network', kube_pods_subnet) - | length == 2 - - - name: Curl between pods is working - command: "{{ bin_dir }}/kubectl -n test exec {{ item[0].metadata.name }} -- curl {{ item[1].status.podIP | ansible.utils.ipwrap}}:8080" - with_nested: - - "{{ pods }}" - - "{{ pods }}" - loop_control: - label: "{{ item[0].metadata.name + ' --> ' + item[1].metadata.name }}" + - name: Run the networking granular checks + command: "{{ hydrophone_path }} --focus=\"{{ networking_check }}\" --parallel {{ hydrophone_parallel }}" rescue: - name: List pods cluster-wide command: "{{ bin_dir }}/kubectl get pods --all-namespaces -owide" diff --git a/tests/testcases/tests.yml b/tests/testcases/tests.yml index 8ec00785b..59e6e3827 100644 --- a/tests/testcases/tests.yml +++ b/tests/testcases/tests.yml @@ -31,9 +31,6 @@ - name: Testcases for network import_tasks: 030_check-network.yml when: ('macvlan' not in testcase) - vars: - test_image_repo: registry.k8s.io/e2e-test-images/agnhost - test_image_tag: "2.40" - name: Testcases for calico / advanced network import_tasks: 040_check-network-adv.yml when: