Skip to content

Commit

Permalink
Merge pull request containerd#575 from dmcgowan/snapshot-test-checks
Browse files Browse the repository at this point in the history
Update basic snapshotter test
  • Loading branch information
stevvooe authored Feb 28, 2017
2 parents 78e4c59 + b8855a8 commit 9743a15
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions snapshot/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ func checkSnapshotterBasic(t *testing.T, snapshotter Snapshotter, work string) {
t.Fatal(err)
}

assert.Equal(t, si.Parent, "")
assert.Equal(t, "", si.Parent)
assert.Equal(t, KindCommitted, si.Kind)

next := filepath.Join(work, "nextlayer")
if err := os.MkdirAll(next, 0777); err != nil {
Expand Down Expand Up @@ -325,6 +326,14 @@ func checkSnapshotterBasic(t *testing.T, snapshotter Snapshotter, work string) {
t.Log(err)
}

ni, err := snapshotter.Stat(ctx, next)
if err != nil {
t.Fatal(err)
}

assert.Equal(t, committed, ni.Parent)
assert.Equal(t, KindActive, ni.Kind)

nextCommitted := filepath.Join(work, "committed-next")
if err := snapshotter.Commit(ctx, nextCommitted, next); err != nil {
t.Fatal(err)
Expand All @@ -335,7 +344,8 @@ func checkSnapshotterBasic(t *testing.T, snapshotter Snapshotter, work string) {
t.Fatal(err)
}

assert.Equal(t, si2.Parent, committed)
assert.Equal(t, committed, si2.Parent)
assert.Equal(t, KindCommitted, si2.Kind)

expected := map[string]Info{
si.Name: si,
Expand Down

0 comments on commit 9743a15

Please sign in to comment.