Code Review
/
ric-plt
/
sdlgo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
New ListKeys API in syncstorage
[ric-plt/sdlgo.git]
/
sdl_private_fn_test.go
diff --git
a/sdl_private_fn_test.go
b/sdl_private_fn_test.go
index
318d84f
..
fae2a02
100644
(file)
--- a/
sdl_private_fn_test.go
+++ b/
sdl_private_fn_test.go
@@
-24,10
+24,22
@@
package sdlgo
//NewSdlInstanceForTest is used in unit tests only in order to replace the
//underlying redis implementation with mock
//NewSdlInstanceForTest is used in unit tests only in order to replace the
//underlying redis implementation with mock
+//Deprecated: Will be removed in a future release.
func NewSdlInstanceForTest(NameSpace string, instance iDatabase) *SdlInstance {
func NewSdlInstanceForTest(NameSpace string, instance iDatabase) *SdlInstance {
+ db := &Database{}
+ db.instances = append(db.instances, instance)
+
return &SdlInstance{
nameSpace: NameSpace,
nsPrefix: "{" + NameSpace + "},",
return &SdlInstance{
nameSpace: NameSpace,
nsPrefix: "{" + NameSpace + "},",
- storage: newSyncStorage(
&Database{instance: instance}
),
+ storage: newSyncStorage(
db
),
}
}
}
}
+
+// NewSyncStorageForTest is used only in unit tests to mock database.
+func NewSyncStorageForTest(dbMock iDatabase) *SyncStorage {
+ db := &Database{}
+ db.instances = append(db.instances, dbMock)
+
+ return newSyncStorage(db)
+}