Merge pull request #1754 from AkihiroSuda/fix-snapshot-commit-spec
snapshot: fix specification of Commit
This commit is contained in:
commit
19168f98fe
@ -280,9 +280,7 @@ type Snapshotter interface {
|
|||||||
// A committed snapshot will be created under name with the parent of the
|
// A committed snapshot will be created under name with the parent of the
|
||||||
// active snapshot.
|
// active snapshot.
|
||||||
//
|
//
|
||||||
// Commit may be called multiple times on the same key. Snapshots created
|
// After commit, the snapshot identified by key is removed.
|
||||||
// in this manner will all reference the parent used to start the
|
|
||||||
// transaction.
|
|
||||||
Commit(ctx context.Context, name, key string, opts ...Opt) error
|
Commit(ctx context.Context, name, key string, opts ...Opt) error
|
||||||
|
|
||||||
// Remove the committed or active snapshot by the provided key.
|
// Remove the committed or active snapshot by the provided key.
|
||||||
|
@ -144,6 +144,11 @@ func checkSnapshotterBasic(ctx context.Context, t *testing.T, snapshotter snapsh
|
|||||||
assert.Equal(t, "", si.Parent)
|
assert.Equal(t, "", si.Parent)
|
||||||
assert.Equal(t, snapshot.KindCommitted, si.Kind)
|
assert.Equal(t, snapshot.KindCommitted, si.Kind)
|
||||||
|
|
||||||
|
_, err = snapshotter.Stat(ctx, preparing)
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("%s should no longer be available after Commit", preparing)
|
||||||
|
}
|
||||||
|
|
||||||
next := filepath.Join(work, "nextlayer")
|
next := filepath.Join(work, "nextlayer")
|
||||||
if err := os.MkdirAll(next, 0777); err != nil {
|
if err := os.MkdirAll(next, 0777); err != nil {
|
||||||
t.Fatalf("failure reason: %+v", err)
|
t.Fatalf("failure reason: %+v", err)
|
||||||
@ -187,6 +192,11 @@ func checkSnapshotterBasic(ctx context.Context, t *testing.T, snapshotter snapsh
|
|||||||
assert.Equal(t, committed, si2.Parent)
|
assert.Equal(t, committed, si2.Parent)
|
||||||
assert.Equal(t, snapshot.KindCommitted, si2.Kind)
|
assert.Equal(t, snapshot.KindCommitted, si2.Kind)
|
||||||
|
|
||||||
|
_, err = snapshotter.Stat(ctx, next)
|
||||||
|
if err == nil {
|
||||||
|
t.Fatalf("%s should no longer be available after Commit", next)
|
||||||
|
}
|
||||||
|
|
||||||
expected := map[string]snapshot.Info{
|
expected := map[string]snapshot.Info{
|
||||||
si.Name: si,
|
si.Name: si,
|
||||||
si2.Name: si2,
|
si2.Name: si2,
|
||||||
|
Loading…
Reference in New Issue
Block a user