libnetwork: TestBoltdbBackend(): use t.TempDir()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-02 18:14:24 +02:00
parent 2fd88c7ca4
commit 6944d2dddb
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -2,6 +2,7 @@ package libnetwork
import (
"os"
"path/filepath"
"testing"
"github.com/docker/docker/libnetwork/datastore"
@ -11,9 +12,10 @@ import (
func TestBoltdbBackend(t *testing.T) {
defer os.Remove(datastore.DefaultScope("").Client.Address)
testLocalBackend(t, "", "", nil)
defer os.Remove("/tmp/boltdb.db")
config := &store.Config{Bucket: "testBackend"}
testLocalBackend(t, "boltdb", "/tmp/boltdb.db", config)
tmpPath := filepath.Join(t.TempDir(), "boltdb.db")
testLocalBackend(t, "boltdb", tmpPath, &store.Config{
Bucket: "testBackend",
})
}
func TestNoPersist(t *testing.T) {