diff mbox series

[1/1] host01.sh: Allow to overwrite the default hostname

Message ID 20201211071545.10209-1-pvorel@suse.cz
State Accepted
Headers show
Series [1/1] host01.sh: Allow to overwrite the default hostname | expand

Commit Message

Petr Vorel Dec. 11, 2020, 7:15 a.m. UTC
Using hostname for test requires DNS setup.
Allow to set hostname (e.g. github.com) via $HOSTNAME in case host not
set. This restores the old behavior (the legacy API version used $RHOST).

Suggested-by: Petr Cervinka <pcervinka@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/tcp_cmds/host/host01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexey Kodanev Dec. 14, 2020, 11:21 a.m. UTC | #1
On 11.12.2020 10:15, Petr Vorel wrote:
> Using hostname for test requires DNS setup.
> Allow to set hostname (e.g. github.com) via $HOSTNAME in case host not
> set. This restores the old behavior (the legacy API version used $RHOST).
> 
> Suggested-by: Petr Cervinka <pcervinka@suse.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/tcp_cmds/host/host01.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Petr Vorel Dec. 14, 2020, 1:47 p.m. UTC | #2
Hi Alexey,

> On 11.12.2020 10:15, Petr Vorel wrote:
> > Using hostname for test requires DNS setup.
> > Allow to set hostname (e.g. github.com) via $HOSTNAME in case host not
> > set. This restores the old behavior (the legacy API version used $RHOST).

> > Suggested-by: Petr Cervinka <pcervinka@suse.com>
> > Signed-off-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/network/tcp_cmds/host/host01.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)

> Acked-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Thanks! Merged.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/network/tcp_cmds/host/host01.sh b/testcases/network/tcp_cmds/host/host01.sh
index 662afe8b4..e6d8d4d06 100755
--- a/testcases/network/tcp_cmds/host/host01.sh
+++ b/testcases/network/tcp_cmds/host/host01.sh
@@ -12,7 +12,7 @@  TST_NEEDS_CMDS="awk host hostname"
 
 do_test()
 {
-	local lhost="$(hostname)"
+	local lhost="${HOSTNAME:-$(hostname)}"
 	local addr
 
 	tst_res TINFO "test basic functionality of the host command"