mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
21 lines
455 B
Go
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
|
|
}
|