mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #7448 from tiborvass/fix-tmpdir-integration-tests
Fix tmpdir integration tests
This commit is contained in:
commit
c9ca37dfe9
2 changed files with 8 additions and 8 deletions
|
@ -1317,7 +1317,7 @@ func TestBuildEntrypointRunCleanup(t *testing.T) {
|
||||||
logDone("build - cleanup cmd after RUN")
|
logDone("build - cleanup cmd after RUN")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBuldForbiddenContextPath(t *testing.T) {
|
func TestBuildForbiddenContextPath(t *testing.T) {
|
||||||
name := "testbuildforbidpath"
|
name := "testbuildforbidpath"
|
||||||
defer deleteImages(name)
|
defer deleteImages(name)
|
||||||
ctx, err := fakeContext(`FROM scratch
|
ctx, err := fakeContext(`FROM scratch
|
||||||
|
@ -1327,18 +1327,16 @@ func TestBuldForbiddenContextPath(t *testing.T) {
|
||||||
"test.txt": "test1",
|
"test.txt": "test1",
|
||||||
"other.txt": "other",
|
"other.txt": "other",
|
||||||
})
|
})
|
||||||
|
|
||||||
defer ctx.Close()
|
defer ctx.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if _, err := buildImageFromContext(name, ctx, true); err != nil {
|
|
||||||
if !strings.Contains(err.Error(), "Forbidden path outside the build context: ../../ (/)") {
|
expected := "Forbidden path outside the build context: ../../ "
|
||||||
t.Fatal("Wrong error, must be about forbidden ../../ path")
|
if _, err := buildImageFromContext(name, ctx, true); err == nil || !strings.Contains(err.Error(), expected) {
|
||||||
}
|
t.Fatalf("Wrong error: (should contain \"%s\") got:\n%v", expected, err)
|
||||||
} else {
|
|
||||||
t.Fatal("Error must not be nil")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logDone("build - forbidden context path")
|
logDone("build - forbidden context path")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ const (
|
||||||
unitTestImageIDShort = "83599e29c455"
|
unitTestImageIDShort = "83599e29c455"
|
||||||
unitTestNetworkBridge = "testdockbr0"
|
unitTestNetworkBridge = "testdockbr0"
|
||||||
unitTestStoreBase = "/var/lib/docker/unit-tests"
|
unitTestStoreBase = "/var/lib/docker/unit-tests"
|
||||||
|
unitTestDockerTmpdir = "/var/lib/docker/tmp"
|
||||||
testDaemonAddr = "127.0.0.1:4270"
|
testDaemonAddr = "127.0.0.1:4270"
|
||||||
testDaemonProto = "tcp"
|
testDaemonProto = "tcp"
|
||||||
testDaemonHttpsProto = "tcp"
|
testDaemonHttpsProto = "tcp"
|
||||||
|
@ -90,6 +91,7 @@ func init() {
|
||||||
// To test other drivers, we need a dedicated driver validation suite.
|
// To test other drivers, we need a dedicated driver validation suite.
|
||||||
os.Setenv("DOCKER_DRIVER", "vfs")
|
os.Setenv("DOCKER_DRIVER", "vfs")
|
||||||
os.Setenv("TEST", "1")
|
os.Setenv("TEST", "1")
|
||||||
|
os.Setenv("DOCKER_TMPDIR", unitTestDockerTmpdir)
|
||||||
|
|
||||||
// Hack to run sys init during unit testing
|
// Hack to run sys init during unit testing
|
||||||
if selfPath := utils.SelfPath(); strings.Contains(selfPath, ".dockerinit") {
|
if selfPath := utils.SelfPath(); strings.Contains(selfPath, ".dockerinit") {
|
||||||
|
|
Loading…
Reference in a new issue