Skip to content
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

test: Workaround slow SRV lookups in flaking test #7957

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

arjan-bal
Copy link
Contributor

@arjan-bal arjan-bal commented Dec 20, 2024

This test was migrated from grpc.DialContext to grpc.NewClient in #7920. This caused the resolver to change from passthrough to dns. The test started failing on Mac and flaking on debian systems (more than 1/100 runs fail). The test uses a short timeout and expects an RPC to fail due to a bad TLS certificate. When the test fails, the RPC failure cause is DeadlineExceeded. The SRV lookups for localhost and service grpclb are causing the timeouts. SRV lookup are disabled by default.

EnableSRVLookups = false

SRV lookups are enabled when grpclb is imported.

func init() {
balancer.Register(newLBBuilder())
dns.EnableSRVLookups = true
}

There is another file in the test package that imports grpclb, causing SRV lookups to be enabled for this test.

_ "google.golang.org/grpc/balancer/grpclb"

RELEASE NOTES: None

@arjan-bal arjan-bal added Type: Internal Cleanup Refactors, etc Area: Testing Includes tests and testing utilities that we have for unit and e2e tests within our repo. labels Dec 20, 2024
@arjan-bal arjan-bal added this to the 1.70 Release milestone Dec 20, 2024
@arjan-bal arjan-bal requested a review from dfawley December 20, 2024 13:27
Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.08%. Comparing base (e5a4eb0) to head (e830617).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7957      +/-   ##
==========================================
- Coverage   82.21%   82.08%   -0.14%     
==========================================
  Files         379      379              
  Lines       38261    38261              
==========================================
- Hits        31458    31405      -53     
- Misses       5514     5551      +37     
- Partials     1289     1305      +16     

see 25 files with indirect coverage changes

@arjan-bal arjan-bal changed the title test: Disable SRV lookups for flaking test test: Workaround slow SRV resolution in flaking test Dec 20, 2024
@arjan-bal arjan-bal changed the title test: Workaround slow SRV resolution in flaking test test: Workaround slow SRV lookups in flaking test Dec 20, 2024
tc := testgrpc.NewTestServiceClient(cc)
ctx, cancel := context.WithTimeout(context.Background(), defaultTestShortTimeout)
ctx, cancel = context.WithTimeout(context.Background(), defaultTestShortTimeout)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a quick note that the deadline is being shortened because WaitForReady waits for context expiration before allowing the call to return?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment.

@arjan-bal arjan-bal assigned arjan-bal and unassigned easwars and dfawley Dec 20, 2024
@arjan-bal arjan-bal merged commit e957825 into grpc:master Dec 20, 2024
12 of 13 checks passed
@arjan-bal arjan-bal deleted the diable-srv-lookup branch December 20, 2024 16:59
vinothkumarr227 pushed a commit to vinothkumarr227/grpc-go that referenced this pull request Dec 23, 2024
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: Internal Cleanup Refactors, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants