Open
Description
When i follow https://wiremock.readthedocs.io/en/latest/testcontainers/ run test in Windows with DockerDesktop use WSL2 based engine, it throws docker.errors.NotFound: 404 Client Error, details:
File "D:\Program Files\Python312\Lib\site-packages\docker\api\client.py", line 267, in _raise_for_status
raise create_api_error_from_http_exception(e) from e
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Program Files\Python312\Lib\site-packages\docker\errors.py", line 39, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation) from e
docker.errors.NotFound: 404 Client Error for http://localhost:2375/v1.43/containers/42abf343b127c20a5c2de82a90d42c782449db7d8e10dd5cd7585804402ef686/archive?path=%5Chome%5Cwiremock%5Cmappings: Not Found ("Could not find the file \home\wiremock\mappings in container 42abf343b127c20a5c2de82a90d42c782449db7d8e10dd5cd7585804402ef686")
The problem seems here, it shouldn't be a WindowsPath, this will cause the wrong url generated, so should convert to posix format by call Path("").as_posix()
def copy_mappings_to_container(self) -> None:
"""Copies all mappings files generated with
`.with_mapping('hello-world.json', {...})` to the container under
the configured MAPPINGS_DIR
"""
self.copy_files_to_container(
# shouldn't be a WindowsPath here, call as_posix() can fix this problem
configs=self.mapping_stubs, container_dir_path=Path(f"{self.MAPPINGS_DIR}")
)
def copy_mapping_files_to_container(self) -> None:
"""Copies all mappings files generated with
`.with_file('hello.json', {...})` to the container under
the configured FILES_DIR
"""
self.copy_files_to_container(
# shouldn't be a WindowsPath here, call as_posix() can fix this problem
configs=self.mapping_files, container_dir_path=Path(f"{self.FILES_DIR}")
)
Metadata
Metadata
Assignees
Labels
No labels
Activity