@@ -1,5 +1,22 @@
|
||||
<?php
|
||||
|
||||
test('cycle contention requires all three real lock and single-effect receipts', function () {
|
||||
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'race-cycles'];
|
||||
$rows = [];
|
||||
foreach (['same_operation' => [200, 200], 'different_operations' => [200, 409], 'late_decision' => [200, 409]] as $scenario => $statuses) {
|
||||
$rows[] = ['scenario' => $scenario, 'statuses' => $statuses, 'blocked_writers_observed' => 2, 'returns' => 1, 'reserve_minor' => 0, 'late_approvals' => 0];
|
||||
}
|
||||
$rows[] = ['old_cycle_runtime_rejected_before_balance' => true, 'status' => 503];
|
||||
$output = function () use (&$rows) {
|
||||
return implode("\n", array_map(fn ($row) => json_encode($row, JSON_THROW_ON_ERROR), $rows));
|
||||
};
|
||||
expect(landedQaReceiptsVerified($command, $output()))->toBeTrue();
|
||||
$rows[2]['late_approvals'] = 1;
|
||||
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
|
||||
array_pop($rows);
|
||||
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
|
||||
});
|
||||
|
||||
test('capital register contention requires both actual lock receipts and one immutable version per scenario', function () {
|
||||
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'race-capital'];
|
||||
$rows = [];
|
||||
|
||||
Reference in New Issue
Block a user