Skip to content

xdsclient: Fix flakyness in TestResourceUpdateMetrics in the case of repeated NACKs #8363

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

Merged
merged 2 commits into from
May 28, 2025

Conversation

purnesh42H
Copy link
Contributor

@purnesh42H purnesh42H commented May 27, 2025

Fixes: #8344

Successful forge test

In a rare case scenario of NACK, the xDS client can emit metrics in quick succession due to the interaction sequence between the xDS client (in grpc-go) and the test management server (using go-control-plane) after the initial invalid update. The test uses testMetricsReporter for xdsclient to report metrics which calls metricsReporter.ReportMetric() to report invalid and valid xds resource updates. The flakiness is due to timeout in r.metricsCh.Send(m) in the case burst of redundant updates because the metricsCh in testMetricsReporter is a testutils.Channel initialized with a size of 1. A Send operation on this channel will block if the channel is full. See #8344 (comment)

We can mitigate the race by making the metric sends non-block by dropping redundant update and replacing with the new one. Similar to what is being done in internal grpc metrics recorder https://github.com/grpc/grpc-go/blob/master/internal/testutils/stats/test_metrics_recorder.go#L125-L126

RELEASE NOTES: None

Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.34%. Comparing base (4cab0e6) to head (a507ef2).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8363      +/-   ##
==========================================
+ Coverage   82.27%   82.34%   +0.06%     
==========================================
  Files         419      419              
  Lines       42039    42039              
==========================================
+ Hits        34587    34616      +29     
+ Misses       5994     5968      -26     
+ Partials     1458     1455       -3     

see 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@purnesh42H purnesh42H requested review from arjan-bal and dfawley May 27, 2025 17:28
@purnesh42H purnesh42H added Type: Testing Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. labels May 27, 2025
@purnesh42H purnesh42H modified the milestones: 1.73 Release, 1.74 Release May 27, 2025
@dfawley dfawley assigned purnesh42H and unassigned dfawley May 27, 2025
@purnesh42H purnesh42H merged commit 28128e0 into grpc:master May 28, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. Type: Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test Test/ResourceUpdateMetrics (new xDS client)
3 participants