Skip to content

Commit 47b5d81

Browse files
authored
Exclude Container tests from pipeline (#661)
1 parent c2a15ae commit 47b5d81

File tree

4 files changed

+72
-54
lines changed

4 files changed

+72
-54
lines changed

.github/workflows/live-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Run live tests
3333
run: dotnet test ./tests/OpenAI.Tests.csproj
3434
--configuration Release
35-
--filter="TestCategory!=Smoke&TestCategory!=Assistants&TestCategory!=StoredChat&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=FineTuning&TestCategory!=Conversation&TestCategory!=MCP&TestCategory!=Manual"
35+
--filter="TestCategory!=Smoke&TestCategory!=Assistants&TestCategory!=StoredChat&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=FineTuning&TestCategory!=Containers&TestCategory!=Conversation&TestCategory!=MCP&TestCategory!=Manual"
3636
--logger "trx;LogFilePrefix=live"
3737
--results-directory ${{github.workspace}}/artifacts/test-results
3838
${{ env.version_suffix_args}}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- name: Run Live Tests
5656
run: dotnet test ./tests/OpenAI.Tests.csproj
5757
--configuration Release
58-
--filter="TestCategory!=Smoke&TestCategory!=Assistants&TestCategory!=StoredChat&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=FineTuning&TestCategory!=Conversation&TestCategory!=MCP&TestCategory!=Manual"
58+
--filter="TestCategory!=Smoke&TestCategory!=Assistants&TestCategory!=StoredChat&TestCategory!=Images&TestCategory!=Uploads&TestCategory!=Moderations&TestCategory!=FineTuning&TestCategory!=Containers&TestCategory!=Conversation&TestCategory!=MCP&TestCategory!=Manual"
5959
--logger "trx;LogFilePrefix=live"
6060
--results-directory ${{ github.workspace }}/artifacts/test-results
6161
${{ env.version_suffix_args }}

tests/Responses/ResponsesTests.cs

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -73,58 +73,6 @@ private void Validate<T>(T input) where T : class
7373
}
7474
}
7575

76-
[Test]
77-
public async Task FileSearch()
78-
{
79-
OpenAIFileClient fileClient = GetTestClient<OpenAIFileClient>(TestScenario.Files);
80-
OpenAIFile testFile = await fileClient.UploadFileAsync(
81-
BinaryData.FromString("""
82-
Travis's favorite food is pizza.
83-
"""),
84-
"test_favorite_foods.txt",
85-
FileUploadPurpose.UserData);
86-
Validate(testFile);
87-
88-
VectorStoreClient vscClient = GetTestClient<VectorStoreClient>(TestScenario.VectorStores);
89-
VectorStore vectorStore = await vscClient.CreateVectorStoreAsync(
90-
new VectorStoreCreationOptions()
91-
{
92-
FileIds = { testFile.Id },
93-
});
94-
Validate(vectorStore);
95-
96-
OpenAIResponseClient client = GetTestClient();
97-
98-
OpenAIResponse response = await client.CreateResponseAsync(
99-
"Using the file search tool, what's Travis's favorite food?",
100-
new ResponseCreationOptions()
101-
{
102-
Tools =
103-
{
104-
ResponseTool.CreateFileSearchTool(vectorStoreIds: [vectorStore.Id]),
105-
}
106-
});
107-
Assert.That(response.OutputItems?.Count, Is.EqualTo(2));
108-
FileSearchCallResponseItem fileSearchCall = response.OutputItems[0] as FileSearchCallResponseItem;
109-
Assert.That(fileSearchCall, Is.Not.Null);
110-
Assert.That(fileSearchCall?.Status, Is.EqualTo(FileSearchCallStatus.Completed));
111-
Assert.That(fileSearchCall?.Queries, Has.Count.GreaterThan(0));
112-
MessageResponseItem message = response.OutputItems[1] as MessageResponseItem;
113-
Assert.That(message, Is.Not.Null);
114-
ResponseContentPart messageContentPart = message.Content?.FirstOrDefault();
115-
Assert.That(messageContentPart, Is.Not.Null);
116-
Assert.That(messageContentPart.Text, Does.Contain("pizza"));
117-
Assert.That(messageContentPart.OutputTextAnnotations, Is.Not.Null.And.Not.Empty);
118-
FileCitationMessageAnnotation annotation = messageContentPart.OutputTextAnnotations[0] as FileCitationMessageAnnotation;
119-
Assert.That(annotation.FileId, Is.EqualTo(testFile.Id));
120-
Assert.That(annotation.Index, Is.GreaterThan(0));
121-
122-
await foreach (ResponseItem inputItem in client.GetResponseInputItemsAsync(response.Id))
123-
{
124-
Console.WriteLine(ModelReaderWriter.Write(inputItem).ToString());
125-
}
126-
}
127-
12876
[Test]
12977
public async Task ComputerToolWithScreenshotRoundTrip()
13078
{

tests/Responses/ResponsesToolTests.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using NUnit.Framework;
2+
using OpenAI.Files;
23
using OpenAI.Responses;
34
using OpenAI.Tests.Utility;
5+
using OpenAI.VectorStores;
46
using System;
57
using System.ClientModel;
8+
using System.ClientModel.Primitives;
69
using System.Collections.Generic;
710
using System.Linq;
811
using System.Text;
@@ -335,5 +338,72 @@ public async Task MCPToolWithDisallowedTools()
335338
Assert.That(response.OutputItems.OfType<McpToolCallItem>().ToList(), Has.Count.EqualTo(0));
336339
}
337340

