Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb3aba6d

Browse files
authored
test: ignore context.Canceled in acquireWithCancel (#17448)
fixescoder/internal#584Ignore canceled error when sending an acquired job, since dRPC is racy and will sometimes return this error even after successfully sending the job, if the test is quickly finished.
1 parentdaafa0d commitb3aba6d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎provisionerd/provisionerd_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,11 @@ func (a *acquireOne) acquireWithCancel(stream proto.DRPCProvisionerDaemon_Acquir
12701270
returnnil
12711271
}
12721272
err:=stream.Send(a.job)
1273-
assert.NoError(a.t,err)
1273+
// dRPC is racy, and sometimes will return context.Canceled after it has successfully sent the message if we cancel
1274+
// right away, e.g. in unit tests that complete. So, just swallow the error in that case. If we are canceled before
1275+
// the job was acquired, presumably something else in the test will have failed.
1276+
if!xerrors.Is(err,context.Canceled) {
1277+
assert.NoError(a.t,err)
1278+
}
12741279
returnnil
12751280
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp