From 35a3975f4ee65c2126b97c374663e31a2b0ca5df Mon Sep 17 00:00:00 2001 From: westey <164392973+westey-m@users.noreply.github.com> Date: Wed, 7 Aug 2024 13:57:05 +0100 Subject: [PATCH] .Net: Disable redis integration tests since they are intermittently failing on ubuntu (#7955) ### Motivation and Context The idea is to run integration tests as part of the merge pipeline for database connectors using docker containers where possible. This is working well in the build server for redis on windows, but failing intermittently with connection errors on ubuntu. ### Description Disabling these tests as part of the build run for now, to avoid blocking the merge queue. ### Contribution Checklist - [ ] The code builds clean without any errors or warnings - [ ] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [ ] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone :smile: --- ...HashSetVectorStoreRecordCollectionTests.cs | 25 +++++++++-------- ...disJsonVectorStoreRecordCollectionTests.cs | 27 ++++++++++--------- .../Memory/Redis/RedisVectorStoreTests.cs | 5 +++- 3 files changed, 33 insertions(+), 24 deletions(-) diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs index b80d85551e6d..6c980693c4bc 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisHashSetVectorStoreRecordCollectionTests.cs @@ -22,9 +22,12 @@ namespace SemanticKernel.IntegrationTests.Connectors.Memory.Redis; [Collection("RedisVectorStoreCollection")] public sealed class RedisHashSetVectorStoreRecordCollectionTests(ITestOutputHelper output, RedisVectorStoreFixture fixture) { + // If null, all tests will be enabled + private const string SkipReason = "Requires Redis docker container up and running"; + private const string TestCollectionName = "hashhotels"; - [Theory] + [Theory(Skip = SkipReason)] [InlineData(TestCollectionName, true)] [InlineData("nonexistentcollection", false)] public async Task CollectionExistsReturnsCollectionStateAsync(string collectionName, bool expectedExists) @@ -39,7 +42,7 @@ public async Task CollectionExistsReturnsCollectionStateAsync(string collectionN Assert.Equal(expectedExists, actual); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanCreateACollectionUpsertAndGetAsync(bool useRecordDefinition) @@ -81,7 +84,7 @@ public async Task ItCanCreateACollectionUpsertAndGetAsync(bool useRecordDefiniti output.WriteLine(getResult?.ToString()); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanDeleteCollectionAsync() { // Arrange @@ -101,7 +104,7 @@ public async Task ItCanDeleteCollectionAsync() Assert.False(await sut.CollectionExistsAsync()); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanUpsertDocumentToVectorStoreAsync(bool useRecordDefinition) @@ -134,7 +137,7 @@ public async Task ItCanUpsertDocumentToVectorStoreAsync(bool useRecordDefinition output.WriteLine(getResult?.ToString()); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanUpsertManyDocumentsToVectorStoreAsync(bool useRecordDefinition) @@ -171,7 +174,7 @@ public async Task ItCanUpsertManyDocumentsToVectorStoreAsync(bool useRecordDefin } } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true, true)] [InlineData(true, false)] [InlineData(false, true)] @@ -209,7 +212,7 @@ public async Task ItCanGetDocumentFromVectorStoreAsync(bool includeVectors, bool output.WriteLine(getResult?.ToString()); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanGetManyDocumentsFromVectorStoreAsync() { // Arrange @@ -232,7 +235,7 @@ public async Task ItCanGetManyDocumentsFromVectorStoreAsync() } } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanRemoveDocumentFromVectorStoreAsync(bool useRecordDefinition) @@ -264,7 +267,7 @@ public async Task ItCanRemoveDocumentFromVectorStoreAsync(bool useRecordDefiniti Assert.Null(await sut.GetAsync("Remove-1")); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanRemoveManyDocumentsFromVectorStoreAsync() { // Arrange @@ -284,7 +287,7 @@ public async Task ItCanRemoveManyDocumentsFromVectorStoreAsync() Assert.Null(await sut.GetAsync("RemoveMany-3", new GetRecordOptions { IncludeVectors = true })); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItReturnsNullWhenGettingNonExistentRecordAsync() { // Arrange @@ -295,7 +298,7 @@ public async Task ItReturnsNullWhenGettingNonExistentRecordAsync() Assert.Null(await sut.GetAsync("BaseSet-5", new GetRecordOptions { IncludeVectors = true })); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItThrowsMappingExceptionForFailedMapperAsync() { // Arrange diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs index 9e7a2fde0561..4fbd7bc5d647 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisJsonVectorStoreRecordCollectionTests.cs @@ -22,9 +22,12 @@ namespace SemanticKernel.IntegrationTests.Connectors.Memory.Redis; [Collection("RedisVectorStoreCollection")] public sealed class RedisJsonVectorStoreRecordCollectionTests(ITestOutputHelper output, RedisVectorStoreFixture fixture) { + // If null, all tests will be enabled + private const string SkipReason = "Requires Redis docker container up and running"; + private const string TestCollectionName = "jsonhotels"; - [Theory] + [Theory(Skip = SkipReason)] [InlineData(TestCollectionName, true)] [InlineData("nonexistentcollection", false)] public async Task CollectionExistsReturnsCollectionStateAsync(string collectionName, bool expectedExists) @@ -39,7 +42,7 @@ public async Task CollectionExistsReturnsCollectionStateAsync(string collectionN Assert.Equal(expectedExists, actual); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanCreateACollectionUpsertAndGetAsync(bool useRecordDefinition) @@ -86,7 +89,7 @@ public async Task ItCanCreateACollectionUpsertAndGetAsync(bool useRecordDefiniti output.WriteLine(getResult?.ToString()); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanDeleteCollectionAsync() { // Arrange @@ -106,7 +109,7 @@ public async Task ItCanDeleteCollectionAsync() Assert.False(await sut.CollectionExistsAsync()); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanUpsertDocumentToVectorStoreAsync(bool useRecordDefinition) @@ -144,7 +147,7 @@ public async Task ItCanUpsertDocumentToVectorStoreAsync(bool useRecordDefinition output.WriteLine(getResult?.ToString()); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanUpsertManyDocumentsToVectorStoreAsync(bool useRecordDefinition) @@ -181,7 +184,7 @@ public async Task ItCanUpsertManyDocumentsToVectorStoreAsync(bool useRecordDefin } } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true, true)] [InlineData(true, false)] [InlineData(false, true)] @@ -223,7 +226,7 @@ public async Task ItCanGetDocumentFromVectorStoreAsync(bool includeVectors, bool output.WriteLine(getResult?.ToString()); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanGetManyDocumentsFromVectorStoreAsync() { // Arrange @@ -246,7 +249,7 @@ public async Task ItCanGetManyDocumentsFromVectorStoreAsync() } } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItFailsToGetDocumentsWithInvalidSchemaAsync() { // Arrange. @@ -257,7 +260,7 @@ public async Task ItFailsToGetDocumentsWithInvalidSchemaAsync() await Assert.ThrowsAsync(async () => await sut.GetAsync("BaseSet-4-Invalid", new GetRecordOptions { IncludeVectors = true })); } - [Theory] + [Theory(Skip = SkipReason)] [InlineData(true)] [InlineData(false)] public async Task ItCanRemoveDocumentFromVectorStoreAsync(bool useRecordDefinition) @@ -290,7 +293,7 @@ public async Task ItCanRemoveDocumentFromVectorStoreAsync(bool useRecordDefiniti Assert.Null(await sut.GetAsync("Remove-1")); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItCanRemoveManyDocumentsFromVectorStoreAsync() { // Arrange @@ -310,7 +313,7 @@ public async Task ItCanRemoveManyDocumentsFromVectorStoreAsync() Assert.Null(await sut.GetAsync("RemoveMany-3", new GetRecordOptions { IncludeVectors = true })); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItReturnsNullWhenGettingNonExistentRecordAsync() { // Arrange @@ -321,7 +324,7 @@ public async Task ItReturnsNullWhenGettingNonExistentRecordAsync() Assert.Null(await sut.GetAsync("BaseSet-5", new GetRecordOptions { IncludeVectors = true })); } - [Fact] + [Fact(Skip = SkipReason)] public async Task ItThrowsMappingExceptionForFailedMapperAsync() { // Arrange diff --git a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisVectorStoreTests.cs b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisVectorStoreTests.cs index a6bda9559480..8e18522928eb 100644 --- a/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisVectorStoreTests.cs +++ b/dotnet/src/IntegrationTests/Connectors/Memory/Redis/RedisVectorStoreTests.cs @@ -16,7 +16,10 @@ namespace SemanticKernel.IntegrationTests.Connectors.Memory.Redis; [Collection("RedisVectorStoreCollection")] public class RedisVectorStoreTests(ITestOutputHelper output, RedisVectorStoreFixture fixture) { - [Fact] + // If null, all tests will be enabled + private const string SkipReason = "Requires Redis docker container up and running"; + + [Fact(Skip = SkipReason)] public async Task ItCanGetAListOfExistingCollectionNamesAsync() { // Arrange