Make sure we are trying to unmount a mounted /etc/resolv.conf

Signed-off-by: Alvaro Saurin <alvaro.saurin@gmail.com>
(cherry picked from commit 41cc7c4d9ddb6d6b9e024f30806adc82f1bb1d4a)
This commit is contained in:
Alvaro Saurin 2016-06-21 10:38:45 +02:00 committed by Tibor Vass
parent 3e6c39e2ee
commit c2b195d3c2
1 changed files with 8 additions and 2 deletions

View File

@ -1448,10 +1448,16 @@ func (s *DockerSuite) TestRunResolvconfUpdate(c *check.C) {
// This test case is meant to test monitoring resolv.conf when it is
// a regular file not a bind mounc. So we unmount resolv.conf and replace
// it with a file containing the original settings.
cmd := exec.Command("umount", "/etc/resolv.conf")
if _, err = runCommand(cmd); err != nil {
mounted, err := mount.Mounted("/etc/resolv.conf")
if err != nil {
c.Fatal(err)
}
if mounted {
cmd := exec.Command("umount", "/etc/resolv.conf")
if _, err = runCommand(cmd); err != nil {
c.Fatal(err)
}
}
//cleanup
defer func() {