From c728870b49031a67ddfacab0c157abe06c39a0b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Serv=C3=A9n=20Mar=C3=ADn?= Date: Mon, 5 Jul 2021 13:09:51 +0200 Subject: [PATCH] e2e: check_adjacent accept node number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit modifies the logic of the check_adjacent helper so that rather than expecting the argument to be n^2+n it expects simply n. This makes it easier to update the caller when the number of nodes in the cluster changes. Signed-off-by: Lucas Servén Marín --- e2e/full-mesh.sh | 4 ++-- e2e/lib.sh | 2 +- e2e/location-mesh.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/e2e/full-mesh.sh b/e2e/full-mesh.sh index 494115a..b306fa1 100644 --- a/e2e/full-mesh.sh +++ b/e2e/full-mesh.sh @@ -11,10 +11,10 @@ setup_suite() { test_full_mesh_connectivity() { assert "retry 30 5 '' check_ping" "should be able to ping all Pods" - assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings" + assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 3" "adjacency should return the right number of successful pings" echo "sleep for 30s (one reconciliation period) and try again..." sleep 30 - assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings after reconciling" + assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 3" "adjacency should return the right number of successful pings after reconciling" } test_full_mesh_peer() { diff --git a/e2e/lib.sh b/e2e/lib.sh index 2de8af8..d8baa1c 100755 --- a/e2e/lib.sh +++ b/e2e/lib.sh @@ -157,7 +157,7 @@ check_ping() { check_adjacent() { _kubectl get pods -l app.kubernetes.io/name=curl -o name | xargs -I{} "$KUBECTL_BINARY" --kubeconfig="$KUBECONFIG" exec {} -- /bin/sh -c 'curl -m 1 -s adjacency:8080/?format=fancy' - [ "$(curl_pod -m 1 -s adjacency:8080/?format=json | jq | grep -c true)" -eq "$1" ] + [ "$(curl_pod -m 1 -s adjacency:8080/?format=json | jq '.[].latencies[].ok' | grep -c true)" -eq $(($1*$1)) ] } check_peer() { diff --git a/e2e/location-mesh.sh b/e2e/location-mesh.sh index dc3723f..bf42555 100755 --- a/e2e/location-mesh.sh +++ b/e2e/location-mesh.sh @@ -11,10 +11,10 @@ setup_suite() { test_location_mesh_connectivity() { assert "retry 30 5 '' check_ping" "should be able to ping all Pods" - assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings" + assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 3" "adjacency should return the right number of successful pings" echo "sleep for 30s (one reconciliation period) and try again..." sleep 30 - assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 12" "adjacency should return the right number of successful pings after reconciling" + assert "retry 10 5 'the adjacency matrix is not complete yet' check_adjacent 3" "adjacency should return the right number of successful pings after reconciling" } test_location_mesh_peer() {