Fix engine tests on systems where temp directories are symlinked.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
Solomon Hykes 2014-02-15 14:27:01 -08:00
parent a7ecc3ea11
commit 353cc8c2a5
1 changed files with 13 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"io/ioutil"
"os"
"path"
"path/filepath"
"testing"
)
@ -64,6 +65,18 @@ func TestEngineRoot(t *testing.T) {
t.Fatal(err)
}
defer os.RemoveAll(tmp)
// We expect Root to resolve to an absolute path.
// FIXME: this should not be necessary.
// Until the above FIXME is implemented, let's check for the
// current behavior.
tmp, err = filepath.EvalSymlinks(tmp)
if err != nil {
t.Fatal(err)
}
tmp, err = filepath.Abs(tmp)
if err != nil {
t.Fatal(err)
}
dir := path.Join(tmp, "dir")
eng, err := New(dir)
if err != nil {