Browse code

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 authored on 2014/02/16 07:27:01
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ import (
4 4
 	"io/ioutil"
5 5
 	"os"
6 6
 	"path"
7
+	"path/filepath"
7 8
 	"testing"
8 9
 )
9 10
 
... ...
@@ -64,6 +65,18 @@ func TestEngineRoot(t *testing.T) {
64 64
 		t.Fatal(err)
65 65
 	}
66 66
 	defer os.RemoveAll(tmp)
67
+	// We expect Root to resolve to an absolute path.
68
+	// FIXME: this should not be necessary.
69
+	// Until the above FIXME is implemented, let's check for the
70
+	// current behavior.
71
+	tmp, err = filepath.EvalSymlinks(tmp)
72
+	if err != nil {
73
+		t.Fatal(err)
74
+	}
75
+	tmp, err = filepath.Abs(tmp)
76
+	if err != nil {
77
+		t.Fatal(err)
78
+	}
67 79
 	dir := path.Join(tmp, "dir")
68 80
 	eng, err := New(dir)
69 81
 	if err != nil {