Skip to content

Commit 51a4e1a

Browse files
committed
Fixed flappy test
1 parent f71806b commit 51a4e1a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

database/factories/CheckoutAcceptanceFactory.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,22 @@ public function withAlertingTo(User $user)
100100

101101
private function createdAssociatedActionLogEntry(CheckoutAcceptance $acceptance): void
102102
{
103+
// Match the log entry's created_at to the acceptance's created_at
104+
// explicitly. ReportsController::sentAssetAcceptanceReminder
105+
// joins the two on WHERE created_at = ?, and TIMESTAMP columns
106+
// store second precision — so if the acceptance's default
107+
// timestamp and this insert's default timestamp straddle a second
108+
// boundary (under full-suite load, often enough to matter), the
109+
// join returns nothing and the reminder path bails with an error.
110+
// Passing the acceptance's created_at through makes the pair
111+
// deterministically identical.
103112
$acceptance->checkoutable->assetlog()->create([
104113
'action_type' => 'checkout',
105114
'target_id' => $acceptance->assigned_to_id,
106115
'target_type' => User::class,
107116
'item_id' => $acceptance->checkoutable_id,
108117
'item_type' => $acceptance->checkoutable_type,
118+
'created_at' => $acceptance->created_at,
109119
]);
110120
}
111121
}

0 commit comments

Comments
 (0)