VOL-4154: Changes to techprofile module for etcd storage improvements.
- using protobuf definitions of techprofile template and instance
- store smaller footprint resource instance on the kv store
- store techprofile instance in cache
- reconcile techprofile instance from resource instance on adapter restart
- retry etcd get/put/delete on failure
- remove dealing of onu-gem-info data from PONResourceManager module
  as adapter has to deal with this.

Change-Id: I741181e3f0dc5c4a419ffbed577eb4d21b73c4d6
diff --git a/pkg/db/kvstore/kvutils_test.go b/pkg/db/kvstore/kvutils_test.go
index 98c96c9..5c2ef8c 100644
--- a/pkg/db/kvstore/kvutils_test.go
+++ b/pkg/db/kvstore/kvutils_test.go
@@ -16,8 +16,10 @@
 package kvstore
 
 import (
+	"context"
 	"github.com/stretchr/testify/assert"
 	"testing"
+	"time"
 )
 
 func TestToStringWithString(t *testing.T) {
@@ -58,3 +60,32 @@
 	assert.Equal(t, expectedResult, actualResult)
 	assert.NotEqual(t, error, nil)
 }
+
+func TestBackoffNoWait(t *testing.T) {
+	ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond)
+	defer cancel()
+	err := backoff(ctx, 0)
+	assert.Nil(t, err)
+}
+
+func TestBackoffSuccess(t *testing.T) {
+	ctx, cancel := context.WithTimeout(context.Background(), 1000*time.Millisecond)
+	defer cancel()
+	previous := time.Duration(0)
+	for i := 1; i < 5; i++ {
+		start := time.Now()
+		err := backoff(ctx, i)
+		assert.Nil(t, err)
+		current := time.Since(start)
+		assert.Greater(t, current.Milliseconds(), previous.Milliseconds())
+		previous = current
+	}
+}
+
+func TestBackoffContextTimeout(t *testing.T) {
+	ctx, cancel := context.WithTimeout(context.Background(), 1000*time.Millisecond)
+	defer cancel()
+	err := backoff(ctx, 10)
+	assert.NotNil(t, err)
+	assert.Equal(t, context.DeadlineExceeded, err)
+}