-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added list nodes for connect-capable service with endpoints #312
Added list nodes for connect-capable service with endpoints #312
Conversation
Hello! I would appreciate some feedback/review regarding this new endpoint support. 🐝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JocelynVelarde,
Thank you for raising this PR. I've left a comment regarding the importance of maintaining backward compatibility and avoiding unnecessary logic in our library. Apart from that, could you please implement tests for the new API that is being introduced?
Consul/Health.cs
Outdated
switch (healthType) | ||
{ | ||
case "connectHealth": | ||
path = "/v1/health/connect/{0}"; | ||
break; | ||
default: | ||
path = "/v1/health/service/{0}"; | ||
break; | ||
} | ||
var req = _client.Get<ServiceEntry[]>(string.Format(path, service), q, filter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that the documentation mentions that the connect
and service
endpoints are nearly identical, but I don't think it's a good idea to rely on that. I would rather split this into two separate implementations, one for connect
and one for service
endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okei noted, so instead of implementing the switch case, I should implement as a separate entity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okei noted, so instead of implementing the switch case, I should implement as a separate entity?
yes, I think it is going to be better that way.
Consul/Interfaces/IHealthEndpoint.cs
Outdated
@@ -36,7 +36,9 @@ public interface IHealthEndpoint | |||
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, CancellationToken ct = default); | |||
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, CancellationToken ct = default); | |||
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, CancellationToken ct = default); | |||
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, CancellationToken ct = default); | |||
Task<QueryResult<ServiceEntry[]>> Service(string service, string tag, bool passingOnly, QueryOptions q, Filter filter, string healthType, CancellationToken ct = default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not ok, to change the public method signature in a way that makes it incompatible with previous versions.
If a new parameter is needed, then the new method overload needs to be added (without modifying the existing one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright so, leave the method signature as it was and just add a new one with the new parameter.
Hello! I was getting some errors with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! I was getting some errors with the
BaseFixture.cs
class, I was wondering if someone could explain why this is happening, greetings.
Hi, I'm not sure which errors you mean exactly. I see that everything fails because the response is empty. I suggest have a look at Agent_Service_Register_With_Connect
and see how to register service with a "connect" information.
From what I can see, Connect is equivalent to Service, except that Service will return the ones that are Connect-enabled. The new endpoint for Connect in |
I think, the key to properly test it is to create conenct-enabled service, e.g.:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JocelynVelarde,
the changes look good now. and the tests are successful in the CI too. There is a small issue with GH reporting status to the RP though. Can you push another commit or two (e.g. add an empty line and remove it) maybe that will resolve the issue with tests statuses?
Nevermind, I closed and reopened the PR to trigger the workflow on the latest commit. |
Consul.Test/HealthTest.cs
Outdated
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ```suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the whitespaces on the last commit.
I think that the |
Changes made
Health.cs
IHealthEndpoint.cs
Issue ticket number and link
Refers to issue #311
Next tasks