It's no longer used, so we can remove it.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -202,11 +202,6 @@ func (ds *Store) Scope() string {
|
| 202 | 202 |
return ds.scope |
| 203 | 203 |
} |
| 204 | 204 |
|
| 205 |
-// KVStore returns access to the KV Store. |
|
| 206 |
-func (ds *Store) KVStore() store.Store {
|
|
| 207 |
- return ds.store |
|
| 208 |
-} |
|
| 209 |
- |
|
| 210 | 205 |
// PutObjectAtomic provides an atomic add and update operation for a Record. |
| 211 | 206 |
func (ds *Store) PutObjectAtomic(kvObject KVObject) error {
|
| 212 | 207 |
var ( |
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"path/filepath" |
| 7 | 7 |
"testing" |
| 8 | 8 |
|
| 9 |
+ "github.com/docker/docker/libnetwork/config" |
|
| 9 | 10 |
"github.com/docker/docker/libnetwork/datastore" |
| 10 | 11 |
store "github.com/docker/docker/libnetwork/internal/kvstore" |
| 11 | 12 |
) |
| ... | ... |
@@ -20,9 +21,15 @@ func TestBoltdbBackend(t *testing.T) {
|
| 20 | 20 |
} |
| 21 | 21 |
|
| 22 | 22 |
func TestNoPersist(t *testing.T) {
|
| 23 |
- testController, err := New(OptionBoltdbWithRandomDBFile(t)) |
|
| 23 |
+ dbFile := filepath.Join(t.TempDir(), "bolt.db") |
|
| 24 |
+ configOption := func(c *config.Config) {
|
|
| 25 |
+ c.Scope.Client.Provider = "boltdb" |
|
| 26 |
+ c.Scope.Client.Address = dbFile |
|
| 27 |
+ c.Scope.Client.Config = &store.Config{Bucket: "testBackend"}
|
|
| 28 |
+ } |
|
| 29 |
+ testController, err := New(configOption) |
|
| 24 | 30 |
if err != nil {
|
| 25 |
- t.Fatalf("Error new controller: %v", err)
|
|
| 31 |
+ t.Fatalf("Error creating new controller: %v", err)
|
|
| 26 | 32 |
} |
| 27 | 33 |
defer testController.Stop() |
| 28 | 34 |
nw, err := testController.NewNetwork("host", "host", "", NetworkOptionPersist(false))
|
| ... | ... |
@@ -33,12 +40,21 @@ func TestNoPersist(t *testing.T) {
|
| 33 | 33 |
if err != nil {
|
| 34 | 34 |
t.Fatalf("Error creating endpoint: %v", err)
|
| 35 | 35 |
} |
| 36 |
+ testController.Stop() |
|
| 37 |
+ |
|
| 38 |
+ // Create a new controller using the same database-file. The network |
|
| 39 |
+ // should not have persisted. |
|
| 40 |
+ testController, err = New(configOption) |
|
| 41 |
+ if err != nil {
|
|
| 42 |
+ t.Fatalf("Error creating new controller: %v", err)
|
|
| 43 |
+ } |
|
| 44 |
+ defer testController.Stop() |
|
| 36 | 45 |
|
| 37 | 46 |
// 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.... |
| 38 | 47 |
nwKVObject := &Network{id: nw.ID()}
|
| 39 | 48 |
err = testController.getStore().GetObject(datastore.Key(datastore.NetworkKeyPrefix, nw.ID()), nwKVObject) |
| 40 | 49 |
if !errors.Is(err, store.ErrKeyNotFound) {
|
| 41 |
- t.Errorf("Expected %v error when retrieving network from store, got: %v", store.ErrKeyNotFound, err)
|
|
| 50 |
+ t.Errorf("Expected %q error when retrieving network from store, got: %q", store.ErrKeyNotFound, err)
|
|
| 42 | 51 |
} |
| 43 | 52 |
if nwKVObject.Exists() {
|
| 44 | 53 |
t.Errorf("Network with persist=false should not be stored in KV Store")
|