Skip to content

Conversation

@julio-lopez
Copy link
Collaborator

@julio-lopez julio-lopez commented Aug 21, 2025

  • 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

- 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
@julio-lopez julio-lopez changed the title feat(storage): add user-agent string in Azure storage provider feat(providers): add user-agent string in Azure storage provider Aug 21, 2025
@codecov
Copy link

codecov bot commented Aug 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.38%. Comparing base (cb455c6) to head (cf8920e).
⚠️ Report is 633 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@julio-lopez julio-lopez requested a review from Copilot August 21, 2025 06:15
Copy link

Copilot AI left a 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 ApplicationID variable set to "kopia" for identifying requests to storage providers
  • Implements user-agent header configuration in Azure blob client initialization
  • Introduces DoNotUseTLS option 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)
Copy link

Copilot AI Aug 21, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@Rohit-BM18 Rohit-BM18 left a 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) {
Copy link
Collaborator Author

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

@julio-lopez
Copy link
Collaborator Author

Merging as is. Test fix in a separate PR.

@julio-lopez julio-lopez marked this pull request as ready for review August 22, 2025 04:29
@julio-lopez julio-lopez merged commit 3c148b4 into kopia:master Aug 22, 2025
27 of 31 checks passed
@julio-lopez julio-lopez deleted the feat/az-app-id branch August 22, 2025 04:30
julio-lopez added a commit that referenced this pull request Aug 22, 2025
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
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