Hello!! I was wondering if I could get some support with the service List Services for Gateway. As, I have been working on implementing the corresponding test in the consuldotnet repository to make this service available.
This is the approach taken to test the service:
[Fact]
public async Task Catalog_GatewayServices()
{
using (IConsulClient client = new ConsulClient(c =>
{
c.Token = TestHelper.MasterToken;
c.Address = TestHelper.HttpUri;
}))
{
var terminatingGatewayName = "terminating-gateway";
var ingressGatewayName = "ingress-gateway";
// Register terminating gateway service
var terminatingGatewayEntry = new CatalogRegistration
{
Node = "gateway-service",
Address = "192.168.1.100",
Service = new AgentService
{
ID = "terminating-gateway",
Service = terminatingGatewayName,
Port = 8080,
Kind = ServiceKind.TerminatingGateway,
}
};
await client.Catalog.Register(terminatingGatewayEntry);
// Register ingress gateway service
var ingressGatewayEntry = new CatalogRegistration
{
Node = "gateway-service",
Address = "192.168.1.100",
Service = new AgentService
{
ID = "ingress-gateway",
Service = ingressGatewayName,
Port = 8081,
Kind = ServiceKind.IngressGateway,
}
};
await client.Catalog.Register(ingressGatewayEntry);
// Retrieve gateway services associated with the "gateway-service" node
var gatewayServices = await client.Catalog.GatewayService("gateway-service", QueryOptions.Default, CancellationToken.None);
// Assert that the response is not null
Assert.NotNull(gatewayServices);
}
}
Once I run the local server in Consul/ui I can see that the Node for gateway-service
is registered as well as the two associated services → terminating-gateway
and ingress-gateway
(see image below)
The error I’m getting is a null response when trying to make requests to the API endpoint (GET /v1/catalog/gateway-services/:gateway
). I have tried making curl requests directly, but still I only get []
Here is the error log
2024-05-14T12:41:21.615+0200 [WARN] agent.server.catalog: no terminating-gateway or ingress-gateway associated with this gateway: gateway=gateway-service
I would really appreciate it if someone can take a look into the code test mentioned above to see any potential reasons on why am I getting a null response from the gateway service. Here is the complete code.