Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public static IResourceBuilder<QdrantServerResource> AddQdrant(this IDistributed
context.EnvironmentVariables[EnableStaticContentEnvVarName] = "0";
}
})
.WithHealthCheck(healthCheckKey);
.WithHealthCheck(healthCheckKey)
.WithUrlForEndpoint(QdrantServerResource.PrimaryEndpointName, c => c.DisplayText = "Qdrant (GRPC)")
.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, c => c.DisplayText = "Qdrant (HTTP)");
}

/// <summary>
Expand Down Expand Up @@ -179,7 +181,7 @@ private static QdrantClient CreateQdrantClient(string? connectionString)
{
throw new InvalidOperationException("Endpoint is unavailable");
}

var client = new QdrantClient(endpoint, key);
return client;
}
Expand Down
26 changes: 26 additions & 0 deletions tests/Aspire.Hosting.Qdrant.Tests/QdrantFunctionalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,32 @@ await pipeline.ExecuteAsync(async token =>
}
}

[Fact]
[RequiresDocker]
public async Task AddQdrantWithDefaultsAddsUrlAnnotations()
{
using var builder = TestDistributedApplicationBuilder.Create();

var qdrant = builder.AddQdrant("qdrant");

var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
builder.Eventing.Subscribe<AfterEndpointsAllocatedEvent>((e, ct) =>
{
tcs.SetResult();
return Task.CompletedTask;
});

var app = await builder.BuildAsync();
await app.StartAsync();
await tcs.Task;

var urls = qdrant.Resource.Annotations.OfType<ResourceUrlAnnotation>();
Assert.Single(urls, u => u.Endpoint!.EndpointName == "grpc" && u.DisplayText == "Qdrant (GRPC)");
Assert.Single(urls, u => u.Endpoint!.EndpointName == "http" && u.DisplayText == "Qdrant (HTTP)");

await app.StopAsync();
}

[Fact]
[RequiresDocker]
public async Task VerifyWaitForOnQdrantBlocksDependentResources()
Expand Down
Loading