From acfb578e15e91773a709581d12105aea4f78178e Mon Sep 17 00:00:00 2001 From: Julien Buret Date: Wed, 9 Oct 2024 20:52:50 +0200 Subject: [PATCH] fix unit tests --- bot/admin/server/src/test/kotlin/AbstractTest.kt | 4 ++++ .../src/test/kotlin/service/RAGValidationServiceTest.kt | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bot/admin/server/src/test/kotlin/AbstractTest.kt b/bot/admin/server/src/test/kotlin/AbstractTest.kt index d792b6e38b..546a19f866 100644 --- a/bot/admin/server/src/test/kotlin/AbstractTest.kt +++ b/bot/admin/server/src/test/kotlin/AbstractTest.kt @@ -19,6 +19,7 @@ package ai.tock.bot.admin import ai.tock.bot.admin.answer.AnswerConfigurationType import ai.tock.bot.admin.bot.BotApplicationConfiguration import ai.tock.bot.admin.bot.BotApplicationConfigurationDAO +import ai.tock.bot.admin.bot.vectorstore.BotVectorStoreConfigurationDAO import ai.tock.bot.admin.dialog.DialogReportDAO import ai.tock.bot.admin.model.BotStoryDefinitionConfiguration import ai.tock.bot.admin.story.StoryDefinitionConfiguration @@ -27,6 +28,7 @@ import ai.tock.bot.admin.user.UserReportDAO import ai.tock.bot.connector.ConnectorType import ai.tock.bot.definition.IntentWithoutNamespace import ai.tock.bot.engine.feature.FeatureDAO +import ai.tock.genai.orchestratorclient.services.VectorStoreProviderService import ai.tock.nlp.front.service.storage.ApplicationDefinitionDAO import ai.tock.nlp.front.shared.ApplicationCodec import ai.tock.nlp.front.shared.ApplicationConfiguration @@ -65,6 +67,8 @@ abstract class AbstractTest { bind() with provider { mockk(relaxed = true) } bind() with provider { mockk(relaxed = true) } bind() with provider { mockk(relaxed = true) } + bind() with provider { mockk(relaxed = true) } + bind() with provider { mockk(relaxed = true) } } return module } diff --git a/bot/admin/server/src/test/kotlin/service/RAGValidationServiceTest.kt b/bot/admin/server/src/test/kotlin/service/RAGValidationServiceTest.kt index 0cb7fae8ea..2c8bb1ffff 100644 --- a/bot/admin/server/src/test/kotlin/service/RAGValidationServiceTest.kt +++ b/bot/admin/server/src/test/kotlin/service/RAGValidationServiceTest.kt @@ -17,18 +17,21 @@ package ai.tock.bot.admin.service import ai.tock.bot.admin.bot.observability.BotObservabilityConfigurationDAO +import ai.tock.bot.admin.bot.vectorstore.BotVectorStoreConfigurationDAO import ai.tock.bot.admin.model.BotRAGConfigurationDTO import ai.tock.genai.orchestratorclient.responses.ErrorInfo import ai.tock.genai.orchestratorclient.responses.ErrorResponse import ai.tock.genai.orchestratorclient.responses.ProviderSettingStatusResponse import ai.tock.genai.orchestratorclient.services.EMProviderService import ai.tock.genai.orchestratorclient.services.LLMProviderService +import ai.tock.genai.orchestratorclient.services.VectorStoreProviderService import ai.tock.genai.orchestratorcore.models.em.AzureOpenAIEMSettingDTO import ai.tock.genai.orchestratorcore.models.llm.OpenAILLMSetting import ai.tock.shared.tockInternalInjector import com.github.salomonbrys.kodein.Kodein import com.github.salomonbrys.kodein.KodeinInjector import com.github.salomonbrys.kodein.bind +import com.github.salomonbrys.kodein.provider import com.github.salomonbrys.kodein.singleton import io.mockk.every import io.mockk.mockk @@ -45,6 +48,8 @@ class RAGValidationServiceTest { bind() with singleton { llmProviderService } bind() with singleton { emProviderService } bind() with singleton { botObservabilityConfigurationDAO } + bind() with provider { mockk(relaxed = true) } + bind() with provider { mockk(relaxed = true) } }.also { tockInternalInjector.inject(Kodein { import(it) @@ -144,7 +149,7 @@ class RAGValidationServiceTest { // WHEN : // Launch of validation val errors = RAGValidationService.validate( - ragConfiguration.copy(enabled = false, indexSessionId = null).toBotRAGConfiguration() + ragConfiguration.copy(enabled = false, indexSessionId = "sessionId").toBotRAGConfiguration() ) // THEN :