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:
parent
813780e443
commit
d97b754a5b
@ -35,6 +35,7 @@ import (
|
|||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,16 +44,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestContainersList(t *testing.T) {
|
func TestContainersList(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
store := NewContainerStore(NewDB(db, nil, nil))
|
store := NewContainerStore(NewDB(db, nil, nil))
|
||||||
|
|
||||||
spec := &specs.Spec{}
|
spec := &specs.Spec{}
|
||||||
encoded, err := protobuf.MarshalAnyToProto(spec)
|
encoded, err := protobuf.MarshalAnyToProto(spec)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
testset := map[string]*containers.Container{}
|
testset := map[string]*containers.Container{}
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
@ -175,22 +171,18 @@ func TestContainersList(t *testing.T) {
|
|||||||
|
|
||||||
// TestContainersUpdate ensures that updates are taken in an expected manner.
|
// TestContainersUpdate ensures that updates are taken in an expected manner.
|
||||||
func TestContainersCreateUpdateDelete(t *testing.T) {
|
func TestContainersCreateUpdateDelete(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
var (
|
||||||
defer cancel()
|
ctx, db = testEnv(t)
|
||||||
|
store = NewContainerStore(NewDB(db, nil, nil))
|
||||||
|
spec = &specs.Spec{}
|
||||||
|
)
|
||||||
|
|
||||||
store := NewContainerStore(NewDB(db, nil, nil))
|
|
||||||
|
|
||||||
spec := &specs.Spec{}
|
|
||||||
encoded, err := protobuf.MarshalAnyToProto(spec)
|
encoded, err := protobuf.MarshalAnyToProto(spec)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
spec.Annotations = map[string]string{"updated": "true"}
|
spec.Annotations = map[string]string{"updated": "true"}
|
||||||
encodedUpdated, err := protobuf.MarshalAnyToProto(spec)
|
encodedUpdated, err := protobuf.MarshalAnyToProto(spec)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, testcase := range []struct {
|
for _, testcase := range []struct {
|
||||||
name string
|
name string
|
||||||
@ -708,20 +700,19 @@ func checkContainersEqual(t *testing.T, a, b *containers.Container, format strin
|
|||||||
assert.True(t, cmp.Equal(a, b, compareNil, compareAny))
|
assert.True(t, cmp.Equal(a, b, compareNil, compareAny))
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEnv(t *testing.T) (context.Context, *bolt.DB, func()) {
|
func testEnv(t *testing.T) (context.Context, *bolt.DB) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
ctx = namespaces.WithNamespace(ctx, "testing")
|
ctx = namespaces.WithNamespace(ctx, "testing")
|
||||||
ctx = logtest.WithT(ctx, t)
|
ctx = logtest.WithT(ctx, t)
|
||||||
|
|
||||||
dirname := t.TempDir()
|
dirname := t.TempDir()
|
||||||
|
|
||||||
db, err := bolt.Open(filepath.Join(dirname, "meta.db"), 0644, nil)
|
db, err := bolt.Open(filepath.Join(dirname, "meta.db"), 0644, nil)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx, db, func() {
|
t.Cleanup(func() {
|
||||||
db.Close()
|
assert.NoError(t, db.Close())
|
||||||
cancel()
|
cancel()
|
||||||
}
|
})
|
||||||
|
|
||||||
|
return ctx, db
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
"github.com/containerd/containerd/labels"
|
"github.com/containerd/containerd/labels"
|
||||||
"github.com/containerd/containerd/leases"
|
"github.com/containerd/containerd/leases"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"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"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
@ -95,8 +95,7 @@ func TestContent(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestContentLeased(t *testing.T) {
|
func TestContentLeased(t *testing.T) {
|
||||||
ctx, db, cancel := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
cs := db.ContentStore()
|
cs := db.ContentStore()
|
||||||
|
|
||||||
@ -143,11 +142,8 @@ func TestContentLeased(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIngestLeased(t *testing.T) {
|
func TestIngestLeased(t *testing.T) {
|
||||||
ctx, db, cancel := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
cs := db.ContentStore()
|
cs := db.ContentStore()
|
||||||
|
|
||||||
blob := []byte("any content")
|
blob := []byte("any content")
|
||||||
expected := digest.FromBytes(blob)
|
expected := digest.FromBytes(blob)
|
||||||
|
|
||||||
|
@ -41,8 +41,10 @@ import (
|
|||||||
"github.com/containerd/containerd/protobuf/types"
|
"github.com/containerd/containerd/protobuf/types"
|
||||||
"github.com/containerd/containerd/snapshots"
|
"github.com/containerd/containerd/snapshots"
|
||||||
"github.com/containerd/containerd/snapshots/native"
|
"github.com/containerd/containerd/snapshots/native"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ func withSnapshotter(name string, fn func(string) (snapshots.Snapshotter, error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testDB(t *testing.T, opt ...testOpt) (context.Context, *DB, func()) {
|
func testDB(t *testing.T, opt ...testOpt) (context.Context, *DB) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
ctx = namespaces.WithNamespace(ctx, "testing")
|
ctx = namespaces.WithNamespace(ctx, "testing")
|
||||||
ctx = logtest.WithT(ctx, t)
|
ctx = logtest.WithT(ctx, t)
|
||||||
@ -75,9 +77,7 @@ func testDB(t *testing.T, opt ...testOpt) (context.Context, *DB, func()) {
|
|||||||
dirname := t.TempDir()
|
dirname := t.TempDir()
|
||||||
|
|
||||||
snapshotter, err := native.NewSnapshotter(filepath.Join(dirname, "native"))
|
snapshotter, err := native.NewSnapshotter(filepath.Join(dirname, "native"))
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
snapshotters := map[string]snapshots.Snapshotter{
|
snapshotters := map[string]snapshots.Snapshotter{
|
||||||
"native": snapshotter,
|
"native": snapshotter,
|
||||||
@ -92,41 +92,30 @@ func testDB(t *testing.T, opt ...testOpt) (context.Context, *DB, func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cs, err := local.NewStore(filepath.Join(dirname, "content"))
|
cs, err := local.NewStore(filepath.Join(dirname, "content"))
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
bdb, err := bolt.Open(filepath.Join(dirname, "metadata.db"), 0644, nil)
|
bdb, err := bolt.Open(filepath.Join(dirname, "metadata.db"), 0644, nil)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
db := NewDB(bdb, cs, snapshotters)
|
db := NewDB(bdb, cs, snapshotters)
|
||||||
if err := db.Init(ctx); err != nil {
|
require.NoError(t, db.Init(ctx))
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return ctx, db, func() {
|
t.Cleanup(func() {
|
||||||
bdb.Close()
|
assert.NoError(t, bdb.Close())
|
||||||
cancel()
|
cancel()
|
||||||
}
|
})
|
||||||
|
|
||||||
|
return ctx, db
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInit(t *testing.T) {
|
func TestInit(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
if err := NewDB(db, nil, nil).Init(ctx); err != nil {
|
require.NoError(t, NewDB(db, nil, nil).Init(ctx))
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
version, err := readDBVersion(db, bucketKeyVersion)
|
version, err := readDBVersion(db, bucketKeyVersion)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
assert.EqualValues(t, version, dbVersion, "unexpected version %d, expected %d", version, dbVersion)
|
||||||
}
|
|
||||||
if version != dbVersion {
|
|
||||||
t.Fatalf("Unexpected version %d, expected %d", version, dbVersion)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMigrations(t *testing.T) {
|
func TestMigrations(t *testing.T) {
|
||||||
@ -316,8 +305,7 @@ func TestMigrations(t *testing.T) {
|
|||||||
|
|
||||||
func runMigrationTest(i int, init, check func(*bolt.Tx) error) func(t *testing.T) {
|
func runMigrationTest(i int, init, check func(*bolt.Tx) error) func(t *testing.T) {
|
||||||
return func(t *testing.T) {
|
return func(t *testing.T) {
|
||||||
_, db, cancel := testEnv(t)
|
_, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
if err := db.Update(init); err != nil {
|
if err := db.Update(init); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -27,7 +27,9 @@ import (
|
|||||||
|
|
||||||
"github.com/containerd/containerd/gc"
|
"github.com/containerd/containerd/gc"
|
||||||
"github.com/containerd/containerd/metadata/boltutil"
|
"github.com/containerd/containerd/metadata/boltutil"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
bolt "go.etcd.io/bbolt"
|
bolt "go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,11 +43,8 @@ func TestResourceMax(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGCRoots(t *testing.T) {
|
func TestGCRoots(t *testing.T) {
|
||||||
db, cleanup, err := newDatabase(t)
|
db, err := newDatabase(t)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer cleanup()
|
|
||||||
|
|
||||||
alters := []alterFunc{
|
alters := []alterFunc{
|
||||||
addImage("ns1", "image1", dgst(1), nil),
|
addImage("ns1", "image1", dgst(1), nil),
|
||||||
@ -162,11 +161,8 @@ func TestGCRoots(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGCRemove(t *testing.T) {
|
func TestGCRemove(t *testing.T) {
|
||||||
db, cleanup, err := newDatabase(t)
|
db, err := newDatabase(t)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer cleanup()
|
|
||||||
|
|
||||||
alters := []alterFunc{
|
alters := []alterFunc{
|
||||||
addImage("ns1", "image1", dgst(1), nil),
|
addImage("ns1", "image1", dgst(1), nil),
|
||||||
@ -256,11 +252,8 @@ func TestGCRemove(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGCRefs(t *testing.T) {
|
func TestGCRefs(t *testing.T) {
|
||||||
db, cleanup, err := newDatabase(t)
|
db, err := newDatabase(t)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
defer cleanup()
|
|
||||||
|
|
||||||
alters := []alterFunc{
|
alters := []alterFunc{
|
||||||
addContent("ns1", dgst(1), nil),
|
addContent("ns1", dgst(1), nil),
|
||||||
@ -389,12 +382,11 @@ func TestGCRefs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCollectibleResources(t *testing.T) {
|
func TestCollectibleResources(t *testing.T) {
|
||||||
db, cleanup, err := newDatabase(t)
|
db, err := newDatabase(t)
|
||||||
if err != nil {
|
require.NoError(t, err)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
testResource := gc.ResourceType(0x10)
|
testResource := gc.ResourceType(0x10)
|
||||||
defer cleanup()
|
|
||||||
alters := []alterFunc{
|
alters := []alterFunc{
|
||||||
addContent("ns1", dgst(1), nil),
|
addContent("ns1", dgst(1), nil),
|
||||||
addImage("ns1", "image1", dgst(1), nil),
|
addImage("ns1", "image1", dgst(1), nil),
|
||||||
@ -556,17 +548,19 @@ func (tc *testCollector) Finish() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newDatabase(t testing.TB) (*bolt.DB, func(), error) {
|
func newDatabase(t testing.TB) (*bolt.DB, error) {
|
||||||
td := t.TempDir()
|
td := t.TempDir()
|
||||||
|
|
||||||
db, err := bolt.Open(filepath.Join(td, "test.db"), 0777, nil)
|
db, err := bolt.Open(filepath.Join(td, "test.db"), 0777, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return db, func() {
|
t.Cleanup(func() {
|
||||||
db.Close()
|
assert.NoError(t, db.Close())
|
||||||
}, nil
|
})
|
||||||
|
|
||||||
|
return db, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNodeC(ctx context.Context, t *testing.T, db *bolt.DB, expected []gc.Node, fn func(context.Context, *bolt.Tx, chan<- gc.Node) error) {
|
func checkNodeC(ctx context.Context, t *testing.T, db *bolt.DB, expected []gc.Node, fn func(context.Context, *bolt.Tx, chan<- gc.Node) error) {
|
||||||
|
@ -26,13 +26,12 @@ import (
|
|||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/filters"
|
"github.com/containerd/containerd/filters"
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
digest "github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestImagesList(t *testing.T) {
|
func TestImagesList(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
store := NewImageStore(NewDB(db, nil, nil))
|
store := NewImageStore(NewDB(db, nil, nil))
|
||||||
|
|
||||||
testset := map[string]*images.Image{}
|
testset := map[string]*images.Image{}
|
||||||
@ -148,8 +147,7 @@ func TestImagesList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func TestImagesCreateUpdateDelete(t *testing.T) {
|
func TestImagesCreateUpdateDelete(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
store := NewImageStore(NewDB(db, nil, nil))
|
store := NewImageStore(NewDB(db, nil, nil))
|
||||||
|
|
||||||
for _, testcase := range []struct {
|
for _, testcase := range []struct {
|
||||||
|
@ -28,8 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestLeases(t *testing.T) {
|
func TestLeases(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
lm := NewLeaseManager(NewDB(db, nil, nil))
|
lm := NewLeaseManager(NewDB(db, nil, nil))
|
||||||
|
|
||||||
@ -108,8 +107,7 @@ func TestLeases(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLeasesList(t *testing.T) {
|
func TestLeasesList(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
lm := NewLeaseManager(NewDB(db, nil, nil))
|
lm := NewLeaseManager(NewDB(db, nil, nil))
|
||||||
|
|
||||||
@ -252,8 +250,7 @@ func TestLeasesList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLeaseResource(t *testing.T) {
|
func TestLeaseResource(t *testing.T) {
|
||||||
ctx, db, cancel := testEnv(t)
|
ctx, db := testEnv(t)
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
lm := NewLeaseManager(NewDB(db, nil, nil))
|
lm := NewLeaseManager(NewDB(db, nil, nil))
|
||||||
|
|
||||||
|
@ -29,8 +29,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateDelete(t *testing.T) {
|
func TestCreateDelete(t *testing.T) {
|
||||||
ctx, db, cleanup := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer cleanup()
|
|
||||||
|
|
||||||
subtests := []struct {
|
subtests := []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -27,8 +27,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSandboxCreate(t *testing.T) {
|
func TestSandboxCreate(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
@ -60,8 +59,7 @@ func TestSandboxCreate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxCreateDup(t *testing.T) {
|
func TestSandboxCreateDup(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
@ -83,9 +81,7 @@ func TestSandboxCreateDup(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxUpdate(t *testing.T) {
|
func TestSandboxUpdate(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
if _, err := store.Create(ctx, api.Sandbox{
|
if _, err := store.Create(ctx, api.Sandbox{
|
||||||
@ -131,9 +127,7 @@ func TestSandboxUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxGetInvalid(t *testing.T) {
|
func TestSandboxGetInvalid(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
_, err := store.Get(ctx, "invalid_id")
|
_, err := store.Get(ctx, "invalid_id")
|
||||||
@ -145,9 +139,7 @@ func TestSandboxGetInvalid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxList(t *testing.T) {
|
func TestSandboxList(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
in := []api.Sandbox{
|
in := []api.Sandbox{
|
||||||
@ -192,9 +184,7 @@ func TestSandboxList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxListWithFilter(t *testing.T) {
|
func TestSandboxListWithFilter(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
in := []api.Sandbox{
|
in := []api.Sandbox{
|
||||||
@ -237,8 +227,7 @@ func TestSandboxListWithFilter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSandboxDelete(t *testing.T) {
|
func TestSandboxDelete(t *testing.T) {
|
||||||
ctx, db, done := testDB(t)
|
ctx, db := testDB(t)
|
||||||
defer done()
|
|
||||||
|
|
||||||
store := NewSandboxStore(db)
|
store := NewSandboxStore(db)
|
||||||
|
|
||||||
|
@ -73,11 +73,9 @@ func TestMetadata(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSnapshotterWithRef(t *testing.T) {
|
func TestSnapshotterWithRef(t *testing.T) {
|
||||||
ctx, db, done := testDB(t, withSnapshotter("tmp", func(string) (snapshots.Snapshotter, error) {
|
ctx, db := testDB(t, withSnapshotter("tmp", func(string) (snapshots.Snapshotter, error) {
|
||||||
return NewTmpSnapshotter(), nil
|
return NewTmpSnapshotter(), nil
|
||||||
}))
|
}))
|
||||||
defer done()
|
|
||||||
|
|
||||||
sn := db.Snapshotter("tmp")
|
sn := db.Snapshotter("tmp")
|
||||||
|
|
||||||
test1opt := snapshots.WithLabels(
|
test1opt := snapshots.WithLabels(
|
||||||
|
Loading…
Reference in New Issue
Block a user