Merge "Generate symlinks during tests"
This commit is contained in:
commit
cb4b10f517
|
@ -2407,24 +2407,19 @@ class ZuulTestCase(BaseTestCase):
|
||||||
|
|
||||||
files = {}
|
files = {}
|
||||||
for (dirpath, dirnames, filenames) in os.walk(source_path):
|
for (dirpath, dirnames, filenames) in os.walk(source_path):
|
||||||
# Note: In case a symlink points to an already existing directory
|
|
||||||
# os.walk includes that in the dirnames list. In order to properly
|
|
||||||
# copy these links, just add them to the filenames list.
|
|
||||||
for dirname in dirnames:
|
|
||||||
test_tree_filepath = os.path.join(dirpath, dirname)
|
|
||||||
if os.path.islink(test_tree_filepath):
|
|
||||||
filenames.append(dirname)
|
|
||||||
|
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
test_tree_filepath = os.path.join(dirpath, filename)
|
test_tree_filepath = os.path.join(dirpath, filename)
|
||||||
common_path = os.path.commonprefix([test_tree_filepath,
|
common_path = os.path.commonprefix([test_tree_filepath,
|
||||||
source_path])
|
source_path])
|
||||||
relative_filepath = test_tree_filepath[len(common_path) + 1:]
|
relative_filepath = test_tree_filepath[len(common_path) + 1:]
|
||||||
if os.path.islink(test_tree_filepath):
|
with open(test_tree_filepath, 'rb') as f:
|
||||||
content = SymLink(os.readlink(test_tree_filepath))
|
content = f.read()
|
||||||
else:
|
# dynamically create symlinks if the content is of the form
|
||||||
with open(test_tree_filepath, 'rb') as f:
|
# symlink: <target>
|
||||||
content = f.read()
|
match = re.match(b'symlink: ([^\s]+)', content)
|
||||||
|
if match:
|
||||||
|
content = SymLink(match.group(1))
|
||||||
|
|
||||||
files[relative_filepath] = content
|
files[relative_filepath] = content
|
||||||
self.addCommitToRepo(project, 'add content from fixture',
|
self.addCommitToRepo(project, 'add content from fixture',
|
||||||
files, branch='master', tag='init')
|
files, branch='master', tag='init')
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/opt/file
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/file
|
|
@ -1 +0,0 @@
|
||||||
/opt/assemble
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/assemble
|
|
@ -1 +0,0 @@
|
||||||
/opt/dir
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/dir
|
|
@ -1 +0,0 @@
|
||||||
/opt/file
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/file
|
|
@ -1 +0,0 @@
|
||||||
/opt/vars.yaml
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/vars.yaml
|
|
@ -1 +0,0 @@
|
||||||
../double-symlink-sidekick
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: ../double-symlink-sidekick
|
|
@ -1 +0,0 @@
|
||||||
/opt/vars.yaml
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/vars.yaml
|
|
@ -1 +0,0 @@
|
||||||
..
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: ..
|
|
@ -1 +0,0 @@
|
||||||
/opt/vars.yaml
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/vars.yaml
|
|
@ -1 +0,0 @@
|
||||||
/opt/vars
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/vars
|
|
@ -1 +0,0 @@
|
||||||
/opt/patch
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/patch
|
|
@ -1 +0,0 @@
|
||||||
/opt/script.sh
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/script.sh
|
|
@ -1 +0,0 @@
|
||||||
/opt/file
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/file
|
|
@ -1 +0,0 @@
|
||||||
/opt/archive.tar
|
|
|
@ -0,0 +1 @@
|
||||||
|
symlink: /opt/archive.tar
|
Loading…
Reference in New Issue