[VOL-2735]Durations in voltha-lib-go should be specified as type time.Duration not int
Change-Id: I782e44fe1dc041b9eb54fd837950d2176e18fe42
diff --git a/pkg/ponresourcemanager/ponresourcemanager.go b/pkg/ponresourcemanager/ponresourcemanager.go
index 2d388a5..4cccb84 100755
--- a/pkg/ponresourcemanager/ponresourcemanager.go
+++ b/pkg/ponresourcemanager/ponresourcemanager.go
@@ -23,6 +23,7 @@
"errors"
"fmt"
"strconv"
+ "time"
bitmap "github.com/boljen/go-bitmap"
"github.com/opencord/voltha-lib-go/v3/pkg/db"
@@ -124,7 +125,7 @@
POOL = "pool"
NUM_OF_PON_INTF = 16
- KVSTORE_RETRY_TIMEOUT = 5
+ KVSTORE_RETRY_TIMEOUT = 5 * time.Second
//Path on the KV store for storing reserved gem ports
//Format: reserved_gemport_ids
RESERVED_GEMPORT_IDS_PATH = "reserved_gemport_ids"
@@ -155,7 +156,7 @@
Globalorlocal string
}
-func newKVClient(storeType string, address string, timeout int) (kvstore.Client, error) {
+func newKVClient(storeType string, address string, timeout time.Duration) (kvstore.Client, error) {
logger.Infow("kv-store-type", log.Fields{"store": storeType})
switch storeType {
case "consul":
diff --git a/pkg/ponresourcemanager/ponresourcemanager_test.go b/pkg/ponresourcemanager/ponresourcemanager_test.go
index 11c0072..c2a651e 100644
--- a/pkg/ponresourcemanager/ponresourcemanager_test.go
+++ b/pkg/ponresourcemanager/ponresourcemanager_test.go
@@ -26,6 +26,7 @@
"github.com/stretchr/testify/assert"
"strings"
"testing"
+ "time"
)
const (
@@ -88,7 +89,7 @@
}
// Reserve mock function implementation for KVClient
-func (kvclient *MockResKVClient) Reserve(ctx context.Context, key string, value interface{}, ttl int64) (interface{}, error) {
+func (kvclient *MockResKVClient) Reserve(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error) {
return nil, errors.New("key didn't find")
}
@@ -113,7 +114,7 @@
}
// AcquireLock mock function implementation for KVClient
-func (kvclient *MockResKVClient) AcquireLock(ctx context.Context, lockName string, timeout int) error {
+func (kvclient *MockResKVClient) AcquireLock(ctx context.Context, lockName string, timeout time.Duration) error {
return nil
}