network: fix telnet test for running on single machine
PATCH 1/1 network: fix telnet test for running on single machine
Since 5f8ca6cf0 it's possible to run network test on single machine => don't require setting RHOST in this case.
--- testcases/network/tcp_cmds/telnet/telnet01 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
testcases/network/tcp_cmds/telnet/telnet01 +11 -6
@@ -34,8 +34,13 @@ setup() tst_brkm TCONF "Please set PASSWD for $RUSER." fi - if [ -z $RHOST ]; then - tst_brkm TCONF "Please set RHOST." + if [ -n "$TST_USE_NETNS" ]; then + HOST=localhost + else + if [ -z $RHOST ]; then + tst_brkm TCONF "Please set RHOST." + fi + HOST=$RHOST fi if [ -z $LOOPCOUNT ]; then
@@ -58,7 +63,7 @@ telnet_test() tst_resm TINFO "login with telnet($i/$LOOPCOUNT)" expect -c " - spawn telnet $RHOST + spawn telnet $HOST expect -re \"login:\" send \"$RUSER\r\"
@@ -71,15 +76,15 @@ telnet_test() exit 1 } \"$RUSER@\" { send \"LC_ALL=C ls -l /etc/hosts | \\ - wc -w > $RUSER.$RHOST\rexit\r\"; + wc -w > $RUSER.$HOST\rexit\r\"; exp_continue} } " > /dev/null || return 1 tst_resm TINFO "checking telnet status($i/$LOOPCOUNT)" - tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1 - tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST" + tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$HOST" || return 1 + tst_rhost_run -u $RUSER -c "rm -f $RUSER.$HOST" } setup
Signature · 1 line
2.11.0
PATCH 1/1 network: fix telnet test for running on single machine
Hi,
Quoted 29 lines · Petr Vorel
Since
5f8ca6cf0it's possible to run network test on single machine => don't require setting RHOST in this case.Signed-off-by Petr Vorel <[email protected]>--- testcases/network/tcp_cmds/telnet/telnet01 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)testcases/network/tcp_cmds/telnet/telnet01 +7
-2@@ -34,8 +34,13 @@ setup() tst_brkm TCONF "Please set PASSWD for $RUSER." fi - if [ -z $RHOST ]; then - tst_brkm TCONF "Please set RHOST." + if [ -n "$TST_USE_NETNS" ]; then + HOST=localhost + else + if [ -z $RHOST ]; then + tst_brkm TCONF "Please set RHOST." + fi + HOST=$RHOST fi if [ -z $LOOPCOUNT ]; then
testcases/network/tcp_cmds/telnet/telnet01 telnet_test() · line 66
Quoted 5 lines
testcases/network/tcp_cmds/telnet/telnet01 +1
-1@@ -58,7 +63,7 @@ telnet_test() tst_resm TINFO "login with telnet($i/$LOOPCOUNT)" expect -c " - spawn telnet $RHOST + spawn telnet $HOST
Hmm, instead of $RHOST the test should have used $(tst_ipaddr rhost). In general, RHOST variable is for management link, but it can be set to the same IP just the same (when there is only one link between hosts).
Moreover,in case we are using $(tst_ipaddr rhost) here we can run this test over IPv6 byadding '-6' option.
But if we replaced $RHOST with $(tst_ipaddr rhost) we still wouldn't connect with telnetto ltp_ns netns as there is no corresponding listening TCP socket.
It seems there are several solutions:
1. we could do something similar to ssh/dns/http tests,
i.e. start the client side from remote host;
2. add $(tst_ipaddr rservice), and in case of netns, it will return 127.0.0.1/::1 addresses;
3. start those services inside ltp_ns;
4. other suggestions?
Thanks,
Alexey
Quoted 22 lines
testcases/network/tcp_cmds/telnet/telnet01 +3
-3expect -re \"login:\" send \"$RUSER\r\"@@ -71,15 +76,15 @@ telnet_test() exit 1 } \"$RUSER@\" { send \"LC_ALL=C ls -l /etc/hosts | \\ - wc -w > $RUSER.$RHOST\rexit\r\"; + wc -w > $RUSER.$HOST\rexit\r\"; exp_continue} } " > /dev/null || return 1 tst_resm TINFO "checking telnet status($i/$LOOPCOUNT)" - tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$RHOST" || return 1 - tst_rhost_run -u $RUSER -c "rm -f $RUSER.$RHOST" + tst_rhost_run -u $RUSER -c "grep -q 9 $RUSER.$HOST" || return 1 + tst_rhost_run -u $RUSER -c "rm -f $RUSER.$HOST" } setup
PATCH 1/1 network: fix telnet test for running on single machine
Hi,
Quoted 3 lines
It seems there are several solutions:
1. we could do something similar to ssh/dns/http tests, i.e. start the client side from remote host;
What means "remote host" in this context?
Quoted 3 lines
2. add $(tst_ipaddr rservice), and in case of netns, it will return 127.0.0.1/::1 addresses;
3. start those services insideltp_ns;
No idea, what is the easiest solution. Maybe 2.?
Kind regards,
Petr
PATCH 1/1 network: fix telnet test for running on single machine
Quoted 6 lines · Petr Vorel
Hi,
Quoted 3 lines
It seems there are several solutions:
1. we could do something similar to ssh/dns/http tests,i.e. start the client side from remote host;What means "remote host" in this context?
Inside network namespace (ltp_ns)
Quoted 5 lines
Quoted 4 lines
2. add $(tst_ipaddr rservice), and in case of netns, it will return 127.0.0.1/::1 addresses;
3. start those services insideltp_ns;No idea, what is the easiest solution. Maybe 2.?
Yeah, that one seems the easiest.
Best regards,
Alexey
Quoted 4 lines
Kind regards,
Petr