Skip to content

Conversation

@JocelynVelarde
Copy link
Contributor

Changes made

  1. Added GET /v1/catalog/gateway-services/+gateway into Catalog.cs
  2. Included new endpoint into ICatalogEndpoint.cs
  3. Added possible test CatalogTest.cs (currently as a comment)

Issue ticket number and link

@JocelynVelarde
Copy link
Contributor Author

Hello greetings! ☀️
I adapted the commented test, basing myself on the already implemented one from the Consul codebase. Still, I can see that I have to create a TerminatingGatewayConfigEntry struct. Is this necessary? Also, I was wondering what is the difference between Gateaway_ingress and Gateaway_terminating

@JocelynVelarde JocelynVelarde changed the title List services gateaway List services gateway May 8, 2024
@marcin-krystianc
Copy link
Contributor

Gateaway_terminating

Hi,

I'm unsure, but perhaps there's no need to create a separate TerminatingGatewayConfigEntry. It might be possible to utilize the AgentService struct and assign the relevant ServiceKind value accordingly.
As for the difference between ingress and terminating gateways, please refer to the documentation (https://developer.hashicorp.com/consul/docs/connect/gateways).

For our testing purposes, registering any ingress and terminating gateway and then querying it should suffice.

@JocelynVelarde
Copy link
Contributor Author

Gateaway_terminating

Hi,

I'm unsure, but perhaps there's no need to create a separate TerminatingGatewayConfigEntry. It might be possible to utilize the AgentService struct and assign the relevant ServiceKind value accordingly. As for the difference between ingress and terminating gateways, please refer to the documentation (https://developer.hashicorp.com/consul/docs/connect/gateways).

For our testing purposes, registering any ingress and terminating gateway and then querying it should suffice.

OH great, would it look something like this?

 var terminatingGatewayService = new AgentService
    {
        ID = svcID + "-terminating",
        Service = svcID,
        Tags = new[] { "gateway", "terminating" },
        Port = 9090,
        Kind = ServiceKind.TerminatingGateway, 
    };

@marcin-krystianc
Copy link
Contributor

I guess it might work, worth giving it a try.

@JocelynVelarde
Copy link
Contributor Author

@marcin-krystianc I believe it is working now!

2 failing, 222 successful, and 3 skipped checks → on GitHub CLI

var ingressGatewayServices = await client.Catalog.GatewayService("ingress-gateway", QueryOptions.Default, CancellationToken.None);
Assert.NotEmpty(ingressGatewayServices.Response);
// Assert that the response is not null
Assert.NotNull(gatewayServices);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, it "works" because we don't actually check whether there are any services returned, it should be Assert.NotEmpty(gatewayServices.Response) 🐞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright let me check. 🫡

@IvanKolchanov
Copy link
Contributor

@marcin-krystianc Hi, Marcin! I have picked up this issue for now and I just wanted to check up with you on what the state of the issue last was. I have been trying the code and for now it seems to me that during the test the gateaways fail to register completely or fail to register in time for when we check them. That is because when I run the tests the Catalog.Register requests return OK as well as /catalog/gateaway-services/..., however, the GateawayServices Response is Empty.

@marcin-krystianc
Copy link
Contributor

@marcin-krystianc Hi, Marcin! I have picked up this issue for now and I just wanted to check up with you on what the state of the issue last was. I have been trying the code and for now it seems to me that during the test the gateaways fail to register completely or fail to register in time for when we check them. That is because when I run the tests the Catalog.Register requests return OK as well as /catalog/gateaway-services/..., however, the GateawayServices Response is Empty.

Yeah, as far I remember we couldn't figure out why the test procedure fails. It seems the registration is successful, i.e. the request returns Ok and in the Web UI (http://localhost:8500/) we could see it. But still the response is empty and the test fails.
I think it is necessary to reach the consul community for some help.. Another option would be maybe trying to go's tests and seeing how they work.

@IvanKolchanov
Copy link
Contributor

Yeah, as far I remember we couldn't figure out why the test procedure fails. It seems the registration is successful, i.e. the request returns Ok and in the Web UI (http://localhost:8500/) we could see it. But still the response is empty and the test fails. I think it is necessary to reach the consul community for some help.. Another option would be maybe trying to go's tests and seeing how they work.

Hmm, makes sense. How would we go about reaching out to the community? And I am not really sure if I understand the last part corrently. Do you mean trying to work out what we have different from the tests in the Golang client?

@marcin-krystianc
Copy link
Contributor

Hmm, makes sense. How would we go about reaching out to the community? And I am not really sure if I understand the last part corrently. Do you mean trying to work out what we have different from the tests in the Golang client?

Regarding the community: I think Jocelyn already started a conversation in the consul project https://discuss.hashicorp.com/t/null-response-when-making-get-request-to-list-services-associated-with-a-gateway/67115/3.

Regarding the go tests, I mean that we can compare our tests with go client's tests and look for differences.

@marcin-krystianc
Copy link
Contributor

Replaced with #347

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants