Skip to content

Commit

Permalink
reuse layer test
Browse files Browse the repository at this point in the history
  • Loading branch information
joeybrown-sf committed Jul 16, 2024
1 parent 6a779e3 commit ba02977
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cache/volume_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,21 @@ func testVolumeCache(t *testing.T, when spec.G, it spec.S) {
h.AssertEq(t, string(bytes), "existing data")
})
})

when("the layer does not exist", func() {
it("fails with a read error", func() {
err := subject.ReuseLayer("some_nonexistent_sha")
isReadErr, _ := cache.IsReadErr(err)
h.AssertEq(t, isReadErr, true)

err = subject.Commit()
h.AssertNil(t, err)

_, err = subject.RetrieveLayer("some_sha")
isReadErr, _ = cache.IsReadErr(err)
h.AssertEq(t, isReadErr, true)
})
})
})

when("attempting to commit more than once", func() {
Expand Down

0 comments on commit ba02977

Please sign in to comment.