fhoeben/hsac-fitnesse-fixtures

FileFixture can't read string content from file://hostname/path

pvbemmelen62 opened this issue · 2 comments

With respect to FileFixture:
is there a way to read the string content of an url , where the url is specified as file://hostname/path ,
or maybe even as //hostname/path , where hostname is specified as an ip address ,
and that works both on Windows and on Linux ?

|set directory|//hostname/path|
|$content=|text in|some-xml-file.xml|

(where path may have multiple parts)
I see that on Windows I get the desired result, but on Linux I get the error message

Unable to find: /hostname/path/some-xml-file.xml

FileFixture does support

|set directory|Z:\|

where Z: could be mapped to some network drive .
But I need to use an ip address.
I could implement a command myself, and I will, but only if such functionality is not yet available.

If you are looking for a cross-platform solution these URLs are not the way to go, that notation is not supported on Unix as far as I know.

For Windows: shouldn't the slashes be the other way around then, something like: \\ip-address\share (without file: prefix)?
I actually thought that would work on Windows already. I don't have a windows machine to test on (and we don't do CI runs on Windows unfortunately), but if this is currently broken. Please submit a fix.
But I do expect using this in your tests makes them windows-only, which I tend to avoid.

For Unix (or cross platform) I would always expect something like http(s), (s)ftp or scp to access files on a remote system. Accessing a samba share (which I believe is what happens on Windows when using \\ip-address\share) usually first requires mounting that share into the local filesystem in Unix environment. This is often not feasible on CI servers therefore I favour other protocols.

I myself tend to setup http access to files needed from another server. This is cross platform and allows easy access using so many tools (including, of course, HttpFixture in this project).

For ftp access when using the Fit test system this project has ReadFileFromFtpServerFixture, creating something similar for Slim should be relatively easy too.

For Windows , \\ip-address\path as argument to set directory works alright. I guess that the first part of path specifies a share.

There is no http server running to make the share accessible.

I took a look at
https://en.wikipedia.org/wiki/File_URI_scheme
and wonder if the file protocol is something that is widely supported on Unix
It's not supported on the Linux agent that runs a job on our gitlab server; I can't remember the exact error message; I've tried so many variations, that I lost track.

Someone in our it department will have to help me out. They were somehow able to make another similar file share available, (not through http) so I hope they'll do the same for the file share I currently need access to.

Thanks for your feedback, Fried.