Fix LogURI generation-related tests on Windows.
Signed-off-by: Nashwan Azhari <nazhari@cloudbasesolutions.com>
This commit is contained in:
@@ -62,3 +62,50 @@ func TestLogFileBackslash(t *testing.T) {
|
||||
assert.Equal(t, "file:///C:/foo/bar.log", res.Config().Stdout)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogURIGenerator(t *testing.T) {
|
||||
baseTestLogURIGenerator(t, []LogURIGeneratorTestCase{
|
||||
{
|
||||
scheme: "slashes",
|
||||
path: "C:/full/path/pipe.fifo",
|
||||
expected: "slashes:///C:/full/path/pipe.fifo",
|
||||
},
|
||||
{
|
||||
scheme: "backslashes",
|
||||
path: "C:\\full\\path\\pipe.fifo",
|
||||
expected: "backslashes:///C:/full/path/pipe.fifo",
|
||||
},
|
||||
{
|
||||
scheme: "mixedslashes",
|
||||
path: "C:\\full/path/pipe.fifo",
|
||||
expected: "mixedslashes:///C:/full/path/pipe.fifo",
|
||||
},
|
||||
{
|
||||
scheme: "file",
|
||||
path: "C:/full/path/file.txt",
|
||||
args: map[string]string{
|
||||
"maxSize": "100MB",
|
||||
},
|
||||
expected: "file:///C:/full/path/file.txt?maxSize=100MB",
|
||||
},
|
||||
{
|
||||
scheme: "binary",
|
||||
path: "C:/full/path/bin",
|
||||
args: map[string]string{
|
||||
"id": "testing",
|
||||
},
|
||||
expected: "binary:///C:/full/path/bin?id=testing",
|
||||
},
|
||||
{
|
||||
scheme: "unknown",
|
||||
path: "nowhere",
|
||||
err: "must be absolute",
|
||||
},
|
||||
{
|
||||
scheme: "unixpath",
|
||||
path: "/some/unix/path",
|
||||
// NOTE: Unix paths should not be usable on Windows:
|
||||
err: "must be absolute",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user