Skip to content

Commit

Permalink
make driver's installed files writable
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyu-ms committed Dec 10, 2024
1 parent 4a92d9b commit 4afcffd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion testplan/common/utils/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def instantiate(template, values, destination):
try:
target.write(render(source.read(), values))
except UnicodeDecodeError:
shutil.copy(template, destination)
shutil.copyfile(template, destination)
except Exception as exc:
raise Exception(
"On reading/writing template: {} - of file {}".format(
Expand Down
14 changes: 8 additions & 6 deletions tests/unit/testplan/testing/multitest/driver/myapp/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def test_install_files(runpath):
bfile = os.path.join(
os.path.abspath(os.path.dirname(__file__)), "binary_file"
)
os.chmod(bfile, 0o444) # only 644 or 755 supported by git
stdout_regexps = [
re.compile(r".*binary=(?P<binary>.*)"),
re.compile(r".*command=(?P<command>.*)"),
Expand All @@ -280,12 +281,13 @@ def test_install_files(runpath):
assert os.path.exists(app.extracts["binary"])
assert bool(json.loads(app.extracts["command"]))
assert os.path.exists(app.extracts["app_path"])
assert os.path.exists(os.path.join(app.app_path, "etc", "binary_file"))
assert os.path.exists(os.path.join(app.app_path, "etc", "config.yaml"))
assert os.path.exists(os.path.join(dst, "config.yaml"))
assert os.path.exists(
os.path.join(app.app_path, "etc", "rel_path", "config.yaml")
)
for p in [
os.path.join(app.app_path, "etc", "binary_file"),
os.path.join(app.app_path, "etc", "config.yaml"),
os.path.join(dst, "config.yaml"),
os.path.join(app.app_path, "etc", "rel_path", "config.yaml"),
]:
assert os.access(p, os.F_OK | os.R_OK | os.W_OK)


def test_echo_hello(runpath):
Expand Down

0 comments on commit 4afcffd

Please sign in to comment.