Cleanup metadata tests

This commit replaces func returns with t.Cleanup,
which makes API and tests slightly easier to maintain.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2022-06-27 11:54:45 -07:00
parent 813780e443
commit d97b754a5b
9 changed files with 73 additions and 123 deletions

View File

@@ -32,7 +32,7 @@ import (
"github.com/containerd/containerd/labels"
"github.com/containerd/containerd/leases"
"github.com/containerd/containerd/namespaces"
digest "github.com/opencontainers/go-digest"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
bolt "go.etcd.io/bbolt"
)
@@ -95,8 +95,7 @@ func TestContent(t *testing.T) {
}
func TestContentLeased(t *testing.T) {
ctx, db, cancel := testDB(t)
defer cancel()
ctx, db := testDB(t)
cs := db.ContentStore()
@@ -143,11 +142,8 @@ func TestContentLeased(t *testing.T) {
}
func TestIngestLeased(t *testing.T) {
ctx, db, cancel := testDB(t)
defer cancel()
ctx, db := testDB(t)
cs := db.ContentStore()
blob := []byte("any content")
expected := digest.FromBytes(blob)