diff --git a/pkg/db/backend_test.go b/pkg/db/backend_test.go
index 98b72a0..b8c66bd 100644
--- a/pkg/db/backend_test.go
+++ b/pkg/db/backend_test.go
@@ -41,37 +41,35 @@
 )
 
 func TestMain(m *testing.M) {
-	ctx := context.Background()
 	var err error
 	embedEtcdServerPort, err = freeport.GetFreePort()
 	if err != nil {
-		logger.Fatal(ctx, err)
+		logger.Fatal(err)
 	}
 	dummyEtcdServerPort, err = freeport.GetFreePort()
 	if err != nil {
-		logger.Fatal(ctx, err)
+		logger.Fatal(err)
 	}
 	peerPort, err := freeport.GetFreePort()
 	if err != nil {
-		logger.Fatal(ctx, err)
+		logger.Fatal(err)
 	}
-	etcdServer := mocks.StartEtcdServer(ctx, mocks.MKConfig(ctx, "voltha.db.test", embedEtcdServerPort, peerPort, "voltha.lib.db", "error"))
+	etcdServer := mocks.StartEtcdServer(mocks.MKConfig("voltha.db.test", embedEtcdServerPort, peerPort, "voltha.lib.db", "error"))
 	res := m.Run()
 
-	etcdServer.Stop(ctx)
+	etcdServer.Stop()
 	os.Exit(res)
 }
 
 func provisionBackendWithEmbeddedEtcdServer(t *testing.T) *Backend {
-	ctx := context.Background()
-	backend := NewBackend(ctx, "etcd", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
+	backend := NewBackend("etcd", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
 	assert.NotNil(t, backend)
 	assert.NotNil(t, backend.Client)
 	return backend
 }
 
 func provisionBackendWithDummyEtcdServer(t *testing.T) *Backend {
-	backend := NewBackend(context.Background(), "etcd", embedEtcdServerHost+":"+strconv.Itoa(dummyEtcdServerPort), defaultTimeout, defaultPathPrefix)
+	backend := NewBackend("etcd", embedEtcdServerHost+":"+strconv.Itoa(dummyEtcdServerPort), defaultTimeout, defaultPathPrefix)
 	assert.NotNil(t, backend)
 	assert.NotNil(t, backend.Client)
 	return backend
@@ -80,7 +78,7 @@
 // Create instance using Etcd Kvstore
 func TestNewBackend_EtcdKvStore(t *testing.T) {
 	address := embedEtcdServerHost + ":" + strconv.Itoa(embedEtcdServerPort)
-	backend := NewBackend(context.Background(), "etcd", address, defaultTimeout, defaultPathPrefix)
+	backend := NewBackend("etcd", address, defaultTimeout, defaultPathPrefix)
 
 	// Verify all attributes of backend have got set correctly
 	assert.NotNil(t, backend)
@@ -96,7 +94,7 @@
 
 // Create instance using Consul Kvstore
 func TestNewBackend_ConsulKvStore(t *testing.T) {
-	backend := NewBackend(context.Background(), "consul", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
+	backend := NewBackend("consul", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
 
 	// Verify kvstore type attribute of backend has got set correctly
 	assert.NotNil(t, backend)
@@ -106,7 +104,7 @@
 
 // Create instance using Invalid Kvstore; instance creation should fail
 func TestNewBackend_InvalidKvstore(t *testing.T) {
-	backend := NewBackend(context.Background(), "unknown", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
+	backend := NewBackend("unknown", embedEtcdServerHost+":"+strconv.Itoa(embedEtcdServerPort), defaultTimeout, defaultPathPrefix)
 
 	assert.NotNil(t, backend)
 	assert.Nil(t, backend.Client)
@@ -114,7 +112,7 @@
 
 func TestMakePath(t *testing.T) {
 	backend := provisionBackendWithEmbeddedEtcdServer(t)
-	path := backend.makePath(context.Background(), "Suffix")
+	path := backend.makePath("Suffix")
 	assert.Equal(t, defaultPathPrefix+"/Suffix", path)
 }
 
@@ -140,7 +138,7 @@
 func TestEnableLivenessChannel_EmbeddedEtcdServer_BeforeLivenessCheck(t *testing.T) {
 	backend := provisionBackendWithEmbeddedEtcdServer(t)
 
-	alive := backend.EnableLivenessChannel(context.Background())
+	alive := backend.EnableLivenessChannel()
 	assert.NotNil(t, alive)
 	assert.Equal(t, 1, len(alive))
 	assert.Equal(t, false, <-alive)
@@ -154,7 +152,7 @@
 	defer cancel()
 	backend.PerformLivenessCheck(ctx)
 
-	alive := backend.EnableLivenessChannel(ctx)
+	alive := backend.EnableLivenessChannel()
 	assert.NotNil(t, alive)
 	assert.Equal(t, 1, len(alive))
 	assert.Equal(t, true, <-alive)
@@ -165,14 +163,14 @@
 func TestUpdateLiveness_AliveStatusChange(t *testing.T) {
 	backend := provisionBackendWithEmbeddedEtcdServer(t)
 	// Enable Liveness Channel and verify initial state is not-alive
-	aliveState := backend.EnableLivenessChannel(context.Background())
+	aliveState := backend.EnableLivenessChannel()
 	assert.NotNil(t, aliveState)
 	assert.Equal(t, 1, len(backend.liveness))
 	assert.Equal(t, false, <-backend.liveness)
 	lastUpdateTime := backend.lastLivenessTime
 
 	// Update with changed alive state. Verify alive state push & liveness time update
-	backend.updateLiveness(context.Background(), true)
+	backend.updateLiveness(true)
 	assert.Equal(t, 1, len(backend.liveness))
 	assert.Equal(t, true, <-backend.liveness)
 	assert.NotEqual(t, lastUpdateTime, backend.lastLivenessTime)
@@ -182,13 +180,13 @@
 func TestUpdateLiveness_AliveStatusUnchanged(t *testing.T) {
 	backend := provisionBackendWithEmbeddedEtcdServer(t)
 	// Enable Liveness Channel and verify initial state is not-alive
-	aliveState := backend.EnableLivenessChannel(context.Background())
+	aliveState := backend.EnableLivenessChannel()
 	assert.NotNil(t, aliveState)
 	assert.Equal(t, false, <-backend.liveness)
 	lastUpdateTime := backend.lastLivenessTime
 
 	// Update with same alive state. Verify no further alive state push
-	backend.updateLiveness(context.Background(), false)
+	backend.updateLiveness(false)
 	assert.Equal(t, 0, len(backend.liveness))
 	assert.Equal(t, lastUpdateTime, backend.lastLivenessTime)
 
@@ -197,7 +195,7 @@
 	backend.lastLivenessTime = time.Now().Add(-tenMinDuration)
 	lastUpdateTime = backend.lastLivenessTime
 
-	backend.updateLiveness(context.Background(), false)
+	backend.updateLiveness(false)
 	assert.Equal(t, 1, len(backend.liveness))
 	assert.Equal(t, false, <-backend.liveness)
 	assert.NotEqual(t, lastUpdateTime, backend.lastLivenessTime)
@@ -225,7 +223,7 @@
 
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {
-			if backend.isErrorIndicatingAliveKvstore(context.Background(), tt.arg) != tt.want {
+			if backend.isErrorIndicatingAliveKvstore(tt.arg) != tt.want {
 				t.Errorf("isErrorIndicatingAliveKvstore failed for %s: expected %t but got %t", tt.name, tt.want, !tt.want)
 			}
 		})
@@ -413,7 +411,7 @@
 	time.Sleep(time.Millisecond * 100)
 	assert.Equal(t, 1, len(eventChan))
 
-	backend.DeleteWatch(context.Background(), "key5", eventChan)
+	backend.DeleteWatch("key5", eventChan)
 }
 
 // Test Create and Delete Watch with prefix for Embedded Etcd Server
@@ -434,5 +432,5 @@
 	time.Sleep(time.Millisecond * 100)
 	assert.Equal(t, 1, len(eventChan))
 
-	backend.DeleteWatch(context.Background(), "key6", eventChan)
+	backend.DeleteWatch("key6", eventChan)
 }
