diff --git a/rally/cmd/commands/info.py b/rally/cmd/commands/info.py index b78d823ae0..31f3400e1f 100644 --- a/rally/cmd/commands/info.py +++ b/rally/cmd/commands/info.py @@ -87,11 +87,14 @@ class InfoCommands(object): print(info) else: substitutions = self._find_substitution(query) - print("Failed to find any docs for query: '%s'" % query) - if substitutions: - print("Did you mean one of these?\n\t%s" % - "\n\t".join(substitutions)) - return 1 + if len(substitutions) == 1: + print(self._find_info(substitutions[0])) + else: + print("Failed to find any docs for query: '%s'" % query) + if substitutions: + print("Did you mean one of these?\n\t%s" % + "\n\t".join(substitutions)) + return 1 def list(self): """List main entities in Rally for which rally info find works. diff --git a/tests/functional/test_cli_info.py b/tests/functional/test_cli_info.py index f006b0f03f..5c75dcfae9 100644 --- a/tests/functional/test_cli_info.py +++ b/tests/functional/test_cli_info.py @@ -54,18 +54,13 @@ class InfoTestCase(unittest.TestCase): ("info find NonExistingStuff")) def test_find_misspelling_typos(self): - marker_string = "ExistingServers" - try: - self.rally("info find ExistinfServert") - except utils.RallyCmdError as e: - self.assertIn(marker_string, e.output) + marker_string = "ExistingServers (server provider)." + self.assertIn(marker_string, self.rally("info find ExistinfServert")) def test_find_misspelling_truncated(self): - marker_string = "boot_and_delete_server" - try: - self.rally("info find boot_and_delete") - except utils.RallyCmdError as e: - self.assertIn(marker_string, e.output) + marker_string = ("NovaServers.boot_and_delete_server " + "(benchmark scenario).") + self.assertIn(marker_string, self.rally("info find boot_and_delete")) def test_list(self): output = self.rally("info list")