-
Notifications
You must be signed in to change notification settings - Fork 594
feat(providers): add user-agent string in Azure storage provider #4777
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
Conversation
- Adds 'kopia' as the application ID. - Adds a unit test verifying that the header sent to Azure contains the application ID in the user agent string. - Adds an option to use an insecure connection to Azure, primarily for testing. Authored by: @andrason
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4777 +/- ##
==========================================
+ Coverage 75.86% 76.38% +0.51%
==========================================
Files 470 530 +60
Lines 37301 40443 +3142
==========================================
+ Hits 28299 30892 +2593
- Misses 7071 7507 +436
- Partials 1931 2044 +113 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR adds user-agent identification and testing capabilities to the Azure storage provider by introducing a "kopia" application ID and support for insecure connections.
- Adds a global
ApplicationIDvariable set to "kopia" for identifying requests to storage providers - Implements user-agent header configuration in Azure blob client initialization
- Introduces
DoNotUseTLSoption for testing with HTTP connections instead of HTTPS
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| repo/blob/storage.go | Adds global ApplicationID variable for user-agent identification |
| repo/blob/azure/azure_options.go | Adds DoNotUseTLS option for insecure connections |
| repo/blob/azure/azure_storage.go | Implements user-agent configuration and protocol selection logic |
| repo/blob/azure/azure_storage_test.go | Adds unit test to verify user-agent header contains application ID |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| server := httptest.NewServer(http.HandlerFunc(handler)) | ||
| t.Cleanup(server.Close) | ||
|
|
||
| t.Setenv("HTTP_PROXY", server.URL) |
Copilot
AI
Aug 21, 2025
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.
Using HTTP_PROXY to intercept Azure SDK requests is unreliable because the Azure SDK may not respect proxy settings for all request types. The test may pass inconsistently or fail to capture the User-Agent header properly.
Rohit-BM18
left a comment
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.
LG
| return count | ||
| } | ||
|
|
||
| func TestUserAgent(t *testing.T) { |
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.
This cannot be merged yet.
This test is causing the "providers" tests to time out.
See https://github.com/kopia/kopia/actions/runs/17118799732/job/48554976801?pr=4777
|
Merging as is. Test fix in a separate PR. |
Leverage `require.Eventually` to prevent indefinite test hangs / timeouts, removes blocking receive op on a channel. Additional cleanups: - rename test file - remove unused const - consistently use `testloggin.Context(t)` - consistently leverage assertions from the `testify` package Refs: - #4780 - #4777
kopiaas the application ID.Authored by: @andrason