From 40b0f5367b40673bb9e73d6f44c9902c0c7ecdf9 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 20 Nov 2025 09:37:40 +0100 Subject: [PATCH 1/3] Add Api.IntegrationTests to slnx --- docs-builder.slnx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs-builder.slnx b/docs-builder.slnx index 116503ed7..89bab2d9b 100644 --- a/docs-builder.slnx +++ b/docs-builder.slnx @@ -77,6 +77,7 @@ + From 7fe6af76de92f9a511e9f340cbd97ea8c515382e Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 20 Nov 2025 09:44:52 +0100 Subject: [PATCH 2/3] Fix formatting --- .../EuidEnrichmentIntegrationTests.cs | 3 ++- .../Fixtures/ApiWebApplicationFactory.cs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests-integration/Elastic.Documentation.Api.IntegrationTests/EuidEnrichmentIntegrationTests.cs b/tests-integration/Elastic.Documentation.Api.IntegrationTests/EuidEnrichmentIntegrationTests.cs index 1d6b6e757..5ed6e16b8 100644 --- a/tests-integration/Elastic.Documentation.Api.IntegrationTests/EuidEnrichmentIntegrationTests.cs +++ b/tests-integration/Elastic.Documentation.Api.IntegrationTests/EuidEnrichmentIntegrationTests.cs @@ -35,7 +35,8 @@ public async Task AskAiEndpointPropagatatesEuidToAllSpansAndLogs() using var request = new HttpRequestMessage(HttpMethod.Post, "/docs/_api/v1/ask-ai/stream"); request.Headers.Add("Cookie", $"euid={expectedEuid}"); request.Content = new StringContent( - """{"message":"test question","conversationId":null}""", + /*lang=json,strict*/ + """{"message":"test question","conversationId":null}""", Encoding.UTF8, "application/json" ); diff --git a/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs b/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs index 8c9f916aa..59aaa0ce2 100644 --- a/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs +++ b/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs @@ -25,7 +25,7 @@ public class ApiWebApplicationFactory : WebApplicationFactory { public List ExportedActivities { get; } = []; public List LogEntries { get; } = []; - private readonly List MockMemoryStreams = new(); + private readonly List MockMemoryStreams = []; protected override void ConfigureWebHost(IWebHostBuilder builder) => builder.ConfigureServices(services => { @@ -54,7 +54,8 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) => // Mock IAskAiGateway to avoid external AI service calls var mockAskAiGateway = A.Fake>(); A.CallTo(() => mockAskAiGateway.AskAi(A._, A._)) - .ReturnsLazily(() => { + .ReturnsLazily(() => + { var stream = new MemoryStream(Encoding.UTF8.GetBytes("data: test\n\n")); MockMemoryStreams.Add(stream); return Task.FromResult(stream); From be0166c60aa2b63f2d9c01fb1db037cfd931ef67 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 20 Nov 2025 09:48:45 +0100 Subject: [PATCH 3/3] Fix naming --- .../Fixtures/ApiWebApplicationFactory.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs b/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs index 59aaa0ce2..fc747fc70 100644 --- a/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs +++ b/tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs @@ -25,7 +25,7 @@ public class ApiWebApplicationFactory : WebApplicationFactory { public List ExportedActivities { get; } = []; public List LogEntries { get; } = []; - private readonly List MockMemoryStreams = []; + private readonly List _mockMemoryStreams = []; protected override void ConfigureWebHost(IWebHostBuilder builder) => builder.ConfigureServices(services => { @@ -57,7 +57,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) => .ReturnsLazily(() => { var stream = new MemoryStream(Encoding.UTF8.GetBytes("data: test\n\n")); - MockMemoryStreams.Add(stream); + _mockMemoryStreams.Add(stream); return Task.FromResult(stream); }); _ = services.AddSingleton(mockAskAiGateway); @@ -80,11 +80,11 @@ protected override void Dispose(bool disposing) { if (disposing) { - foreach (var stream in MockMemoryStreams) + foreach (var stream in _mockMemoryStreams) { stream.Dispose(); } - MockMemoryStreams.Clear(); + _mockMemoryStreams.Clear(); } base.Dispose(disposing); }