-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/azureeventhub] Close storage extension client during component shutdown #36296
[receiver/azureeventhub] Close storage extension client during component shutdown #36296
Conversation
Sorry, this needs tests :/ |
@atoulme any chance you have a brief moment to re-review this PR in the near future? |
if err != nil { | ||
h.settings.Logger.Debug("Error connecting to Storage", zap.Error(err)) | ||
return err | ||
if h.storageClient == nil { // set manually for testing. |
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'm not going to block this PR since it fixes an important bug, but generally I'm not a fan of tests relying on special access to the internals of the code. A better way to do this would be to mock the host, so that it returns the mock client.
…ent shutdown (open-telemetry#36296) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When using a storage extension, the component will call Close on the client during component shutdown. This fixes a bug that resulted in a file potentially remaining locked after component shutdown. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue open-telemetry#36238 <!--Describe what testing was performed and which tests were added.--> #### Testing Since reproducing this was described in the issue as "difficult without custom code", testing just involved ensuring that unit tests covered the added code and ran successfully, and manually ensuring that the collector could still receive events from AEH.
…ent shutdown (open-telemetry#36296) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When using a storage extension, the component will call Close on the client during component shutdown. This fixes a bug that resulted in a file potentially remaining locked after component shutdown. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue open-telemetry#36238 <!--Describe what testing was performed and which tests were added.--> #### Testing Since reproducing this was described in the issue as "difficult without custom code", testing just involved ensuring that unit tests covered the added code and ran successfully, and manually ensuring that the collector could still receive events from AEH.
…ent shutdown (open-telemetry#36296) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description When using a storage extension, the component will call Close on the client during component shutdown. This fixes a bug that resulted in a file potentially remaining locked after component shutdown. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue open-telemetry#36238 <!--Describe what testing was performed and which tests were added.--> #### Testing Since reproducing this was described in the issue as "difficult without custom code", testing just involved ensuring that unit tests covered the added code and ran successfully, and manually ensuring that the collector could still receive events from AEH.
Description
When using a storage extension, the component will call Close on the client during component shutdown. This fixes a bug that resulted in a file potentially remaining locked after component shutdown.
Link to tracking issue
#36238
Testing
Since reproducing this was described in the issue as "difficult without custom code", testing just involved ensuring that unit tests covered the added code and ran successfully, and manually ensuring that the collector could still receive events from AEH.