On 07/02/2015 05:05 PM, Hangbin Liu wrote:
> 2015-07-02 21:15 GMT+08:00 Cyril Hrubis <chru...@suse.cz>:
>> Hi!
>>> 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.
>>>
>>> Signed-off-by: Hangbin Liu <liuhang...@gmail.com>
>>> ---
>>>   testcases/network/xinetd/xinetd_tests.sh | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/testcases/network/xinetd/xinetd_tests.sh 
>>> b/testcases/network/xinetd/xinetd_tests.sh
>>> index ff1219a..a12f6b9 100755
>>> --- a/testcases/network/xinetd/xinetd_tests.sh
>>> +++ b/testcases/network/xinetd/xinetd_tests.sh
>>> @@ -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...
> Hmm, this is a solution. But what if some cmd failed one or two time,
> which is a bug, but
> we missed with this function? I'm not sure, just in case.
>
> Hi Alexey, do you have any idea?

It's a good idea to have tst_retry() and the one should chose the 
appropriate use case to run a command with it.
telnet seems to be the right candidate... otherwise you wouldn't wait 1 
second and would consider "connection refused" as a bug, right?

Thanks,
Alexey


------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to