forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for bash-completion on Debian / Ubuntu.
- Loading branch information
1 parent
dd619d7
commit a18a630
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pathlib | ||
|
||
|
||
def test_bash_completion_installed(grains): | ||
# This test specifically checks for a regression of #66560. | ||
if grains.get("os_family") == "Debian": | ||
completions_dir = pathlib.Path("/usr/share/bash-completion/completions") | ||
for exec_name in ("salt", "salt-call", "salt-cp", "salt-key"): | ||
# Bash-completion finds the completion when it is installed as | ||
# <command>, <command>.bash, or _<command>, so we test all three | ||
# variants before failing. | ||
completion_file1 = completions_dir / exec_name | ||
completion_file2 = completions_dir / f"{exec_name}.bash" | ||
completion_file3 = completions_dir / f"_{exec_name}" | ||
assert ( | ||
completion_file1.exists() | ||
or completion_file2.exists() | ||
or completion_file3.exists() | ||
) |