Skip to content

Conversation

@crenshaw-dev
Copy link
Member

@crenshaw-dev crenshaw-dev commented Jun 13, 2025

My initial implementation was overly complicated, because I thought I needed a initiator field on the metrics struct.

Instead, I can just deal directly with global variables.

This test refactors for simplicity and protects the global var initialization with a sync.Once.

Closes #23382

@crenshaw-dev crenshaw-dev requested a review from a team as a code owner June 13, 2025 15:01
@bunnyshell
Copy link

bunnyshell bot commented Jun 13, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@crenshaw-dev crenshaw-dev enabled auto-merge (squash) June 13, 2025 15:09
@crenshaw-dev crenshaw-dev merged commit 6174b94 into argoproj:master Jun 13, 2025
28 checks passed
@codecov
Copy link

codecov bot commented Jun 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.89%. Comparing base (6c299bc) to head (296584a).
⚠️ Report is 424 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #23383      +/-   ##
==========================================
- Coverage   60.00%   59.89%   -0.12%     
==========================================
  Files         342      342              
  Lines       58619    58605      -14     
==========================================
- Hits        35176    35102      -74     
- Misses      20598    20644      +46     
- Partials     2845     2859      +14     

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

dsuhinin pushed a commit to dsuhinin/argo-cd that referenced this pull request Jun 16, 2025
jcogilvie pushed a commit to Sanyaku/argo-cd that referenced this pull request Jun 16, 2025
enneitex pushed a commit to enneitex/argo-cd that referenced this pull request Aug 24, 2025
agaudreault pushed a commit to agaudreault/argo-cd that referenced this pull request Sep 5, 2025
agaudreault added a commit that referenced this pull request Sep 5, 2025
func Test_RegisterWithClientGo_race(_ *testing.T) {
// This test ensures that the RegisterWithClientGo function can be called concurrently without causing a data race.
go RegisterWithClientGo()
go RegisterWithClientGo()
Copy link
Collaborator

Choose a reason for hiding this comment

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

As the test doesn't have any assertion, the 2 goroutines will be terminated as soon as it triggers the second one. Maybe we should somehow add an assertion to make sure both goroutines are executed to the end.

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.

Race condition in kubectl metrics

4 participants