Explorar o código

Fix engine tests on systems where temp directories are symlinked.

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Solomon Hykes %!s(int64=11) %!d(string=hai) anos
pai
achega
353cc8c2a5
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      engine/engine_test.go

+ 13 - 0
engine/engine_test.go

@@ -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 {