diff --git a/test/e2e/lib/vm.sh b/test/e2e/lib/vm.sh index 0cedaeb..59baeb3 100644 --- a/test/e2e/lib/vm.sh +++ b/test/e2e/lib/vm.sh @@ -77,7 +77,7 @@ vm_ssh () { local vpc="${1}" ip="${2}" shift 2 ip netns exec "${vpc}" ssh -i "${VM_KEY}" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ - -o LogLevel=ERROR -o ConnectTimeout=3 -o BatchMode=yes -n "syonad@${ip}" "$@" + -o LogLevel=ERROR -o ConnectTimeout=3 -o BatchMode=yes -o GSSAPIAuthentication=no -n "syonad@${ip}" "$@" } vm_wait () { @@ -193,7 +193,12 @@ vm_meta () { } vm_cloud_init_done () { + local rc vm_ssh "${1}" "${2}" "timeout ${3:-300} cloud-init status --wait" + rc=$? + [ "${rc}" -eq 0 ] && return 0 + echo "code ${rc}, $(vm_ssh "${1}" "${2}" 'cloud-init status --long' 2>&1 | sed -n '/^extended_status:/,$p' | tr -s '\n ' ' ')" + return "${rc}" } vm_boot_id () { diff --git a/test/e2e/run_test.sh b/test/e2e/run_test.sh index 8b792d7..cc04f31 100755 --- a/test/e2e/run_test.sh +++ b/test/e2e/run_test.sh @@ -538,11 +538,24 @@ test_vm_lease_reads_one_field_of_the_interface_lease () { teardown } +test_vm_ssh_skips_gssapi () { + setup "vm_ssh : clé du lab, sans GSSAPI (sshd de Rocky l'accepte, le login attend alors jusqu'à 40 s)" + local out + out=$(node 'ip () { echo "$*"; }; vm_ssh vp 1.2.3.4 true') + [[ ${out} == "netns exec vp ssh "*" -o GSSAPIAuthentication=no "*"syonad@1.2.3.4 true" ]] || fail "GSSAPI non désactivé : ${out}" + teardown +} + test_vm_cloud_init_done_waits_with_a_bound () { setup "vm_cloud_init_done : attend la fin de cloud-init, avec un délai borné, et en rend le code" [[ $(node 'vm_ssh () { echo "$1 $2 $3"; }; vm_cloud_init_done vp 1.2.3.4') == "vp 1.2.3.4 timeout 300 cloud-init status --wait" ]] || fail "commande par défaut" [[ $(node 'vm_ssh () { echo "$3"; }; vm_cloud_init_done vp 1.2.3.4 60') == "timeout 60 cloud-init status --wait" ]] || fail "délai fourni" - [[ $(node 'vm_ssh () { return 2; }; vm_cloud_init_done vp 1.2.3.4 || echo NON') == NON ]] || fail "cloud-init en erreur accepté" + [[ $(node 'vm_ssh () { return 2; }; vm_cloud_init_done vp 1.2.3.4 || echo NON') == *NON ]] || fail "cloud-init en erreur accepté" + local out + out=$(node 'vm_ssh () { case "$3" in *--wait) echo "status: done"; return 2 ;; *--long) printf "%s\n" "status: done" "extended_status: degraded done" "detail: DataSourceNoCloud" "errors: []" "recoverable_errors:" "WARNING:" " - Unable to find a system nic for eth0" ;; esac; }; vm_cloud_init_done vp 1.2.3.4; echo "rc=$?"') + [[ ${out} == *"code 2, extended_status: degraded done detail: DataSourceNoCloud errors: [] recoverable_errors: WARNING: - Unable to find a system nic for eth0"* ]] || fail "diagnostic absent : ${out}" + [[ $(printf '%s\n' "${out}" | tail -n 2 | head -n 1) == "code 2, "*"system nic for eth0"* ]] || fail "diagnostic sur plusieurs lignes, check n'en garde que la dernière : ${out}" + [[ ${out} == *"rc=2" ]] || fail "code perdu : ${out}" teardown } diff --git a/test/e2e/suite/41-evpn-l2.sh b/test/e2e/suite/41-evpn-l2.sh index 7062f0d..d79c28a 100644 --- a/test/e2e/suite/41-evpn-l2.sh +++ b/test/e2e/suite/41-evpn-l2.sh @@ -26,7 +26,7 @@ check "t41-p (hv1) joint t41-q (hv2)" vm_ssh vp-t41 10.41.1.10 'ping -c 3 -W 2 1 for i in $(seq 1 24); do vm_ssh vp-t41 10.41.1.10 "timeout 5 bash -c '/dev/null 2>&1 && break; sleep 5; done check "t41-p ouvre une connexion TCP vers t41-q:22" vm_ssh vp-t41 10.41.1.10 "timeout 5 bash -c '/dev/null 2>&1 && break; sleep 2; done +info "10.46.1.10 : premier ping réussi à l'essai ${i}, $(( $(date +%s) - T0 )) s après le début de la capture (fenêtre de 12 s)" check "t46-a (hôte de la passerelle) joint 240.255.0.1 derrière les bordures" vm_ssh vp-t46 10.46.1.10 'ping -n -c 3 -W 2 240.255.0.1' wait info "ICMP sortis du netns par vp-t46-e : depuis 240.0.0.46 $(cat "${S}/public"), depuis 10.46.1.10 $(cat "${S}/private")" diff --git a/test/e2e/suite/47-ip-flottante.sh b/test/e2e/suite/47-ip-flottante.sh index 1bfa638..7e729dc 100644 --- a/test/e2e/suite/47-ip-flottante.sh +++ b/test/e2e/suite/47-ip-flottante.sh @@ -31,7 +31,9 @@ S=$(mktemp -d) sniff_start "${S}/fip" vp-t47-e 12 icmp-from 240.0.0.47 sniff_start "${S}/ng" vp-t47-e 12 icmp-from 240.0.0.57 sniff_start "${S}/private" vp-t47-e 12 icmp-from 10.47.1.10 +T0=$(date +%s) for i in $(seq 1 10); do vm_ssh vp-t47 10.47.1.10 'ping -n -c 1 -W 2 240.255.0.1' >/dev/null 2>&1 && break; sleep 2; done +info "10.47.1.10 : premier ping réussi à l'essai ${i}, $(( $(date +%s) - T0 )) s après le début de la capture (fenêtre de 12 s)" check "t47-a joint 240.255.0.1 derrière les bordures" vm_ssh vp-t47 10.47.1.10 'ping -n -c 3 -W 2 240.255.0.1' wait info "ICMP sortis du netns pendant le ping de t47-a : source 240.0.0.47 $(cat "${S}/fip"), 240.0.0.57 $(cat "${S}/ng"), 10.47.1.10 $(cat "${S}/private")" diff --git a/test/e2e/suite/51-l3vni.sh b/test/e2e/suite/51-l3vni.sh index 4e562f0..5433ae1 100644 --- a/test/e2e/suite/51-l3vni.sh +++ b/test/e2e/suite/51-l3vni.sh @@ -54,7 +54,7 @@ check "hv1 : aucun VXLAN de sn-t51e (VNI 5112) sur hv1" sh -c "! ip link show vx for i in $(seq 1 24); do vm_ssh vp-t51 10.51.1.10 'ping -c 1 -W 2 10.51.2.10' >/dev/null 2>&1 && break; sleep 5; done check "t51-a (sn-t51d, hv1) joint t51-b (sn-t51e, hv2) par le L3VNI, forwarding par interface" vm_ssh vp-t51 10.51.1.10 'ping -c 3 -W 2 10.51.2.10' check "trame pleine taille : 1472 octets en -M do" vm_ssh vp-t51 10.51.1.10 'ping -M do -s 1472 -c 2 -W 2 10.51.2.10' -check "1473 octets refusés localement (MTU 1500)" vm_grep vp-t51 10.51.1.10 'ping -M do -s 1473 -c 1 -W 2 10.51.2.10' 'message too long' +check "1473 octets refusés localement (MTU 1500)" vm_grep vp-t51 10.51.1.10 'ping -M do -s 1473 -c 1 -W 2 10.51.2.10' '[Mm]essage too long' check "TTL 1 : expire à la gateway du subnet, netns de hv1 (10.51.1.254)" vm_grep vp-t51 10.51.1.10 'ping -n -c 3 -i 1.2 -W 2 -t 1 10.51.2.10' 'From 10.51.1.254 .*exceeded' check "TTL 2 : expire dans la VRF de hv1 (169.254.0.1)" vm_grep vp-t51 10.51.1.10 'ping -n -c 3 -i 1.2 -W 2 -t 2 10.51.2.10' 'From 169.254.0.1 .*exceeded' check "TTL 5 : atteint t51-b — quatre routeurs : gateway hv1, VRF hv1, VRF hv2, netns hv2" vm_ssh vp-t51 10.51.1.10 'ping -n -c 1 -W 2 -t 5 10.51.2.10'