Skip to content

Conversation

@lance6716
Copy link
Collaborator

close #988

check a counter to verify cache really takes effect

Signed-off-by: 田原 <tianyuan@pingcap.cn>
@lance6716 lance6716 requested a review from Copilot February 27, 2025 10:21
Copy link
Contributor

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.

PR Overview

This PR removes time-based checks in cache tests and replaces them with a counter-based mechanism to verify that caching is effective.

  • Removed timing-based measurements from TestCachingSha2Cache and TestCachingSha2CacheTLS.
  • Introduced an atomic counter (getCredCallCnt) in RemoteThrottleProvider to confirm that GetCredential is called only once.
  • Updated tests to assert the new counter value after establishing connections.

Reviewed Changes

File Description
server/caching_sha2_cache_test.go Replaced delay-based timing checks with an atomic counter verification mechanism.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

server/caching_sha2_cache_test.go:63

  • [nitpick] Consider renaming 'getCredCallCnt' to 'getCredCallCount' for improved clarity.
getCredCallCnt atomic.Int64

@lance6716
Copy link
Collaborator Author

@dveeden PTAL

@lance6716 lance6716 merged commit b39e40d into go-mysql-org:master Mar 4, 2025
15 checks passed
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.

flaky test TestCachingSha2CacheTLS/TestCache

2 participants