Skip to content

Commit

Permalink
.Net: Enable Weaviate integration tests (microsoft#8627)
Browse files Browse the repository at this point in the history
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Enabled Weaviate integration tests for Docker image v1.26.4.

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] 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
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
  • Loading branch information
dmytrostruk authored Sep 9, 2024
1 parent bd34da9 commit e403734
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,20 @@ private static async Task<bool> CheckIfClusterReadyAsync(HttpClient httpClient)
private static async Task<string> SetupWeaviateContainerAsync(DockerClient client)
{
const string Image = "cr.weaviate.io/semitechnologies/weaviate";
const string Tag = "1.26.4";

await client.Images.CreateImageAsync(
new ImagesCreateParameters
{
FromImage = Image,
Tag = "latest",
Tag = Tag,
},
null,
new Progress<JSONMessage>());

var container = await client.Containers.CreateContainerAsync(new CreateContainerParameters()
{
Image = Image,
Image = $"{Image}:{Tag}",
HostConfig = new HostConfig()
{
PortBindings = new Dictionary<string, IList<PortBinding>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ namespace SemanticKernel.IntegrationTests.Connectors.Memory.Weaviate;
[Collection("WeaviateVectorStoreCollection")]
public sealed class WeaviateVectorStoreRecordCollectionTests(WeaviateVectorStoreFixture fixture)
{
private const string SkipReason = "Tests are disabled during batch/object request problem investigation.";

[Fact(Skip = SkipReason)]
[Fact]
public async Task ItCanCreateCollectionAsync()
{
// Arrange
Expand All @@ -28,7 +26,7 @@ public async Task ItCanCreateCollectionAsync()
Assert.True(await sut.CollectionExistsAsync());
}

[Theory(Skip = SkipReason)]
[Theory]
[InlineData("ExistingCollection", true)]
[InlineData("NonExistentCollection", false)]
public async Task ItCanCheckIfCollectionExistsAsync(string collectionName, bool collectionExists)
Expand All @@ -48,7 +46,7 @@ public async Task ItCanCheckIfCollectionExistsAsync(string collectionName, bool
Assert.Equal(collectionExists, result);
}

[Theory(Skip = SkipReason)]
[Theory]
[InlineData("CollectionWithVectorAndDefinition", true, true)]
[InlineData("CollectionWithVector", true, false)]
[InlineData("CollectionWithDefinition", false, true)]
Expand Down Expand Up @@ -98,7 +96,7 @@ public async Task ItCanUpsertAndGetRecordAsync(string collectionName, bool inclu
}
}

[Fact(Skip = SkipReason)]
[Fact]
public async Task ItCanDeleteCollectionAsync()
{
// Arrange
Expand All @@ -117,14 +115,16 @@ public async Task ItCanDeleteCollectionAsync()
Assert.False(await sut.CollectionExistsAsync());
}

[Fact(Skip = SkipReason)]
[Fact]
public async Task ItCanDeleteRecordAsync()
{
// Arrange
var hotelId = new Guid("55555555-5555-5555-5555-555555555555");

var sut = new WeaviateVectorStoreRecordCollection<WeaviateHotel>(fixture.HttpClient!, "TestDeleteRecord");

await sut.CreateCollectionAsync();

var record = this.CreateTestHotel(hotelId);

var upsertResult = await sut.UpsertAsync(record);
Expand All @@ -142,7 +142,7 @@ public async Task ItCanDeleteRecordAsync()
Assert.Null(getResult);
}

[Fact(Skip = SkipReason)]
[Fact]
public async Task ItCanUpsertAndGetAndDeleteBatchAsync()
{
// Arrange
Expand Down Expand Up @@ -176,7 +176,7 @@ public async Task ItCanUpsertAndGetAndDeleteBatchAsync()
Assert.Empty(getResults);
}

[Fact(Skip = SkipReason)]
[Fact]
public async Task ItCanUpsertRecordAsync()
{
// Arrange
Expand Down

0 comments on commit e403734

Please sign in to comment.