Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,15 @@ public static IResourceBuilder<QdrantServerResource> AddQdrant(this IDistributed
context.EnvironmentVariables[EnableStaticContentEnvVarName] = "0";
}
})
.WithHealthCheck(healthCheckKey);
.WithHealthCheck(healthCheckKey)
.WithUrlForEndpoint(QdrantServerResource.PrimaryEndpointName, c =>
{
c.DisplayText = "Qdrant (GRPC)";
// https://github.com/dotnet/aspire/issues/8809
c.DisplayLocation = UrlDisplayLocation.DetailsOnly;
})
.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, c => c.DisplayText = "Qdrant (HTTP)")
.WithUrlForEndpoint(QdrantServerResource.HttpEndpointName, e => new ResourceUrlAnnotation() { Url = "/dashboard", DisplayText = "Qdrant Dashboard" });
}

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

var client = new QdrantClient(endpoint, key);
return client;
}
Expand Down
27 changes: 27 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,33 @@ 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)" && u.DisplayLocation == UrlDisplayLocation.DetailsOnly);
Assert.Single(urls, u => u.Endpoint?.EndpointName == "http" && u.DisplayText == "Qdrant (HTTP)");
Assert.Single(urls, u => u.DisplayText == "Qdrant Dashboard" && u.Url.EndsWith("/dashboard"));

await app.StopAsync();
}

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