Skip to content

config: health checker timeout and interval should be greater than 0#3734

Merged
mattklein123 merged 5 commits intoenvoyproxy:masterfrom
dio:greater-than-0
Jun 28, 2018
Merged

config: health checker timeout and interval should be greater than 0#3734
mattklein123 merged 5 commits intoenvoyproxy:masterfrom
dio:greater-than-0

Conversation

@dio
Copy link
Member

@dio dio commented Jun 26, 2018

Description:
This patch adds value validation for interval and timeout fields to accept values greater than 0.

Risk Level: Low
Testing: Unit, manual by setting timeout or interval to 0s
Docs Changes: N/A
Release Notes: N/A

Fixes #3729

Signed-off-by: Dhi Aurrahman dio@rockybars.com

dio added 2 commits June 26, 2018 13:43
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thank you! Any chance of adding a test for this stuff?

// health check attempt will be considered a failure.
google.protobuf.Duration timeout = 1 [(validate.rules).duration.required = true];
google.protobuf.Duration timeout = 1 [
(validate.rules).duration = {required: true, gt: {}},
Copy link
Member

Choose a reason for hiding this comment

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

nit: IMO saying greater than 0 is a bit more clear here. Same below.

Copy link
Member Author

@dio dio Jun 26, 2018

Choose a reason for hiding this comment

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

I thought the same, but then I found that the others use gt: {} only (rather than gt: {seconds: 0}). E.g.

[(validate.rules).duration = {required: true, gt: {}}, (gogoproto.stdduration) = true];

Copy link
Member

Choose a reason for hiding this comment

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

mmm I still think that having the explicit value is more clear. I would rather add it here and update the other protos in a separate PR for explicitness.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mattklein123 @junr03 will do. I also think that we should automatically render that requirement into doc, e.g. REQUIRED, GREATER THAN 0 SEC. But I believe that should be down in a different PR. Related: #3731

Copy link
Member Author

Choose a reason for hiding this comment

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

@junr03 done in 1d2b066.

@dio
Copy link
Member Author

dio commented Jun 26, 2018

@mattklein123 do you think I can just add config tests inside the health_checker_impl_test and redis' config_test? Or is it a good idea to introduce a new file containing config tests for the health check config?

@mattklein123
Copy link
Member

@dio I would just add tests wherever is easiest. (Obviously just make sure the validator actually runs.) Thank you!

@mattklein123
Copy link
Member

@junr03 please take a pass on this once tests are added. Thank you!

dio added 2 commits June 27, 2018 10:18
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio
Copy link
Member Author

dio commented Jun 27, 2018

Test is added. PTAL. Thanks!

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

lgtm mod matt's nit, which I actually think we should do.

// health check attempt will be considered a failure.
google.protobuf.Duration timeout = 1 [(validate.rules).duration.required = true];
google.protobuf.Duration timeout = 1 [
(validate.rules).duration = {required: true, gt: {}},
Copy link
Member

Choose a reason for hiding this comment

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

mmm I still think that having the explicit value is more clear. I would rather add it here and update the other protos in a separate PR for explicitness.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Nice, thanks.

@mattklein123 mattklein123 merged commit ab86abc into envoyproxy:master Jun 28, 2018
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.

3 participants