Skip to content

Commit

Permalink
fix: fix tmq poll tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huskar-t committed Jan 6, 2025
1 parent c027d2f commit 4fca8e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controller/ws/tmq/tmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3380,7 +3380,7 @@ func TestPollError(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 0, pollResp.Code, string(msg))
// sleep
time.Sleep(time.Second * 20)
time.Sleep(time.Second * 5)
// poll
b, _ = json.Marshal(TMQPollReq{ReqID: 1, BlockingTime: 500})
msg, err = doWebSocket(ws, TMQPoll, b)
Expand Down
10 changes: 6 additions & 4 deletions db/asynctmq/tmqhandle/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ func TestTMQHandlerPool(t *testing.T) {

caller := handler.Caller
pollRes := unsafe.Pointer(&struct{}{})
caller.PollCall(pollRes)
if <-caller.PollResult != pollRes {
caller.PollCall(pollRes, 0, "")
res := <-caller.PollResult
if res.Res != pollRes {
t.Errorf("PollCall failed")
}

Expand Down Expand Up @@ -72,8 +73,9 @@ func TestTMQCaller(t *testing.T) {
// Test PollCall
a := 1
res := unsafe.Pointer(&a)
caller.PollCall(res)
if <-caller.PollResult != res {
caller.PollCall(res, 0, "")
pollRes := <-caller.PollResult
if pollRes.Res != res {
t.Error("PollCall failed")
}

Expand Down

0 comments on commit 4fca8e2

Please sign in to comment.