From 22ba71dccbf60372758512124095f42fe7c77fb1 Mon Sep 17 00:00:00 2001
From: Serguei Smirnov <ssmirnov@whamcloud.com>
Date: Mon, 9 Dec 2024 13:43:27 -0800
Subject: [PATCH] LU-18129 tests: wait longer for tcp connections to establish

In sanity-lnet test_230, increase the wait time for the
requested number of connections to establish before checking:
this is important for high conns_per_peer values.
To the same case, added setting of conns_per_peer at "net add".

Test-Parameters: trivial
Test-Parameters: testlist=sanity-lnet env=ONLY=230,ONLY_REPEAT=100 clientdistro=ubuntu2404
Test-Parameters: testlist=sanity-lnet env=ONLY=230,ONLY_REPEAT=100 clientdistro=ubuntu2404
Test-Parameters: testlist=sanity-lnet env=ONLY=230,ONLY_REPEAT=100 clientdistro=ubuntu2404
Test-Parameters: testlist=sanity-lnet env=ONLY=230,ONLY_REPEAT=100 clientdistro=ubuntu2404
Test-Parameters: testlist=sanity-lnet env=ONLY=230,ONLY_REPEAT=100 clientdistro=ubuntu2404
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: I1137251afddf54c4b5dd2bb9426d3e6cbf459748
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57350
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Caleb Carlson <caleb.carlson@hpe.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
---
 lustre/tests/sanity-lnet.sh | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh
index 93fe64a..e842191 100755
--- a/lustre/tests/sanity-lnet.sh
+++ b/lustre/tests/sanity-lnet.sh
@@ -18,7 +18,6 @@ init_test_env "$@"
 init_logging
 
 ALWAYS_EXCEPT="$SANITY_LNET_EXCEPT "
-always_except LU-18129 230
 always_except LU-10391 253 254
 
 [[ "$SLOW" = "no" ]] && EXCEPT_SLOW=""
@@ -3527,9 +3526,14 @@ test_230() {
 	local cmd
 	for ((i = 4; i < 16; i+=1)); do
 		reinit_dlc || return $?
-		add_net "tcp" "${INTERFACES[0]}" || return $?
-		do_lnetctl net set --all --conns-per-peer $i ||
-			error "should have succeeded $?"
+		if ((i % 2 == 0)); then
+			add_net "tcp" "${INTERFACES[0]}" || return $?
+			do_lnetctl net set --all --conns-per-peer $i ||
+				error "should have succeeded $?"
+		else
+			do_lnetctl net add --net "tcp" --if ${INTERFACES[0]} --conns-per-peer $i ||
+				error "should have succeeded $?"
+		fi
 		$LNETCTL net show -v 1 | grep -q "conns_per_peer: $i" ||
 			error "failed to set conns-per-peer to $i"
 		lnid="$(lctl list_nids | head -n 1)"
@@ -3548,8 +3552,8 @@ test_230() {
 		cmd="printf 'network tcp\nconn_list\n' | lctl | grep -c '$lnid'"
 
 		# Expect 2+conns_per_peer*2 connections. Wait no longer
-		# than 2 seconds.
-		wait_update $HOSTNAME "$cmd" "$((2+i*2))" 2 ||
+		# than 10 seconds.
+		wait_update $HOSTNAME "$cmd" "$((2+i*2))" 10 ||
 			error "expected number of tcp connections $((2+i*2))"
 	done
 
-- 
1.8.3.1