libnetwork/datastore: remove Store.KVStore()
It's no longer used, so we can remove it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
a5ee0d6af8
commit
02dc5ea720
2 changed files with 19 additions and 8 deletions
|
@ -202,11 +202,6 @@ func (ds *Store) Scope() string {
|
|||
return ds.scope
|
||||
}
|
||||
|
||||
// KVStore returns access to the KV Store.
|
||||
func (ds *Store) KVStore() store.Store {
|
||||
return ds.store
|
||||
}
|
||||
|
||||
// PutObjectAtomic provides an atomic add and update operation for a Record.
|
||||
func (ds *Store) PutObjectAtomic(kvObject KVObject) error {
|
||||
var (
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/docker/libnetwork/config"
|
||||
"github.com/docker/docker/libnetwork/datastore"
|
||||
store "github.com/docker/docker/libnetwork/internal/kvstore"
|
||||
)
|
||||
|
@ -20,9 +21,15 @@ func TestBoltdbBackend(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestNoPersist(t *testing.T) {
|
||||
testController, err := New(OptionBoltdbWithRandomDBFile(t))
|
||||
dbFile := filepath.Join(t.TempDir(), "bolt.db")
|
||||
configOption := func(c *config.Config) {
|
||||
c.Scope.Client.Provider = "boltdb"
|
||||
c.Scope.Client.Address = dbFile
|
||||
c.Scope.Client.Config = &store.Config{Bucket: "testBackend"}
|
||||
}
|
||||
testController, err := New(configOption)
|
||||
if err != nil {
|
||||
t.Fatalf("Error new controller: %v", err)
|
||||
t.Fatalf("Error creating new controller: %v", err)
|
||||
}
|
||||
defer testController.Stop()
|
||||
nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
|
||||
|
@ -33,12 +40,21 @@ func TestNoPersist(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("Error creating endpoint: %v", err)
|
||||
}
|
||||
testController.Stop()
|
||||
|
||||
// Create a new controller using the same database-file. The network
|
||||
// should not have persisted.
|
||||
testController, err = New(configOption)
|
||||
if err != nil {
|
||||
t.Fatalf("Error creating new controller: %v", err)
|
||||
}
|
||||
defer testController.Stop()
|
||||
|
||||
// FIXME(thaJeztah): GetObject uses the given key for lookups if no cache-store is present, but the KvObject's Key() to look up in cache....
|
||||
nwKVObject := &Network{id: nw.ID()}
|
||||
err = testController.getStore().GetObject(datastore.Key(datastore.NetworkKeyPrefix, nw.ID()), nwKVObject)
|
||||
if !errors.Is(err, store.ErrKeyNotFound) {
|
||||
t.Errorf("Expected %v error when retrieving network from store, got: %v", store.ErrKeyNotFound, err)
|
||||
t.Errorf("Expected %q error when retrieving network from store, got: %q", store.ErrKeyNotFound, err)
|
||||
}
|
||||
if nwKVObject.Exists() {
|
||||
t.Errorf("Network with persist=false should not be stored in KV Store")
|
||||
|
|
Loading…
Reference in a new issue