Skip to content

Commit

Permalink
test: add unit test for posix path separator
Browse files Browse the repository at this point in the history
This adds a unit test to make sure that when Windows NT path separator
characters are preferred by os.path, the entrypoint will still be
defined with POSIX path separators.
  • Loading branch information
kevinshurtz committed Oct 31, 2024
1 parent 278f908 commit fa672cc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/unit/test_containerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ def test_v3_various(build_dir_and_ee_yml):
assert 'CMD ["csh"]' in c.steps


def test__posix_separator_in_entrypoint_on_windows(build_dir_and_ee_yml, mocker):
"""
Test that the generated entrypoint uses the POSIX separator on Windows.
"""
ee_data = """
version: 3
images:
base_image:
name: quay.io/user/mycustombaseimage:latest
"""
import ntpath
mocker.patch("os.path", ntpath)

tmpdir, ee_path = build_dir_and_ee_yml(ee_data)
c = make_containerfile(tmpdir, ee_path, run_validate=True)
c.prepare()

assert 'ENTRYPOINT ["/opt/builder/bin/entrypoint", "dumb-init"]' in c.steps


def test__handle_additional_build_files(build_dir_and_ee_yml):
"""
Test additional build file handling works as expected.
Expand Down

0 comments on commit fa672cc

Please sign in to comment.