feat: add bounded compatible session browser (#8)
quality-gate / quality (push) Successful in 57s
quality-gate / quality (push) Successful in 57s
Closes #8
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using FinalFactory.Rendezvous.Contracts;
|
||||
using FinalFactory.Rendezvous.Server.Browser;
|
||||
using FinalFactory.Rendezvous.Server.Http;
|
||||
using FinalFactory.Rendezvous.Server.Provisioning;
|
||||
using FinalFactory.Rendezvous.Server.Sessions;
|
||||
@@ -52,6 +53,8 @@ public sealed class SessionHttpEndpointTests
|
||||
builder.Services.AddSingleton<ISessionCapabilityService>(capabilities);
|
||||
builder.Services.AddSingleton(SessionLeaseTiming.From(stateOptions));
|
||||
builder.Services.AddSingleton<SessionLeaseService>();
|
||||
builder.Services.AddSingleton<SessionBrowserCursorCodec>();
|
||||
builder.Services.AddSingleton<SessionBrowserService>();
|
||||
await using WebApplication app = builder.Build();
|
||||
app.UseExceptionHandler();
|
||||
app.MapRendezvousContractEndpoints();
|
||||
@@ -107,6 +110,23 @@ public sealed class SessionHttpEndpointTests
|
||||
ContractJson.Options);
|
||||
Assert.NotNull(session);
|
||||
Assert.Equal($"/v1/sessions/{session.ListingId}", created.Headers.Location!.OriginalString);
|
||||
Assert.True(capabilities.TryFingerprint(
|
||||
session.HostPresenceCapability,
|
||||
out SecretFingerprint presenceFingerprint));
|
||||
store.BindHostPresence(new(
|
||||
session.HostPresenceHandle,
|
||||
presenceFingerprint,
|
||||
new(AddressFamilyKind.Ipv4, "203.0.113.80", 41_000),
|
||||
null));
|
||||
|
||||
BrowseSessionsResponse? browser = await client.GetFromJsonAsync<BrowseSessionsResponse>(
|
||||
"/v1/sessions?contractVersion=1&gameId=space-game&environmentId=production&protocolVersion=7®ionId=eu-central&pageSize=10&excludeFull=true",
|
||||
ContractJson.Options);
|
||||
Assert.Equal(session.ListingId, Assert.Single(browser!.Items).ListingId);
|
||||
GetSessionResponse? direct = await client.GetFromJsonAsync<GetSessionResponse>(
|
||||
$"/v1/sessions/{session.ListingId}?contractVersion=1&gameId=space-game&environmentId=production&protocolVersion=7",
|
||||
ContractJson.Options);
|
||||
Assert.Equal(session.ListingId, direct!.Session.ListingId);
|
||||
|
||||
HttpResponseMessage renewed = await client.PostAsJsonAsync(
|
||||
$"/v1/sessions/{session.ListingId}/renew",
|
||||
|
||||
Reference in New Issue
Block a user