@@ -59,3 +59,33 @@ def test_tools__sss_cache_expired_does_not_print_unrelated_message(client: Clien
5959 assert (
6060 "No domains configured, fatal error!" not in res .stdout
6161 ), "'No domains configured, fatal error!' printed to stdout!"
62+
63+
64+ @pytest .mark .importance ("medium" )
65+ @pytest .mark .topology (KnownTopology .Client )
66+ @pytest .mark .ticket (gh = 7664 )
67+ @pytest .mark .parametrize (
68+ "host" ,
69+ [("sssd.io" , True ), ("1.1.1.1" , True ), ("client.test" , True ), ("asdf.test" , False ), ("super.bad.hostname" , False )],
70+ ids = ["sssd.io" , "1.1.1.1" , "client.test" , "asdf.test" , "super.bad.hostname" ],
71+ )
72+ def test_tools__sss_ssh_knownhosts_resolves_hostnames_and_ips (client : Client , host : tuple [str , bool ]):
73+ """
74+ :title: sss_ssh_knownhosts resolution of hostnames and IP addresses.
75+ :setup:
76+ :steps:
77+ 1. Look up parameterized hosts using sss_ssh_knownhosts
78+ :expectedresults:
79+ 1. Host is found or not found without errors
80+ :customerscenario: True
81+ """
82+ result = client .host .conn .run (f"sss_ssh_knownhosts --debug=5 { host [0 ]} " )
83+ assert result is not None , "sss_ssh_knownhosts did not run properly!"
84+ assert result .stderr_lines is not None , "sss_ssh_knownhosts did not print any debug output!"
85+
86+ _search_value = "getaddrinfo() failed (-2): Name or service not known"
87+
88+ if host [1 ]:
89+ assert not any (_search_value in line for line in result .stderr_lines ), f"Should have succeeded for { host [0 ]} !"
90+ else :
91+ assert any (_search_value in line for line in result .stderr_lines ), f"Should have failed for { host [0 ]} !"
0 commit comments