Remove shelling out to mount
Also remove the target from the Mount struct because it should not be used at all. The target can be variable and set by a caller, not by the snapshot drivers. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
c0fdda03cc
commit
a7a6270f2a
9 changed files with 28 additions and 101 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/containerd"
|
||||
|
@ -35,15 +34,7 @@ func TestSnapshotNaiveBasic(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, mount := range mounts {
|
||||
if !strings.HasPrefix(mount.Target, preparing) {
|
||||
t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, preparing)
|
||||
}
|
||||
|
||||
t.Log(containerd.MountCommand(mount))
|
||||
}
|
||||
|
||||
if err := containerd.MountAll(mounts...); err != nil {
|
||||
if err := containerd.MountAll(mounts, preparing); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
|
@ -74,18 +65,10 @@ func TestSnapshotNaiveBasic(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := containerd.MountAll(mounts...); err != nil {
|
||||
if err := containerd.MountAll(mounts, next); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, mount := range mounts {
|
||||
if !strings.HasPrefix(mount.Target, next) {
|
||||
t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, next)
|
||||
}
|
||||
|
||||
t.Log(containerd.MountCommand(mount))
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(next, "bar"), []byte("bar\n"), 0777); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue