[VOL-2656] Add unit test for Watch(... withPrefix=True)

Change-Id: I9b40958fd51b7f0df825a528deaf4ea8c456c290
diff --git a/pkg/db/backend_test.go b/pkg/db/backend_test.go
index 8a7e07f..0cceb00 100644
--- a/pkg/db/backend_test.go
+++ b/pkg/db/backend_test.go
@@ -413,3 +413,24 @@
 
 	backend.DeleteWatch("key5", eventChan)
 }
+
+// Test Create and Delete Watch with prefix for Embedded Etcd Server
+func TestCreateWatch_With_Prefix_EmbeddedEtcdServer(t *testing.T) {
+	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+	defer cancel()
+	backend := provisionBackendWithEmbeddedEtcdServer(t)
+	eventChan := backend.CreateWatch(ctx, "key6", true)
+	assert.NotNil(t, eventChan)
+	assert.Equal(t, 0, len(eventChan))
+
+	// Assert this method does not change alive state
+	assert.False(t, backend.alive)
+
+	// Put a value for watched key and event should appear
+	err := backend.Put(ctx, "key6/is-a-prefix", []uint8("value5"))
+	assert.Nil(t, err)
+	time.Sleep(time.Millisecond * 100)
+	assert.Equal(t, 1, len(eventChan))
+
+	backend.DeleteWatch("key6", eventChan)
+}