Skip to content

Conversation

@IvanKolchanov
Copy link
Contributor

Had to Add TerminatingGatewayConfigEntry and IngressGatewayConfigEntry classes for testing purposes
Resolves #315

IvanKolchanov and others added 2 commits July 12, 2024 04:29
Had to Add TerminatingGatewayConfigEntry and IngressGatewayConfigEntry classes for testing purposes
@IvanKolchanov
Copy link
Contributor Author

@marcin-krystianc should be a working version of #321

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

Nicely done! Just left a comment that we've already a configuration.cs file with all possible config structures defined.

public bool FromWildcard { get; set; }
}

public class TerminatingGatewayConfigEntry : IConfigurationEntry
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have a TerminalGatewayEntry in the Configuration.cs file so there is no need to re-define it.
I think the TerminalGatewayEntry and associated LinkedService are incorrectly defined, but feel free to fix them.
It will break backward compatibility, but those structs are likely not used by anyone since they are not correctly defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I am surprised how I missed it. Some of the classes were a bit incorrect. TerminatingGatewayEntry had a wrong name, LinkedService has wrong class structure, TerminatingGatewayEntry had excess fields. IngressGatewayEntry wasn't implementing IConfigEntry. Also I could rename them to TerminatingGatewayConfigEntry and IngressGatewayConfigEntry as in Golang client code, but that isn't critical.

marcin-krystianc and others added 2 commits July 15, 2024 12:15
…ed Configuration.cs to have correct classes

Changed name TerminalGatewayEntry to TerminatingGatewayEntry
@IvanKolchanov
Copy link
Contributor Author

@marcin-krystianc Tests for backward compatibility fail as expected, but everything else seems to be working.

Copy link
Contributor

@marcin-krystianc marcin-krystianc left a comment

Choose a reason for hiding this comment

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

I think it is almost ready to go, see the comments.

Assert.DoesNotContain(services.Response.Services, n => n.ID == svcID2);
}

[Fact]
Copy link
Contributor

Choose a reason for hiding this comment

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

That test fails for consul 1.6 and 1.7, you can skip running it for these consul versions: see

[SkippableFact]
public async Task Agent_MonitorJSON()
{
var cutOffVersion = SemanticVersion.Parse("1.7.0");
Skip.If(AgentVersion < cutOffVersion, $"Current version is {AgentVersion}, but `logjson` is only supported from Consul {cutOffVersion}");
for an example how to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okey, let me fix that!

c.Address = TestHelper.HttpUri;
}))
{
var terminatingGatewayName = "terminating-gateway";
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use a non-standard name, e.g.:

Suggested change
var terminatingGatewayName = "terminating-gateway";
var terminatingGatewayName = "my-terminating-gateway";

}))
{
var terminatingGatewayName = "terminating-gateway";
var ingressGatewayName = "ingress-gateway";
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use a non-standard name, e.g.:

Suggested change
var ingressGatewayName = "ingress-gateway";
var ingressGatewayName = "my-ingress-gateway";

@marcin-krystianc marcin-krystianc marked this pull request as ready for review July 16, 2024 07:50
var gatewayServices = await client.Catalog.GatewayService(terminatingGatewayName);

Assert.NotEmpty(gatewayServices.Response);
Assert.Equal(ServiceKind.TerminatingGateway, gatewayServices.Response[0].GatewayKind);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would also be good to check if other fields in the response are non-null, hence we know that the struct is correctly defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's a good idea, let me do that real quick

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would also be good to check if other fields in the response are non-null, hence we know that the struct is correctly defined.

Just added the checks, you can see that we can't check all fields, cause some fields are just not present in the response for both gateways, and some just for ingress one

Copy link
Contributor

Choose a reason for hiding this comment

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

We can add checks for port and protocol for the ingress one. Apart from that, it looks good.

Copy link
Contributor Author

@IvanKolchanov IvanKolchanov Jul 17, 2024

Choose a reason for hiding this comment

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

@marcin-krystianc
Sorry, just saw your message, added the assertions, tests went good

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Thanks for help with the PRs!

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.

FEATURE REQUEST: List Services for Gateway

3 participants