Skip to content
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

fix: convert DAPR_HEALTH_TIMEOUT to float #692

Merged
merged 3 commits into from
Apr 30, 2024

Conversation

KentHsu
Copy link
Contributor

@KentHsu KentHsu commented Apr 9, 2024

Description

Convert settings.DAPR_HEALTH_TIMEOUT from str to float
Update DaprHealthCheckTests mock so the test can catch this error

Issue reference

Fixes #688 [BUG] DAPR_HEALTH_TIMEOUT as environment variable is not converted to numerical value

Please reference the issue this PR will close: #[#688]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@KentHsu KentHsu requested review from a team as code owners April 9, 2024 10:04
@KentHsu KentHsu force-pushed the fix-healthcheck-timeout-bug branch from 3f7c7c0 to 3c08c46 Compare April 9, 2024 10:06
Signed-off-by: KentHsu <chiahaohsu9@gmail.com>
@KentHsu KentHsu force-pushed the fix-healthcheck-timeout-bug branch from 3c08c46 to 2243cbe Compare April 9, 2024 10:08
Copy link

codecov bot commented Apr 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.28%. Comparing base (fc0e9d1) to head (2243cbe).
Report is 17 commits behind head on main.

❗ Current head 2243cbe differs from pull request most recent head 9ea041a. Consider uploading reports for the commit 9ea041a to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #692      +/-   ##
==========================================
- Coverage   86.37%   86.28%   -0.09%     
==========================================
  Files          79       82       +3     
  Lines        4094     4172      +78     
==========================================
+ Hits         3536     3600      +64     
- Misses        558      572      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -62,7 +62,7 @@ def test_wait_until_ready_success_with_api_token(self, mock_urlopen):
self.assertIn('Dapr-api-token', headers)
self.assertEqual(headers['Dapr-api-token'], 'mytoken')

@patch.object(settings, 'DAPR_HEALTH_TIMEOUT', 2)
@patch.object(settings, 'DAPR_HEALTH_TIMEOUT', '2')
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make this 2.5, so it's more explicit.

Suggested change
@patch.object(settings, 'DAPR_HEALTH_TIMEOUT', '2')
@patch.object(settings, 'DAPR_HEALTH_TIMEOUT', '2.5')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated in this commit

Copy link
Contributor

@elena-kolevska elena-kolevska left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @KentHsu, and for reporting @PhilBug.
This problem is fixed in this PR, but that would make the value an int, not a float.

Just a small nit about updating the test to a float value, so it's more explicit.

Signed-off-by: KentHsu <chiahaohsu9@gmail.com>
@KentHsu
Copy link
Contributor Author

KentHsu commented Apr 10, 2024

Thank you for reviewing this PR @elena-kolevska
I update the timeout value to 2.5 and also update the assertion to match this change.
Please let me know if there's anything you think we need to update. Thanks!

@elena-kolevska
Copy link
Contributor

Thanks! LGTM now.

@berndverst berndverst merged commit 9d3fdbc into dapr:main Apr 30, 2024
16 checks passed
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.

[BUG] DAPR_HEALTH_TIMEOUT as environment variable is not converted to numerical value
3 participants