mirror of
https://github.com/kemko/nomad.git
synced 2026-01-02 00:15:43 +03:00
* Docker for Windows does not support ulimits
* Use filepath.ToSlash to test workdir
* Convert expected mount paths to system style
* Skip security-opt test on windows
- Windows does not support seccomp, and it's unclear which options are
available.
* Skip StartN due to lack of sigint
* docker: Use api to get image info on windows
* No bridge on windows
* Stop hardcoding /bin/
35 lines
756 B
Go
35 lines
756 B
Go
// +build windows
|
|
|
|
package docker
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestExpandPath(t *testing.T) {
|
|
cases := []struct {
|
|
base string
|
|
target string
|
|
expected string
|
|
}{
|
|
{"/tmp/alloc/task", ".", "/tmp/alloc/task"},
|
|
{"/tmp/alloc/task", "..", "/tmp/alloc"},
|
|
|
|
{"/tmp/alloc/task", "d1/d2", "/tmp/alloc/task/d1/d2"},
|
|
{"/tmp/alloc/task", "../d1/d2", "/tmp/alloc/d1/d2"},
|
|
{"/tmp/alloc/task", "../../d1/d2", "/tmp/d1/d2"},
|
|
|
|
{"/tmp/alloc/task", "c:/home/user", "c:/home/user"},
|
|
{"/tmp/alloc/task", "c:/home/user/..", "c:/home"},
|
|
}
|
|
|
|
for _, c := range cases {
|
|
t.Run(c.expected, func(t *testing.T) {
|
|
require.Equal(t, c.expected, filepath.ToSlash(expandPath(c.base, c.target)))
|
|
})
|
|
}
|
|
}
|