-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework _copy_decouple to follow relative symlinks and symlinks to dir…
…ectories. * The previous code handled absolute symlinks fine but when there were relative symlinks it would traceback. Additionally, it did not handle symlinks to directories that occurred outside of /etc/pki. This should fix both of those cases. In order to handle symlinks to the /etc/pki directory, we need to introduce the concept of the canonical path. The canonical path is an absolute path that has had all symlinks dereferenced and doesn't contain any parent directories ("..") or self directories ("."). We have to use the canonical path for most file path comparisons since symlinks allow multiple paths that will point to a file but there is only one canonical path. The logic is somewhat tricky since we need to use the canonical path for comparisons but we have to use srcdir when constructing the paths that we will put into links we create (since we want to use /etc/pki in the container context even if /etc/pki is a symlink on the host system.) * Add some unittests that test symlink handling of copy_decouple with relative symlinks. * Enhance the temporary_directory fixture to handle creation of relative symlinks too. * Add better error messages to asserts in assert_firectory_structure_matches * Modify _copy_decouple() unittest to raise CalledProcessError() if run() encounters an error. If the command line executable that run() executes has a non-zero exit code, the real code will raise CalledProcessError() but the mock in the unittest would not. Change the unittest to match the actual code's behaviour. * Move explanation of the parametrize structure to traverse_structure's docstring. * Use pytest.param() and id for the parametrize on test_copy_decouple. The ids help to determine which tests have failed and allow us to select a specific test to rerun (with PYLINT_ARGS="-k '<ID>'" * If decouple_copy fails, then print out the entire directory structure that was created. That will help to debug the failed assertions.
- Loading branch information
Showing
2 changed files
with
765 additions
and
179 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
Oops, something went wrong.