-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[configuration] delayed postprocs, extra volmounts
Change: - Allow post-processors to be delayed until after the first (alphabetical) pass. In the delayed pass, delayed post-processors are again executed alphabetically. - In the interest of keeping configuration simple, we don't allow for multiple "levels" of delay. A post-processor is either run during the first pass, or delayed until after the first/normal pass. - This also adds an "extra volmounts" variable to the navigator post-processor class, which can be used by other post-processors to signify that they want a volume to be mounted. The volume-mount post processor is now delayed to accommodate. Test Plan: - Using this in lint/navigator work, no new tests yet because there is no other post processor currently which adds an extra volume mount. Signed-off-by: Rick Elrod <rick@elrod.me>
- Loading branch information
Showing
5 changed files
with
111 additions
and
2 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
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
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
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
31 changes: 31 additions & 0 deletions
31
tests/unit/configuration_subsystem/test_navigator_post_processor.py
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,31 @@ | ||
"""Tests for the navigator config post-processor.""" | ||
|
||
import pytest | ||
|
||
from ansible_navigator.configuration_subsystem.navigator_post_processor import ( | ||
VolumeMount, | ||
VolumeMountOption, | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("volmount", "expected"), | ||
( | ||
(VolumeMount("test_option", "/foo", "/bar"), "/foo:/bar"), | ||
(VolumeMount("test_option", "/foo", "/bar", [VolumeMountOption.z]), "/foo:/bar:z"), | ||
( | ||
VolumeMount("test_option", "/foo", "/bar", [VolumeMountOption.z, VolumeMountOption.Z]), | ||
"/foo:/bar:z,Z", | ||
), | ||
(VolumeMount("test_option", "/foo", "/bar", []), "/foo:/bar"), | ||
), | ||
ids=( | ||
"normal mount", | ||
"mount with relabel option", | ||
"mount with a list of options", | ||
"mount with empty list of options", | ||
), | ||
) | ||
def test_navigator_volume_mount_to_string(volmount, expected): | ||
"""Make sure volume mount ``to_string`` is sane.""" | ||
assert volmount.to_string() == expected |