Skip to content

Commit

Permalink
fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCheung96 authored and ti-chi-bot committed Nov 26, 2023
1 parent ee89b15 commit 7cdfae2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cdc/sink/ddlsink/cloudstorage/cloud_storage_ddl_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"net/url"
"os"
"path"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -158,16 +159,16 @@ func TestCleanupExpiredFiles(t *testing.T) {
err = replicaConfig.ValidateAndAdjust(sinkURI)
require.Nil(t, err)

cnt := 0
cnt := atomic.Int64{}
cleanupJobs := []func(){
func() {
cnt++
cnt.Add(1)
},
}
sink, err := newDDLSink(ctx, model.DefaultChangeFeedID("test"), sinkURI, replicaConfig, cleanupJobs)
require.Nil(t, err)

_ = sink
time.Sleep(3 * time.Second)
require.LessOrEqual(t, 1, cnt)
require.LessOrEqual(t, int64(1), cnt.Load())
}

0 comments on commit 7cdfae2

Please sign in to comment.