Smoke test for the 'rerun' command
(self, vector, tmp_history_file)
| 747 | assert "select 'hi'" in history_contents |
| 748 | |
| 749 | def test_rerun(self, vector, tmp_history_file): # noqa: U100 |
| 750 | """Smoke test for the 'rerun' command""" |
| 751 | if vector.get_value('strict_hs2_protocol'): |
| 752 | pytest.skip("Rerun not supported in strict hs2 mode.") |
| 753 | child_proc = spawn_shell(get_shell_cmd(vector)) |
| 754 | child_proc.expect(":{0}] default>".format(get_impalad_port(vector))) |
| 755 | self._expect_with_cmd(child_proc, "@1", vector, ("Command index out of range")) |
| 756 | self._expect_with_cmd(child_proc, "rerun -1", vector, |
| 757 | ("Command index out of range")) |
| 758 | self._expect_with_cmd(child_proc, "select 'first_command'", vector, |
| 759 | ("first_command")) |
| 760 | self._expect_with_cmd(child_proc, "rerun 1", vector, ("first_command")) |
| 761 | self._expect_with_cmd(child_proc, "@ -1", vector, ("first_command")) |
| 762 | self._expect_with_cmd(child_proc, "select 'second_command'", vector, |
| 763 | ("second_command")) |
| 764 | child_proc.sendline('history;') |
| 765 | child_proc.expect(":{0}] default>".format(get_impalad_port(vector))) |
| 766 | before_line = child_proc.before.decode('UTF-8', 'replace') |
| 767 | assert '[1]: select \'first_command\';' in before_line |
| 768 | assert '[2]: select \'second_command\';' in before_line |
| 769 | assert '[3]: history;' in before_line |
| 770 | # Rerunning command should not add an entry into history. |
| 771 | assert '[4]' not in before_line |
| 772 | self._expect_with_cmd(child_proc, "@0", vector, ("Command index out of range")) |
| 773 | self._expect_with_cmd(child_proc, "rerun 4", vector, ("Command index out of range")) |
| 774 | self._expect_with_cmd(child_proc, "@-4", vector, ("Command index out of range")) |
| 775 | self._expect_with_cmd(child_proc, " @ 3 ", vector, ("second_command")) |
| 776 | self._expect_with_cmd(child_proc, "@-3", vector, ("first_command")) |
| 777 | self._expect_with_cmd(child_proc, "@", vector, |
| 778 | ("Command index to be rerun must be an integer.")) |
| 779 | self._expect_with_cmd(child_proc, "@1foo", vector, |
| 780 | ("Command index to be rerun must be an integer.")) |
| 781 | self._expect_with_cmd(child_proc, "@1 2", vector, |
| 782 | ("Command index to be rerun must be an integer.")) |
| 783 | self._expect_with_cmd(child_proc, "rerun1", vector, ("Syntax error")) |
| 784 | child_proc.sendline('quit;') |
| 785 | child_proc.wait() |
| 786 | |
| 787 | def test_tip(self, vector): |
| 788 | """Smoke test for the TIP command""" |
nothing calls this directly
no test coverage detected