From 8fccbea9867e7d185ad46eccd7d3d2c0f5d14225 Mon Sep 17 00:00:00 2001
From: Anantha Krishna Bhatta <31894175+akbhatta@users.noreply.github.com>
Date: Fri, 17 Sep 2021 11:34:55 -0700
Subject: [PATCH] Removed tenant information from the models (#73)

* Removed tenant information from the models

[Tests]
Updated unit tests

Signed-off-by: @akbhatta

* Updated OpenSearch branch to 1.1

Signed-off-by: @akbhatta
---
 .github/workflows/ci.yml                      |  2 +-
 .../notifications/NotificationConstants.kt    |  1 -
 .../action/GetFeatureChannelListRequest.kt    |  3 -
 .../model/NotificationConfigInfo.kt           |  9 ---
 .../model/NotificationEventInfo.kt            |  9 ---
 .../NotificationsPluginInterfaceTests.kt      |  2 -
 .../GetNotificationConfigResponseTests.kt     | 13 +---
 .../GetNotificationEventResponseTests.kt      | 15 +----
 .../model/NotificationConfigInfoTests.kt      | 50 +-------------
 .../NotificationConfigSearchResultsTests.kt   | 15 +----
 .../model/NotificationEventInfoTests.kt       | 67 +------------------
 .../NotificationEventSearchResultTests.kt     | 19 +-----
 12 files changed, 7 insertions(+), 198 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 53c3d9b6..8f83153e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,7 +31,7 @@ jobs:
         with:
           repository: 'opensearch-project/OpenSearch'
           path: OpenSearch
-          ref: '1.x'
+          ref: '1.1'
       - name: Build OpenSearch
         working-directory: ./OpenSearch
         run: ./gradlew publishToMavenLocal
diff --git a/src/main/kotlin/org/opensearch/commons/notifications/NotificationConstants.kt b/src/main/kotlin/org/opensearch/commons/notifications/NotificationConstants.kt
index 55dc9a44..dc16a39f 100644
--- a/src/main/kotlin/org/opensearch/commons/notifications/NotificationConstants.kt
+++ b/src/main/kotlin/org/opensearch/commons/notifications/NotificationConstants.kt
@@ -51,7 +51,6 @@ object NotificationConstants {
     const val FROM_ADDRESS_TAG = "from_address"
     const val UPDATED_TIME_TAG = "last_updated_time_ms"
     const val CREATED_TIME_TAG = "created_time_ms"
-    const val TENANT_TAG = "tenant"
     const val CONFIG_LIST_TAG = "config_list"
     const val EVENT_LIST_TAG = "event_list"
     const val FEATURE_CONFIG_LIST_TAG = "feature_channel_list"
diff --git a/src/main/kotlin/org/opensearch/commons/notifications/action/GetFeatureChannelListRequest.kt b/src/main/kotlin/org/opensearch/commons/notifications/action/GetFeatureChannelListRequest.kt
index 309a31bc..ba6e3b19 100644
--- a/src/main/kotlin/org/opensearch/commons/notifications/action/GetFeatureChannelListRequest.kt
+++ b/src/main/kotlin/org/opensearch/commons/notifications/action/GetFeatureChannelListRequest.kt
@@ -42,9 +42,6 @@ import java.io.IOException
 
 /**
  * This request is plugin-only call. i.e. REST interface is not exposed.
- * Also the library will remove the user context while making this call
- * so that user making this call need not have to set permission to this API.
- * Hence the request also contains tenant info for space isolation.
  */
 class GetFeatureChannelListRequest : ActionRequest, ToXContentObject {
     val feature: String
diff --git a/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfo.kt b/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfo.kt
index 7a949bbb..3c17a28c 100644
--- a/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfo.kt
+++ b/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfo.kt
@@ -37,7 +37,6 @@ import org.opensearch.common.xcontent.XContentParserUtils
 import org.opensearch.commons.notifications.NotificationConstants.CONFIG_ID_TAG
 import org.opensearch.commons.notifications.NotificationConstants.CONFIG_TAG
 import org.opensearch.commons.notifications.NotificationConstants.CREATED_TIME_TAG
-import org.opensearch.commons.notifications.NotificationConstants.TENANT_TAG
 import org.opensearch.commons.notifications.NotificationConstants.UPDATED_TIME_TAG
 import org.opensearch.commons.utils.logger
 import java.io.IOException
@@ -50,7 +49,6 @@ data class NotificationConfigInfo(
     val configId: String,
     val lastUpdatedTime: Instant,
     val createdTime: Instant,
-    val tenant: String,
     val notificationConfig: NotificationConfig
 ) : BaseModel {
 
@@ -76,7 +74,6 @@ data class NotificationConfigInfo(
             var configId: String? = null
             var lastUpdatedTime: Instant? = null
             var createdTime: Instant? = null
-            var tenant: String? = null
             var notificationConfig: NotificationConfig? = null
 
             XContentParserUtils.ensureExpectedToken(
@@ -91,7 +88,6 @@ data class NotificationConfigInfo(
                     CONFIG_ID_TAG -> configId = parser.text()
                     UPDATED_TIME_TAG -> lastUpdatedTime = Instant.ofEpochMilli(parser.longValue())
                     CREATED_TIME_TAG -> createdTime = Instant.ofEpochMilli(parser.longValue())
-                    TENANT_TAG -> tenant = parser.text()
                     CONFIG_TAG -> notificationConfig = NotificationConfig.parse(parser)
                     else -> {
                         parser.skipChildren()
@@ -102,13 +98,11 @@ data class NotificationConfigInfo(
             configId ?: throw IllegalArgumentException("$CONFIG_ID_TAG field absent")
             lastUpdatedTime ?: throw IllegalArgumentException("$UPDATED_TIME_TAG field absent")
             createdTime ?: throw IllegalArgumentException("$CREATED_TIME_TAG field absent")
-            tenant = tenant ?: ""
             notificationConfig ?: throw IllegalArgumentException("$CONFIG_TAG field absent")
             return NotificationConfigInfo(
                 configId,
                 lastUpdatedTime,
                 createdTime,
-                tenant,
                 notificationConfig
             )
         }
@@ -122,7 +116,6 @@ data class NotificationConfigInfo(
         configId = input.readString(),
         lastUpdatedTime = input.readInstant(),
         createdTime = input.readInstant(),
-        tenant = input.readString(),
         notificationConfig = NotificationConfig.reader.read(input)
     )
 
@@ -133,7 +126,6 @@ data class NotificationConfigInfo(
         output.writeString(configId)
         output.writeInstant(lastUpdatedTime)
         output.writeInstant(createdTime)
-        output.writeString(tenant)
         notificationConfig.writeTo(output)
     }
 
@@ -146,7 +138,6 @@ data class NotificationConfigInfo(
             .field(CONFIG_ID_TAG, configId)
             .field(UPDATED_TIME_TAG, lastUpdatedTime.toEpochMilli())
             .field(CREATED_TIME_TAG, createdTime.toEpochMilli())
-            .field(TENANT_TAG, tenant)
             .field(CONFIG_TAG, notificationConfig)
             .endObject()
     }
diff --git a/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfo.kt b/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfo.kt
index 27f9d0ad..3e4ff552 100644
--- a/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfo.kt
+++ b/src/main/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfo.kt
@@ -37,7 +37,6 @@ import org.opensearch.common.xcontent.XContentParserUtils
 import org.opensearch.commons.notifications.NotificationConstants.CREATED_TIME_TAG
 import org.opensearch.commons.notifications.NotificationConstants.EVENT_ID_TAG
 import org.opensearch.commons.notifications.NotificationConstants.EVENT_TAG
-import org.opensearch.commons.notifications.NotificationConstants.TENANT_TAG
 import org.opensearch.commons.notifications.NotificationConstants.UPDATED_TIME_TAG
 import org.opensearch.commons.utils.logger
 import java.io.IOException
@@ -50,7 +49,6 @@ data class NotificationEventInfo(
     val eventId: String,
     val lastUpdatedTime: Instant,
     val createdTime: Instant,
-    val tenant: String,
     val notificationEvent: NotificationEvent
 ) : BaseModel {
 
@@ -76,7 +74,6 @@ data class NotificationEventInfo(
             var eventId: String? = null
             var lastUpdatedTime: Instant? = null
             var createdTime: Instant? = null
-            var tenant: String? = null
             var notificationEvent: NotificationEvent? = null
 
             XContentParserUtils.ensureExpectedToken(
@@ -91,7 +88,6 @@ data class NotificationEventInfo(
                     EVENT_ID_TAG -> eventId = parser.text()
                     UPDATED_TIME_TAG -> lastUpdatedTime = Instant.ofEpochMilli(parser.longValue())
                     CREATED_TIME_TAG -> createdTime = Instant.ofEpochMilli(parser.longValue())
-                    TENANT_TAG -> tenant = parser.text()
                     EVENT_TAG -> notificationEvent = NotificationEvent.parse(parser)
                     else -> {
                         parser.skipChildren()
@@ -102,13 +98,11 @@ data class NotificationEventInfo(
             eventId ?: throw IllegalArgumentException("$EVENT_ID_TAG field absent")
             lastUpdatedTime ?: throw IllegalArgumentException("$UPDATED_TIME_TAG field absent")
             createdTime ?: throw IllegalArgumentException("$CREATED_TIME_TAG field absent")
-            tenant = tenant ?: ""
             notificationEvent ?: throw IllegalArgumentException("$EVENT_TAG field absent")
             return NotificationEventInfo(
                 eventId,
                 lastUpdatedTime,
                 createdTime,
-                tenant,
                 notificationEvent
             )
         }
@@ -123,7 +117,6 @@ data class NotificationEventInfo(
             .field(EVENT_ID_TAG, eventId)
             .field(UPDATED_TIME_TAG, lastUpdatedTime.toEpochMilli())
             .field(CREATED_TIME_TAG, createdTime.toEpochMilli())
-            .field(TENANT_TAG, tenant)
             .field(EVENT_TAG, notificationEvent)
             .endObject()
     }
@@ -136,7 +129,6 @@ data class NotificationEventInfo(
         eventId = input.readString(),
         lastUpdatedTime = input.readInstant(),
         createdTime = input.readInstant(),
-        tenant = input.readString(),
         notificationEvent = NotificationEvent.reader.read(input)
     )
 
@@ -147,7 +139,6 @@ data class NotificationEventInfo(
         output.writeString(eventId)
         output.writeInstant(lastUpdatedTime)
         output.writeInstant(createdTime)
-        output.writeString(tenant)
         notificationEvent.writeTo(output)
     }
 }
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterfaceTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterfaceTests.kt
index 343fecbd..77d12ff2 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterfaceTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/NotificationsPluginInterfaceTests.kt
@@ -260,7 +260,6 @@ internal class NotificationsPluginInterfaceTests {
             "config_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig
         )
         return GetNotificationConfigResponse(NotificationConfigSearchResult(configInfo))
@@ -284,7 +283,6 @@ internal class NotificationsPluginInterfaceTests {
             "event_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleEvent
         )
         return GetNotificationEventResponse(NotificationEventSearchResult(eventInfo))
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationConfigResponseTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationConfigResponseTests.kt
index 2ec08913..8cc66d80 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationConfigResponseTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationConfigResponseTests.kt
@@ -70,7 +70,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -92,7 +91,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig1
         )
         val sampleConfig2 = NotificationConfig(
@@ -106,7 +104,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig2
         )
         val searchResult = NotificationConfigSearchResult(
@@ -136,7 +133,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -161,7 +157,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id1",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig1
         )
         val sampleConfig2 = NotificationConfig(
@@ -175,7 +170,6 @@ internal class GetNotificationConfigResponseTests {
             "config_id2",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig2
         )
         val searchResult = NotificationConfigSearchResult(
@@ -207,7 +201,6 @@ internal class GetNotificationConfigResponseTests {
             "config-Id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -221,7 +214,6 @@ internal class GetNotificationConfigResponseTests {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "config":{
                         "name":"name",
                         "description":"description",
@@ -258,7 +250,6 @@ internal class GetNotificationConfigResponseTests {
             "config-Id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -269,7 +260,6 @@ internal class GetNotificationConfigResponseTests {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "config":{
                         "name":"name",
                         "description":"description",
@@ -299,8 +289,7 @@ internal class GetNotificationConfigResponseTests {
                 {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-                    "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant"
+                    "created_time_ms":"${createdTimeMs.toEpochMilli()}"
                 }
             ]
         }
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationEventResponseTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationEventResponseTests.kt
index 1895d1d3..be6af960 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationEventResponseTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/action/GetNotificationEventResponseTests.kt
@@ -77,7 +77,6 @@ internal class GetNotificationEventResponseTests {
             "event_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -116,28 +115,24 @@ internal class GetNotificationEventResponseTests {
             "event_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1))
         )
         val eventInfo2 = NotificationEventInfo(
             "event_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status2))
         )
         val eventInfo3 = NotificationEventInfo(
             "event_id3",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1, status2))
         )
         val eventInfo4 = NotificationEventInfo(
             "event_id4",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status1, status2))
         )
         val searchResult = NotificationEventSearchResult(
@@ -172,7 +167,6 @@ internal class GetNotificationEventResponseTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -214,14 +208,12 @@ internal class GetNotificationEventResponseTests {
             "event_id1",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1))
         )
         val eventInfo2 = NotificationEventInfo(
             "event_id2",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             NotificationEvent(eventSource2, listOf(status2))
         )
         val searchResult = NotificationEventSearchResult(
@@ -257,7 +249,6 @@ internal class GetNotificationEventResponseTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -271,7 +262,6 @@ internal class GetNotificationEventResponseTests {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "event":{
                         "event_source":{
                             "title":"title",
@@ -325,7 +315,6 @@ internal class GetNotificationEventResponseTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -336,7 +325,6 @@ internal class GetNotificationEventResponseTests {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "event":{
                         "event_source":{
                             "title":"title",
@@ -379,8 +367,7 @@ internal class GetNotificationEventResponseTests {
                 {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-                    "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant"
+                    "created_time_ms":"${createdTimeMs.toEpochMilli()}"
                 }
             ]
         }
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfoTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfoTests.kt
index 409decd7..6f532fb0 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfoTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigInfoTests.kt
@@ -52,7 +52,6 @@ internal class NotificationConfigInfoTests {
             "config_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig
         )
         val recreatedObject = recreateObject(configInfo) { NotificationConfigInfo(it) }
@@ -75,7 +74,6 @@ internal class NotificationConfigInfoTests {
             "config_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig
         )
         val jsonString = getJsonString(configInfo)
@@ -83,45 +81,6 @@ internal class NotificationConfigInfoTests {
         assertEquals(configInfo, recreatedObject)
     }
 
-    @Test
-    fun `Config info should take default tenant when field is absent in json object`() {
-        val lastUpdatedTimeMs = Instant.ofEpochMilli(Instant.now().toEpochMilli())
-        val createdTimeMs = lastUpdatedTimeMs.minusSeconds(1000)
-        val sampleSlack = Slack("https://domain.com/sample_slack_url#1234567890")
-        val sampleConfig = NotificationConfig(
-            "name",
-            "description",
-            ConfigType.SLACK,
-            setOf(FEATURE_INDEX_MANAGEMENT),
-            isEnabled = true,
-            configData = sampleSlack
-        )
-        val configInfo = NotificationConfigInfo(
-            "config-Id",
-            lastUpdatedTimeMs,
-            createdTimeMs,
-            "", // Default tenant
-            sampleConfig
-        )
-        val jsonString = """
-        {
-            "config_id":"config-Id",
-            "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "config":{
-                "name":"name",
-                "description":"description",
-                "config_type":"slack",
-                "feature_list":["index_management"],
-                "is_enabled":true,
-                "slack":{"url":"https://domain.com/sample_slack_url#1234567890"}
-            }
-        }
-        """.trimIndent()
-        val recreatedObject = createObjectFromJsonString(jsonString) { NotificationConfigInfo.parse(it) }
-        assertEquals(configInfo, recreatedObject)
-    }
-
     @Test
     fun `Config info should safely ignore extra field in json object`() {
         val lastUpdatedTimeMs = Instant.ofEpochMilli(Instant.now().toEpochMilli())
@@ -139,7 +98,6 @@ internal class NotificationConfigInfoTests {
             "config-Id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleConfig
         )
         val jsonString = """
@@ -147,7 +105,6 @@ internal class NotificationConfigInfoTests {
             "config_id":"config-Id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
             "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "config":{
                 "name":"name",
                 "description":"description",
@@ -180,7 +137,6 @@ internal class NotificationConfigInfoTests {
                 "",
                 Instant.now(),
                 Instant.now(),
-                "tenant",
                 sampleConfig
             )
         }
@@ -194,7 +150,6 @@ internal class NotificationConfigInfoTests {
         {
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
             "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "config":{
                 "name":"name",
                 "description":"description",
@@ -218,7 +173,6 @@ internal class NotificationConfigInfoTests {
         {
             "config_id":"config-Id",
             "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "config":{
                 "name":"name",
                 "description":"description",
@@ -241,7 +195,6 @@ internal class NotificationConfigInfoTests {
         {
             "config_id":"config-Id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "config":{
                 "name":"name",
                 "description":"description",
@@ -265,8 +218,7 @@ internal class NotificationConfigInfoTests {
         {
             "config_id":"config-Id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant"
+            "created_time_ms":"${createdTimeMs.toEpochMilli()}"
         }
         """.trimIndent()
         Assertions.assertThrows(IllegalArgumentException::class.java) {
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigSearchResultsTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigSearchResultsTests.kt
index 6a10935f..dab33090 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigSearchResultsTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationConfigSearchResultsTests.kt
@@ -64,7 +64,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -85,7 +84,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig1
         )
         val sampleConfig2 = NotificationConfig(
@@ -99,7 +97,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig2
         )
         val searchResult = NotificationConfigSearchResult(listOf(configInfo1, configInfo2))
@@ -126,7 +123,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig1
         )
         val sampleConfig2 = NotificationConfig(
@@ -140,7 +136,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleConfig2
         )
         val searchResult = NotificationConfigSearchResult(
@@ -169,7 +164,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -193,7 +187,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id1",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig1
         )
         val sampleConfig2 = NotificationConfig(
@@ -207,7 +200,6 @@ internal class NotificationConfigSearchResultsTests {
             "config_id2",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleConfig2
         )
         val searchResult = NotificationConfigSearchResult(
@@ -238,7 +230,6 @@ internal class NotificationConfigSearchResultsTests {
             "config-Id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -252,7 +243,6 @@ internal class NotificationConfigSearchResultsTests {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "config":{
                         "name":"name",
                         "description":"description",
@@ -289,7 +279,6 @@ internal class NotificationConfigSearchResultsTests {
             "config-Id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleConfig
         )
         val searchResult = NotificationConfigSearchResult(configInfo)
@@ -300,7 +289,6 @@ internal class NotificationConfigSearchResultsTests {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "config":{
                         "name":"name",
                         "description":"description",
@@ -330,8 +318,7 @@ internal class NotificationConfigSearchResultsTests {
                 {
                     "config_id":"config-Id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-                    "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant"
+                    "created_time_ms":"${createdTimeMs.toEpochMilli()}"
                 }
             ]
         }
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfoTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfoTests.kt
index 9f45fbb0..3937c252 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfoTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventInfoTests.kt
@@ -56,7 +56,6 @@ internal class NotificationEventInfoTests {
             "event_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleEvent
         )
         val recreatedObject = recreateObject(eventInfo) { NotificationEventInfo(it) }
@@ -84,7 +83,6 @@ internal class NotificationEventInfoTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleEvent
         )
         val jsonString = getJsonString(eventInfo)
@@ -92,63 +90,6 @@ internal class NotificationEventInfoTests {
         assertEquals(eventInfo, recreatedObject)
     }
 
-    @Test
-    fun `Event info should take default tenant when field is absent in json object`() {
-        val lastUpdatedTimeMs = Instant.ofEpochMilli(Instant.now().toEpochMilli())
-        val createdTimeMs = lastUpdatedTimeMs.minusSeconds(1000)
-        val sampleEventSource = EventSource(
-            "title",
-            "reference_id",
-            FEATURE_ALERTING,
-            severity = SeverityType.INFO
-        )
-        val sampleStatus = EventStatus(
-            "config_id",
-            "name",
-            ConfigType.SLACK,
-            deliveryStatus = DeliveryStatus("200", "success")
-        )
-        val sampleEvent = NotificationEvent(sampleEventSource, listOf(sampleStatus))
-        val eventInfo = NotificationEventInfo(
-            "event_id",
-            lastUpdatedTimeMs,
-            createdTimeMs,
-            "tenant",
-            sampleEvent
-        )
-        val jsonString = """
-        {
-            "event_id":"event_id",
-            "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"tenant",
-            "event":{
-                "event_source":{
-                    "title":"title",
-                    "reference_id":"reference_id",
-                    "feature":"alerting",
-                    "severity":"info",
-                    "tags":[]
-                },
-                "status_list":[
-                    {
-                       "config_id":"config_id",
-                       "config_type":"slack",
-                       "config_name":"name",
-                       "delivery_status":
-                       {
-                            "status_code":"200",
-                            "status_text":"success"
-                       }
-                    }
-                ]
-            }
-        }
-        """.trimIndent()
-        val recreatedObject = createObjectFromJsonString(jsonString) { NotificationEventInfo.parse(it) }
-        assertEquals(eventInfo, recreatedObject)
-    }
-
     @Test
     fun `Event info should safely ignore extra field in json object`() {
         val lastUpdatedTimeMs = Instant.ofEpochMilli(Instant.now().toEpochMilli())
@@ -170,7 +111,6 @@ internal class NotificationEventInfoTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleEvent
         )
         val jsonString = """
@@ -178,7 +118,6 @@ internal class NotificationEventInfoTests {
             "event_id":"event_id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
             "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"tenant",
             "event":{
                 "event_source":{
                     "title":"title",
@@ -231,7 +170,6 @@ internal class NotificationEventInfoTests {
                 "",
                 lastUpdatedTimeMs,
                 createdTimeMs,
-                "tenant",
                 sampleEvent
             )
         }
@@ -281,7 +219,6 @@ internal class NotificationEventInfoTests {
         {
             "event_id":"event_id",
             "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "event":{
                 "event_source":{
                     "title":"title",
@@ -317,7 +254,6 @@ internal class NotificationEventInfoTests {
         {
             "event_id":"event_id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant",
             "event":{
                 "event_source":{
                     "title":"title",
@@ -354,8 +290,7 @@ internal class NotificationEventInfoTests {
         {
             "event_id":"event_id",
             "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-            "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-            "tenant":"selectedTenant"
+            "created_time_ms":"${createdTimeMs.toEpochMilli()}"
         }
         """.trimIndent()
         Assertions.assertThrows(IllegalArgumentException::class.java) {
diff --git a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventSearchResultTests.kt b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventSearchResultTests.kt
index 078d4910..c0e9786d 100644
--- a/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventSearchResultTests.kt
+++ b/src/test/kotlin/org/opensearch/commons/notifications/model/NotificationEventSearchResultTests.kt
@@ -69,7 +69,6 @@ internal class NotificationEventSearchResultTests {
             "event_id",
             Instant.now(),
             Instant.now(),
-            "tenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -107,28 +106,24 @@ internal class NotificationEventSearchResultTests {
             "event_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1))
         )
         val eventInfo2 = NotificationEventInfo(
             "event_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status2))
         )
         val eventInfo3 = NotificationEventInfo(
             "event_id3",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1, status2))
         )
         val eventInfo4 = NotificationEventInfo(
             "event_id4",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status1, status2))
         )
         val searchResult = NotificationEventSearchResult(
@@ -174,28 +169,24 @@ internal class NotificationEventSearchResultTests {
             "event_id1",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1))
         )
         val eventInfo2 = NotificationEventInfo(
             "event_id2",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status2))
         )
         val eventInfo3 = NotificationEventInfo(
             "event_id3",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1, status2))
         )
         val eventInfo4 = NotificationEventInfo(
             "event_id4",
             Instant.now(),
             Instant.now(),
-            "tenant",
             NotificationEvent(eventSource2, listOf(status1, status2))
         )
         val searchResult = NotificationEventSearchResult(
@@ -229,7 +220,6 @@ internal class NotificationEventSearchResultTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -270,14 +260,12 @@ internal class NotificationEventSearchResultTests {
             "event_id1",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             NotificationEvent(eventSource1, listOf(status1))
         )
         val eventInfo2 = NotificationEventInfo(
             "event_id2",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "tenant",
             NotificationEvent(eventSource2, listOf(status2))
         )
         val searchResult = NotificationEventSearchResult(
@@ -312,7 +300,6 @@ internal class NotificationEventSearchResultTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -326,7 +313,6 @@ internal class NotificationEventSearchResultTests {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "event":{
                         "event_source":{
                             "title":"title",
@@ -380,7 +366,6 @@ internal class NotificationEventSearchResultTests {
             "event_id",
             lastUpdatedTimeMs,
             createdTimeMs,
-            "selectedTenant",
             sampleEvent
         )
         val searchResult = NotificationEventSearchResult(eventInfo)
@@ -391,7 +376,6 @@ internal class NotificationEventSearchResultTests {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
                     "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant",
                     "event":{
                         "event_source":{
                             "title":"title",
@@ -434,8 +418,7 @@ internal class NotificationEventSearchResultTests {
                 {
                     "event_id":"event_id",
                     "last_updated_time_ms":"${lastUpdatedTimeMs.toEpochMilli()}",
-                    "created_time_ms":"${createdTimeMs.toEpochMilli()}",
-                    "tenant":"selectedTenant"
+                    "created_time_ms":"${createdTimeMs.toEpochMilli()}"
                 }
             ]
         }