[0.14.0] Working directory doesn't seem to be relative to workspace directory
See original GitHub issueDescription of the bug
The working directory of the hoverfly instance seems to be located in the temproary folder instead of the workspace/project directory. And since hoverfly requires relative paths this makes it almost impossible to reliably specify your response files let alone specify them in a way that is not machine dependent.
Instead the working directory should in the default path (src/test/resources/hoverfly
) or where the simulation file is so relative paths can be used easily
Steps to reproduce the issue
Start a simulation from a simulation file. Specify a path relative to the default path or the simulation JSON.
Example gist: https://gist.github.com/BrainStone/14b5facb30a17e3d0c658d12ba49796d
Observed result
Hoverfly errors out:
[02:05:12.589][Test worker][WARN ][i.s.h.junit.api.HoverflyClient]: Failed to set simulation: Unexpected response (code=500, message={"error":"An error occurred: open test.json: The system cannot find the path specified."}{"data":{"pairs":[],"globalActions":{"delays":[],"delaysLogNormal":[]}},"meta":{"schemaVersion":"v5.1","hoverflyVersion":"v1.3.1","timeExported":"2020-11-29T02:05:12+01:00"}}
)
Expected result
The simulation just working fine and being able to find the files.
Additional relevant information
- Hoverfly Java version: 0.13.2-SNAPSHOT - 0.14.0
- OS: Windows 10
Only way I was able to get it working was using a pseudo absolut path. So just a bunch of ../../../..
until you eventually reach the root dir, then specify the path like you would with an absolute path, excluding the drive specification on Windows (needs to be on the same drive)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
That worked great!
Looking forward to having that being done automatically.
For people that might stumble across this in the future, here is my code:
(
@SneakyThrows
is from lombok. If you don’t have that, just catch the exception and rethrow it wrapped in aRuntimeException
)Ok. Will give that a shot. Thanks very much!