Skip to content

Conversation

@WangzJi
Copy link

@WangzJi WangzJi commented Nov 5, 2025

What this PR does:

Which issue(s) this PR fixes:

Fixes #958
Fixes #957
Fixes #956
Fixes #955
Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Add comprehensive unit tests for all SQL query builder functions in
tcc_fence_store_sql.go to achieve 100% test coverage.

Tests cover:
- All 7 public SQL generation functions
- Multiple table name scenarios (standard, custom, schema-qualified, empty)
- Parameter placeholder handling for batch operations
- SQL structure validation and placeholder counting
- Status enum value verification
- SQL injection protection through prepared statements
- Edge cases and error conditions

Fixes apache#958
Add comprehensive unit tests for tcc_fence_wrapper_handler.go to achieve
84.5% test coverage (exceeding the 70% target).

Tests cover:
- Singleton fence handler initialization
- Clean period configuration
- PrepareFence with success, duplicate entry, and error scenarios
- CommitFence with various fence status scenarios
- RollbackFence with various fence status scenarios
- Private helper methods (insertTCCFenceLog, updateFenceStatus)
- Batch delete operations
- Channel-based log cleanup operations
- InitLogCleanChannel and DestroyLogCleanChannel
- Concurrent cleanup goroutines

Fixes apache#957
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request coding rm milestone and removed documentation Improvements or additions to documentation enhancement New feature or request labels Nov 5, 2025
@WangzJi WangzJi marked this pull request as ready for review November 5, 2025 16:39
Add sync.RWMutex to mockTCCFenceStore to protect concurrent access
to mock functions from multiple goroutines. This fixes race conditions
detected by go test -race.

The race detector identified concurrent reads/writes to the mock's
function fields when goroutines in traversalCleanChannel tests
accessed the mock simultaneously.
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 5, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.85%. Comparing base (4420143) to head (4d6336a).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #979      +/-   ##
==========================================
+ Coverage   46.33%   46.85%   +0.51%     
==========================================
  Files         195      197       +2     
  Lines       11887    12044     +157     
==========================================
+ Hits         5508     5643     +135     
- Misses       5943     5961      +18     
- Partials      436      440       +4     

☔ 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.

@slievrly
Copy link
Member

slievrly commented Nov 6, 2025

@WangzJi Pls format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coding documentation Improvements or additions to documentation enhancement New feature or request milestone rm

Projects

None yet

3 participants