snapshot: ensure tests compile

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2016-12-07 19:59:03 -08:00
parent f7850ccd68
commit 65e668a6b8
No known key found for this signature in database
GPG key ID: FB5F6B2905D7ECF3
2 changed files with 10 additions and 4 deletions

View file

@ -139,6 +139,9 @@ func NewManager(root string) (*Manager, error) {
// working directory for any associated activity, such as running a container // working directory for any associated activity, such as running a container
// or importing a layer. // or importing a layer.
// //
// The implementation may choose to write data directly to dst, opting to
// return no mounts instead.
//
// Once the writes have completed, Manager.Commit or // Once the writes have completed, Manager.Commit or
// Manager.Rollback should be called on dst. // Manager.Rollback should be called on dst.
func (lm *Manager) Prepare(dst, parent string) ([]containerd.Mount, error) { func (lm *Manager) Prepare(dst, parent string) ([]containerd.Mount, error) {
@ -171,6 +174,7 @@ func (lm *Manager) Prepare(dst, parent string) ([]containerd.Mount, error) {
return nil, err return nil, err
} }
// TODO(stevvooe): Write this metadata to disk to make it useful.
lm.active[dst] = activeLayer{ lm.active[dst] = activeLayer{
parent: parent, parent: parent,
upperdir: upperdir, upperdir: upperdir,

View file

@ -6,6 +6,8 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"testing" "testing"
"github.com/docker/containerd"
) )
// TestSnapshotManagerBasic implements something similar to the conceptual // TestSnapshotManagerBasic implements something similar to the conceptual
@ -44,10 +46,10 @@ func TestSnapshotManagerBasic(t *testing.T) {
t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, preparing) t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, preparing)
} }
t.Log(MountCommand(mount)) t.Log(containerd.MountCommand(mount))
} }
if err := MountAll(mounts...); err != nil { if err := containerd.MountAll(mounts...); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -78,7 +80,7 @@ func TestSnapshotManagerBasic(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if err := MountAll(mounts...); err != nil { if err := containerd.MountAll(mounts...); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -87,7 +89,7 @@ func TestSnapshotManagerBasic(t *testing.T) {
t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, next) t.Fatalf("expected mount target to be prefixed with tmpDir: %q does not startwith %q", mount.Target, next)
} }
t.Log(MountCommand(mount)) t.Log(containerd.MountCommand(mount))
} }
if err := ioutil.WriteFile(filepath.Join(next, "bar"), []byte("bar\n"), 0777); err != nil { if err := ioutil.WriteFile(filepath.Join(next, "bar"), []byte("bar\n"), 0777); err != nil {