Files
moby/internal/testutil/storeutils/store.go
Sebastiaan van Stijn 4b230a4909 internal/testutils: merge with internal/testutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-09-08 10:08:35 +02:00

21 lines
455 B
Go

package storeutils
import (
"testing"
"github.com/moby/moby/v2/daemon/libnetwork/datastore"
"gotest.tools/v3/assert"
)
// NewTempStore creates a new temporary libnetwork store for testing purposes.
// The store is created in a temporary directory that is cleaned up when the
// test finishes.
func NewTempStore(t *testing.T) *datastore.Store {
t.Helper()
ds, err := datastore.New(t.TempDir(), "libnetwork")
assert.NilError(t, err)
return ds
}