Skip to contentSkip to conversation

network/xinetd: wait a while to make sure telnetd restart

PATCH In review Hangbin Liu 2 participants 2 messages Jul 2, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 network/xinetd: wait a while to make sure telnetd restart

telnetd not restart immediately after xinetd restart, which make xinetd failed. e.g.
\# service xinetd restart; echo "^D" | /usr/bin/telnet ::1 Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Trying ::1...
telnet: connect to address ::1: Connection refused

Wait a while after xinetd restart will make sure telnetd up and the test passed

\# service xinetd restart; sleep 1; echo "^D" | /usr/bin/telnet ::1 Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Trying ::1...
Connected to ::1.
Escape character is '^]'.
Connection closed by foreign host.

---
 testcases/network/xinetd/xinetd_tests.sh | 4 ++++
 1 file changed, 4 insertions(+)
testcases/network/xinetd/xinetd_tests.sh +4 -0
index ff1219a..a12f6b9 100755
@@ -315,6 +315,8 @@ test01()
         fi
     fi
 
+    sleep 1s
+
     # Not checking for exit code from telnet command because telnet is
     # not terminated by the test gracefully.
     if [ $IPV6_ENABLED -eq 1 ]
@@ -381,6 +383,8 @@ test01()
         fi
     fi
 
+    sleep 1s
+
     # Not checking for exit code from telnet command because telnet is
     # not terminated by the test gracefully.
     if [ $IPV6_ENABLED -eq 1 ]
Signature · 13 lines
1.9.3


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!

Quoted 28 lines

telnetd not restart immediately after xinetd restart, which make xinetd failed. e.g.
\# service xinetd restart; echo "^D" | /usr/bin/telnet ::1 Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Trying ::1...
telnet: connect to address ::1: Connection refused

Wait a while after xinetd restart will make sure telnetd up and the test passed

\# service xinetd restart; sleep 1; echo "^D" | /usr/bin/telnet ::1 Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
Trying ::1...
Connected to ::1.
Escape character is '^]'.
Connection closed by foreign host.

---
 testcases/network/xinetd/xinetd_tests.sh | 4 ++++
 1 file changed, 4 insertions(+)
testcases/network/xinetd/xinetd_tests.sh +0 -0
index ff1219a..a12f6b9 100755

testcases/network/xinetd/xinetd_tests.sh test01() · line 318

Quoted 4 lines
testcases/network/xinetd/xinetd_tests.sh +1 -0
@@ -315,6 +315,8 @@ test01()
         fi
     fi
 
+    sleep 1s

No random sleeps in testcases please. Can you rather change the code to retry in case of failure?

Something as:

$RETRIES=10
while [ $RETRIES -gt 0 ]; do

	echo "^D" | $TELNET_COMM 127.0.0.1 2>$LTPTMP/tst_xinetd.out 1>/dev/null
	if [ $? -eq 0 ]; then
		break;
	fi
	RETRIES=$((RETRIES-1))
	sleep 1

done

Looking at the code, most of it could be moved into the test library in order to be reused by other testcases. Maybe we should add tst_retry function that would retry a command a few times...

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list