Skip to content

Commit b7ffb21

Browse files
committed
feat: test
1 parent 2d99b61 commit b7ffb21

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pipeline_deduplication_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ func TestDeduplicationPipelineSyncPerform(t *testing.T) {
283283

284284
// TestDeduplicationPipelineDataChanClosed 测试数据通道关闭后的行为
285285
func TestDeduplicationPipelineDataChanClosed(t *testing.T) {
286-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
287-
defer cancel()
286+
ctx := context.Background()
288287

289288
var mux sync.Mutex
290289
var processedCount int
@@ -323,6 +322,8 @@ func TestDeduplicationPipelineDataChanClosed(t *testing.T) {
323322
}
324323
close(dataChan) // 关闭数据通道
325324

325+
time.Sleep(time.Second) // 等待数据发送完毕
326+
326327
// 等待处理完成
327328
select {
328329
case err := <-performDone:

pipeline_standard_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ func TestStandardPipelineSyncPerform(t *testing.T) {
305305

306306
// TestStandardPipelineDataChanClosed 测试数据通道关闭后的行为
307307
func TestStandardPipelineDataChanClosed(t *testing.T) {
308-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*2)
309-
defer cancel()
308+
ctx := context.Background()
310309

311310
var mux sync.Mutex
312311
var processedCount int
@@ -337,7 +336,8 @@ func TestStandardPipelineDataChanClosed(t *testing.T) {
337336
for i := 0; i < 100; i++ {
338337
dataChan <- i
339338
}
340-
close(dataChan) // 关闭数据通道
339+
close(dataChan) // 关闭数据通道
340+
time.Sleep(time.Second) // 等待数据发送完毕
341341

342342
// 等待处理完成
343343
select {

0 commit comments

Comments
 (0)