Skip to content

Commit

Permalink
DAOS-13496 control: Extend timeout for SystemJoin unit test
Browse files Browse the repository at this point in the history
There were some cases where the external timeout was being hit in
CI.

Also updated the mock InvokeUnaryRPC() method to allow the response-
sending goroutine to abort during the response delay, if there is one.

Required-githooks: true

Signed-off-by: Kris Jacque <kris.jacque@intel.com>
  • Loading branch information
kjacque committed Jul 7, 2023
1 parent dabc47e commit ca0a08d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/control/lib/control/mocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,16 @@ func (mi *MockInvoker) InvokeUnaryRPCAsync(ctx context.Context, uReq UnaryReques
}
if delay > 0 {
mi.log.Debugf("delaying mock response for %s", delay)
time.Sleep(delay)
select {
case <-time.After(delay):
case <-ctx.Done():
mi.log.Debugf("context canceled on iteration %d (error=%s)", idx, ctx.Err().Error())
return
}
}

select {
case <-ctx.Done():
mi.log.Debugf("context canceled on iteration %d (error=%s)", idx, ctx.Err().Error())
return
case responses <- hr:
mi.log.Debug("sending mock response")
}
mi.log.Debug("sending mock response")
responses <- hr
}
close(responses)
}(invokeCount)
Expand Down
2 changes: 1 addition & 1 deletion src/control/lib/control/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ func TestControl_SystemJoin_Timeouts(t *testing.T) {
},
"inner context is canceled; request is retried": {
mic: &MockInvokerConfig{
ReqTimeout: 100 * time.Millisecond, // outer timeout
ReqTimeout: 500 * time.Millisecond, // outer timeout
RetryTimeout: 10 * time.Millisecond, // inner timeout
UnaryResponseSet: []*UnaryResponse{
{
Expand Down

0 comments on commit ca0a08d

Please sign in to comment.