341+
[Test]
342+
public async Task FileSearch()
343+
{
344+
OpenAIFileClient fileClient = GetTestClient<OpenAIFileClient>(TestScenario.Files);
345+
OpenAIFile testFile = await fileClient.UploadFileAsync(
346+
BinaryData.FromString("""
347+
Travis's favorite food is pizza.
348+
"""),
349+
"test_favorite_foods.txt",
350+
FileUploadPurpose.UserData);
351+
Validate(testFile);
352+
353+
VectorStoreClient vscClient = GetTestClient<VectorStoreClient>(TestScenario.VectorStores);
354+
VectorStore vectorStore = await vscClient.CreateVectorStoreAsync(
355+
new VectorStoreCreationOptions()
356+
{
357+
FileIds = { testFile.Id },
358+
});
359+
Validate(vectorStore);
360+
361+
OpenAIResponseClient client = GetTestClient();
362+
363+
OpenAIResponse response = await client.CreateResponseAsync(
364+
"Using the file search tool, what's Travis's favorite food?",
365+
new ResponseCreationOptions()
366+
{
367+
Tools =
368+
{
369+
ResponseTool.CreateFileSearchTool(vectorStoreIds: [vectorStore.Id]),
370+
}
371+
});
372+
Assert.That(response.OutputItems?.Count, Is.EqualTo(2));
373+
FileSearchCallResponseItem fileSearchCall = response.OutputItems[0] as FileSearchCallResponseItem;
374+
Assert.That(fileSearchCall, Is.Not.Null);
375+
Assert.That(fileSearchCall?.Status, Is.EqualTo(FileSearchCallStatus.Completed));
376+
Assert.That(fileSearchCall?.Queries, Has.Count.GreaterThan(0));
377+
MessageResponseItem message = response.OutputItems[1] as MessageResponseItem;
378+
Assert.That(message, Is.Not.Null);
379+
ResponseContentPart messageContentPart = message.Content?.FirstOrDefault();
380+
Assert.That(messageContentPart, Is.Not.Null);
381+
Assert.That(messageContentPart.Text, Does.Contain("pizza"));
382+
Assert.That(messageContentPart.OutputTextAnnotations, Is.Not.Null.And.Not.Empty);
383+
FileCitationMessageAnnotation annotation = messageContentPart.OutputTextAnnotations[0] as FileCitationMessageAnnotation;
384+
Assert.That(annotation.FileId, Is.EqualTo(testFile.Id));
385+
Assert.That(annotation.Index, Is.GreaterThan(0));
386+
387+
await foreach (ResponseItem inputItem in client.GetResponseInputItemsAsync(response.Id))
388+
{
389+
Console.WriteLine(ModelReaderWriter.Write(inputItem).ToString());
390+
}
391+
}
392+
393+
private List<string> FileIdsToDelete = [];
394+
private List<string> VectorStoreIdsToDelete = [];
395+
396+
private void Validate<T>(T input) where T : class
397+
{
398+
if (input is OpenAIFile file)
399+
{
400+
FileIdsToDelete.Add(file.Id);
401+
}
402+
if (input is VectorStore vectorStore)
403+
{
404+
VectorStoreIdsToDelete.Add(vectorStore.Id);
405+
}
406+
}
407+
338408
private static OpenAIResponseClient GetTestClient(string overrideModel = null) => GetTestClient<OpenAIResponseClient>(TestScenario.Responses, overrideModel);
339409
}

0 commit comments

Comments
 (0)