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

tests: fix Flaky TestMicroserviceTSOServer/TestConcurrentlyReset #6396

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix Flaky TestMicroserviceTSOServer/TestConcurrentlyReset
Get a copy of now then call base.add, because now is shared by all goroutines and now.add() will add to itself which isn't atomic and multi-goroutine safe.

Signed-off-by: Bin Shi <binshi.bing@gmail.com>
  • Loading branch information
binshi-bing committed Apr 28, 2023
commit e58fc598f7bae502e25ed9e196123aca20a33ecf
5 changes: 4 additions & 1 deletion tests/integrations/tso/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ func (suite *tsoServerTestSuite) TestConcurrentlyReset() {
go func() {
defer wg.Done()
for j := 0; j <= 100; j++ {
physical := now.Add(time.Duration(2*j)*time.Minute).UnixNano() / int64(time.Millisecond)
// Get a copy of now then call base.add, because now is shared by all goroutines
// and now.add() will add to itself which isn't atomic and multi-goroutine safe.
base := now
physical := base.Add(time.Duration(2*j)*time.Minute).UnixNano() / int64(time.Millisecond)
ts := uint64(physical << 18)
suite.resetTS(ts, false, false)
}
Expand Down