VOL-1837,update comment's for unit test file's
review comments updated
Change-Id: Ib4d8d5d47c906c21fd54f5d68aa57c98763a8697
diff --git a/adaptercore/resourcemanager/resourcemanager_test.go b/adaptercore/resourcemanager/resourcemanager_test.go
index 1373a54..7210b3b 100644
--- a/adaptercore/resourcemanager/resourcemanager_test.go
+++ b/adaptercore/resourcemanager/resourcemanager_test.go
@@ -14,6 +14,13 @@
* limitations under the License.
*/
+/*
+This file contains unit test cases for functions in the file resourcemanager.go.
+This file also implements the Client interface to mock the kv-client, fields struct to mock OpenOltResourceMgr
+and few utility functions.
+*/
+
+//Package adaptercore provides the utility for olt devices, flows and statistics
package resourcemanager
import (
@@ -56,6 +63,7 @@
FlowIDpool = "flow_id_pool"
)
+// fields mocks OpenOltResourceMgr struct.
type fields struct {
DeviceID string
HostAndPort string
@@ -67,9 +75,12 @@
DevInfo *openolt.DeviceInfo
ResourceMgrs map[uint32]*ponrmgr.PONResourceManager
}
+
+// MockKVClient mocks the AdapterProxy interface.
type MockResKVClient struct {
}
+// getResMgr mocks OpenOltResourceMgr struct.
func getResMgr() *fields {
var resMgr fields
resMgr.KVStore = &model.Backend{
@@ -103,6 +114,8 @@
resMgr.ResourceMgrs[2] = ponMgr
return &resMgr
}
+
+// List function implemented for KVClient.
func (kvclient *MockResKVClient) List(key string, timeout int, lock ...bool) (map[string]*kvstore.KVPair, error) {
return nil, errors.New("key didn't find")
}
@@ -216,6 +229,7 @@
func (kvclient *MockResKVClient) Close() {
}
+// testResMgrObject maps fields type to OpenOltResourceMgr type.
func testResMgrObject(testResMgr *fields) *OpenOltResourceMgr {
return &OpenOltResourceMgr{
DeviceID: testResMgr.DeviceID,