Skip to content

Commit b0c4de2

Browse files
Mpdreamzreakaleek
andauthored
Add Api.IntegrationTests to slnx (#2239)
* Add Api.IntegrationTests to slnx * Fix formatting * Fix naming --------- Co-authored-by: Jan Calanog <[email protected]>
1 parent e99e38f commit b0c4de2

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

docs-builder.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<Folder Name="/tests-integration/">
7878
<File Path="tests-integration/Directory.Build.props" />
7979
<Project Path="tests-integration/Elastic.Assembler.IntegrationTests/Elastic.Assembler.IntegrationTests.csproj" />
80+
<Project Path="tests-integration/Elastic.Documentation.Api.IntegrationTests/Elastic.Documentation.Api.IntegrationTests.csproj" />
8081
</Folder>
8182
<Folder Name="/tests/">
8283
<File Path="tests/Directory.Build.props" />

tests-integration/Elastic.Documentation.Api.IntegrationTests/EuidEnrichmentIntegrationTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public async Task AskAiEndpointPropagatatesEuidToAllSpansAndLogs()
3636
using var request = new HttpRequestMessage(HttpMethod.Post, "/docs/_api/v1/ask-ai/stream");
3737
request.Headers.Add("Cookie", $"euid={expectedEuid}");
3838
request.Content = new StringContent(
39-
"""{"message":"test question","conversationId":null}""",
39+
/*lang=json,strict*/
40+
"""{"message":"test question","conversationId":null}""",
4041
Encoding.UTF8,
4142
"application/json"
4243
);

tests-integration/Elastic.Documentation.Api.IntegrationTests/Fixtures/ApiWebApplicationFactory.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ protected override void ConfigureWebHost(IWebHostBuilder builder) =>
5454
// Mock IAskAiGateway to avoid external AI service calls
5555
var mockAskAiGateway = A.Fake<IAskAiGateway<Stream>>();
5656
A.CallTo(() => mockAskAiGateway.AskAi(A<AskAiRequest>._, A<Cancel>._))
57-
.ReturnsLazily(() => {
57+
.ReturnsLazily(() =>
58+
{
5859
var stream = new MemoryStream(Encoding.UTF8.GetBytes("data: test\n\n"));
59-
MockMemoryStreams.Add(stream);
60+
_mockMemoryStreams.Add(stream);
6061
return Task.FromResult<Stream>(stream);
6162
});
6263
_ = services.AddSingleton(mockAskAiGateway);
@@ -79,11 +80,11 @@ protected override void Dispose(bool disposing)
7980
{
8081
if (disposing)
8182
{
82-
foreach (var stream in MockMemoryStreams)
83+
foreach (var stream in _mockMemoryStreams)
8384
{
8485
stream.Dispose();
8586
}
86-
MockMemoryStreams.Clear();
87+
_mockMemoryStreams.Clear();
8788
}
8889
base.Dispose(disposing);
8990
}

0 commit comments

Comments
 (0)