mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
test: error out when bind mount source doesn't exist
This adds a test to verify that the server is checking whether the path to be bind mounted actually exists on the server.
This commit is contained in:
parent
4d2ba779e1
commit
35430e8920
1 changed files with 19 additions and 0 deletions
|
@ -679,3 +679,22 @@ func TestRunErrorBindMountRootSource(t *testing.T) {
|
||||||
<-c
|
<-c
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expected behaviour: error out when attempting to bind mount non-existing source paths
|
||||||
|
func TestRunErrorBindNonExistingSource(t *testing.T) {
|
||||||
|
|
||||||
|
cli := NewDockerCli(nil, nil, ioutil.Discard, testDaemonProto, testDaemonAddr)
|
||||||
|
defer cleanup(globalRuntime)
|
||||||
|
|
||||||
|
c := make(chan struct{})
|
||||||
|
go func() {
|
||||||
|
defer close(c)
|
||||||
|
if err := cli.CmdRun("-v", "/i/dont/exist:/tmp", unitTestImageID, "echo 'should fail'"); err == nil {
|
||||||
|
t.Fatal("should have failed to run when using /i/dont/exist as a source for the bind mount")
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
setTimeout(t, "CmdRun timed out", 5*time.Second, func() {
|
||||||
|
<-c
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue