diff --git a/pkg/kafka/endpoint_manager_test.go b/pkg/kafka/endpoint_manager_test.go
index 3790221..a42cc2e 100644
--- a/pkg/kafka/endpoint_manager_test.go
+++ b/pkg/kafka/endpoint_manager_test.go
@@ -42,6 +42,7 @@
 }
 
 func newEPTest(minReplicas, maxReplicas int) *EPTest {
+	ctx := context.Background()
 	test := &EPTest{
 		minReplicas: minReplicas,
 		maxReplicas: maxReplicas,
@@ -49,17 +50,18 @@
 
 	// Create backend
 	if err := test.initBackend(); err != nil {
-		logger.Fatalw("setting-backend-failed", log.Fields{"error": err})
+		logger.Fatalw(ctx, "setting-backend-failed", log.Fields{"error": err})
 	}
 
 	// Populate backend with data
 	if err := test.populateBackend(); err != nil {
-		logger.Fatalw("populating-db-failed", log.Fields{"error": err})
+		logger.Fatalw(ctx, "populating-db-failed", log.Fields{"error": err})
 	}
 	return test
 }
 
 func (ep *EPTest) initBackend() error {
+	ctx := context.Background()
 	configName := "voltha-lib.kafka.ep.test"
 	storageDir := "voltha-lib.kafka.ep.etcd"
 	logLevel := "error"
@@ -73,18 +75,18 @@
 	if err != nil {
 		return err
 	}
-	ep.etcdServer = etcd.StartEtcdServer(etcd.MKConfig(configName, kvClientPort, peerPort, storageDir, logLevel))
+	ep.etcdServer = etcd.StartEtcdServer(ctx, etcd.MKConfig(ctx, configName, kvClientPort, peerPort, storageDir, logLevel))
 	if ep.etcdServer == nil {
 		return status.Error(codes.Internal, "Embedded server failed to start")
 	}
 
-	ep.backend = db.NewBackend("etcd", "127.0.0.1"+":"+strconv.Itoa(kvClientPort), timeout, "service/voltha")
+	ep.backend = db.NewBackend(ctx, "etcd", "127.0.0.1"+":"+strconv.Itoa(kvClientPort), timeout, "service/voltha")
 	return nil
 }
 
 func (ep *EPTest) stopAll() {
 	if ep.etcdServer != nil {
-		ep.etcdServer.Stop()
+		ep.etcdServer.Stop(context.Background())
 	}
 }
 
@@ -185,20 +187,21 @@
 }
 
 func (ep *EPTest) testEndpointManagerAPIs(t *testing.T, tm EndpointManager, serviceType string, deviceType string, replicas int) {
+	ctx := context.Background()
 	// Map of device ids to topic
 	deviceIDs := make(map[string]Endpoint)
 	numDevices := 1000
 	total := make([]int, replicas)
 	for i := 0; i < numDevices; i++ {
 		deviceID := uuid.New().String()
-		endpoint, err := tm.GetEndpoint(deviceID, serviceType)
+		endpoint, err := tm.GetEndpoint(ctx, deviceID, serviceType)
 		if err != nil {
-			logger.Fatalw("error-getting-endpoint", log.Fields{"error": err})
+			logger.Fatalw(ctx, "error-getting-endpoint", log.Fields{"error": err})
 		}
 		deviceIDs[deviceID] = endpoint
-		replicaID, err := tm.GetReplicaAssignment(deviceID, serviceType)
+		replicaID, err := tm.GetReplicaAssignment(ctx, deviceID, serviceType)
 		if err != nil {
-			logger.Fatalw("error-getting-endpoint", log.Fields{"error": err})
+			logger.Fatalw(ctx, "error-getting-endpoint", log.Fields{"error": err})
 		}
 		total[replicaID] += 1
 	}
@@ -210,9 +213,9 @@
 	numIterations := 10
 	for i := 0; i < numIterations; i++ {
 		for deviceID, expectedEndpoint := range deviceIDs {
-			endpointByServiceType, err := tm.GetEndpoint(deviceID, serviceType)
+			endpointByServiceType, err := tm.GetEndpoint(ctx, deviceID, serviceType)
 			if err != nil {
-				logger.Fatalw("error-getting-endpoint", log.Fields{"error": err})
+				logger.Fatalw(ctx, "error-getting-endpoint", log.Fields{"error": err})
 			}
 			assert.Equal(t, expectedEndpoint, endpointByServiceType)
 		}
@@ -220,14 +223,14 @@
 
 	// Verify that a device belong to the correct node
 	for deviceID := range deviceIDs {
-		replicaID, err := tm.GetReplicaAssignment(deviceID, serviceType)
+		replicaID, err := tm.GetReplicaAssignment(ctx, deviceID, serviceType)
 		if err != nil {
-			logger.Fatalw("error-getting-topic", log.Fields{"error": err})
+			logger.Fatalw(ctx, "error-getting-topic", log.Fields{"error": err})
 		}
 		for k := 0; k < replicas; k++ {
-			owned, err := tm.IsDeviceOwnedByService(deviceID, serviceType, int32(k))
+			owned, err := tm.IsDeviceOwnedByService(ctx, deviceID, serviceType, int32(k))
 			if err != nil {
-				logger.Fatalw("error-verifying-device-ownership", log.Fields{"error": err})
+				logger.Fatalw(ctx, "error-verifying-device-ownership", log.Fields{"error": err})
 			}
 			assert.Equal(t, ReplicaID(k) == replicaID, owned)
 		}
