From bcf697e8d7409b48bc9deafae0f8cb15929c0511 Mon Sep 17 00:00:00 2001 From: Putnam3145 Date: Thu, 15 Oct 2020 04:38:49 -0700 Subject: [PATCH] Fixes a race condition in the surgery unit test that causes it to fail at random (#13552) * Fixes a race condition in the surgery unit test * Increases the sleep a bit. --- code/modules/unit_tests/surgeries.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/unit_tests/surgeries.dm b/code/modules/unit_tests/surgeries.dm index 491b0c5645..7b8145ac19 100644 --- a/code/modules/unit_tests/surgeries.dm +++ b/code/modules/unit_tests/surgeries.dm @@ -41,6 +41,8 @@ TEST_ASSERT(surgery_for_zero.step_in_progress, "Surgery on patient zero was not initiated") var/datum/surgery/organ_manipulation/surgery_for_one = new + + sleep(0.2) // if we don't have this, then the next surgery step can start *before* the previous one does, which is no good // Without waiting for the incision to complete, try to start a new surgery TEST_ASSERT(!surgery_step.initiate(user, patient_one, BODY_ZONE_CHEST, scalpel, surgery_for_one), "Was allowed to start a second surgery without the rod of asclepius")