Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-xie committed Dec 6, 2024
1 parent 0066802 commit 7d057fe
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions service/matching/tasklist/matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1638,3 +1638,23 @@ func ensureAsyncReady(ctxTimeout time.Duration, cb func(ctx context.Context)) (w
<-closed
}
}

func (t *MatcherTestSuite) Test_LocalSyncMatch_AutoConfigHint() {
t.disableRemoteForwarding("")

wait := ensureAsyncReady(time.Second, func(ctx context.Context) {
task, err := t.matcher.Poll(ctx, "")
t.NotNil(task.AutoConfigHint)
t.Equal(false, task.AutoConfigHint.EnableAutoConfig) // disabled by default
if err == nil {
task.Finish(nil)
}
})

task := newInternalTask(t.newTaskInfo(), nil, types.TaskSourceHistory, "", true, nil, "")
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
_, err := t.matcher.Offer(ctx, task)
cancel()
wait()
t.NoError(err)
}

0 comments on commit 7d057fe

Please sign in to comment.