-
Notifications
You must be signed in to change notification settings - Fork 86
Description
Hello!
We have a quite custom setup where we run integration tests for a Node application on Linux and Windows. We use mmock to mock out couple of outside systems. For a new operation, we do file downloads and therefore would like to use file.contents. Below is the configuration we use currently:
{
"request": {
"method": "GET",
"path": "/api/v1/downloadBigFile/*"
},
"response": {
"statusCode": 200,
"headers": {
"Content-Type": ["text/plain"]
},
"body": "{{file.contents(/config/test_file.txt)}}"
}
}This works on Linux, as we can guarantee that the file is present there. However, on Windows, specifically the Azure pipeline we have, we cannot use Linux containers and need to start mmock natively. The mmock configuration is checked into Git, which on Azure pipelines gets cloned to something like D:/a/1/s. Therefore, the current mmock configuration does not work.
I saw that the file.contents replacements uses io.ReadFile under the hood, which I think needs absolute paths to work. What would help for our scenario is if file.contents would support paths relative to the configuration file, e.g.:
{
"request": {
"method": "GET",
"path": "/api/v1/downloadBigFile/*"
},
"response": {
"statusCode": 200,
"headers": {
"Content-Type": ["text/plain"]
},
"body": "{{file.contents(test_file.txt)}}"
}
}so if we save this config file to /config/config.json, mmock would resolve the path for test_file.txt to /config/test_file.txt on Linux and D:/a/1/s/config/test_file.txt on Windows.