From 4eb861cc95343adc93755a8ec1cc1383d0ccfdc2 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Mon, 15 Jun 2026 19:18:42 +0000 Subject: [PATCH] test(provisionerd): deflake TestProvisionerd/CloseCancelsJob The test closes the daemon inside the provisioner parse/init callback, which cancels the in-flight AcquireJobWithCancel RPC immediately after the job is delivered. dRPC can report context.Canceled from the server-side stream.Send even after the message was successfully sent, causing a spurious assert failure. Tolerate context.Canceled from Send in the acquire handler, mirroring the existing acquireOne test helper. If the job was never delivered the test still fails waiting on completeChan. Fixes PLAT-172. --- provisionerd/provisionerd_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/provisionerd/provisionerd_test.go b/provisionerd/provisionerd_test.go index c35e23608fa01..9de2b639cc0ca 100644 --- a/provisionerd/provisionerd_test.go +++ b/provisionerd/provisionerd_test.go @@ -110,7 +110,14 @@ func TestProvisionerd(t *testing.T) { }, }, }) - assert.NoError(t, err) + // The daemon is closed immediately after acquisition, which + // cancels the acquire RPC. dRPC can report context.Canceled + // from Send even after the job was successfully delivered, so + // tolerate it. If the job was never delivered, the test fails + // waiting on completeChan instead. + if !xerrors.Is(err, context.Canceled) { + assert.NoError(t, err) + } return nil }, updateJob: noopUpdateJob,