Add durable cellular mutation reservations
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (checks) (push) Failing after 4m5s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 3m44s
Foundation / checks (postgres) (push) Canceled after 1m44s
Foundation / checks (client) (push) Canceled after 5m49s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (checks) (push) Failing after 4m5s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 3m44s
Foundation / checks (postgres) (push) Canceled after 1m44s
Foundation / checks (client) (push) Canceled after 5m49s
This commit is contained in:
@@ -123,6 +123,39 @@ void run_life_reservation_store_tests() {
|
||||
const auto counter = admin->query(
|
||||
"SELECT next_identity FROM evolution.life_allocators WHERE world_id=9752", {}, 5s);
|
||||
CHECK(counter && (*counter)[0][0] == "9223372036854775811");
|
||||
std::array<std::uint8_t, cellular_mutation_reservation_input_bytes> mutation_input{};
|
||||
auto put_u64 = [&](std::size_t offset, std::uint64_t value) {
|
||||
for (std::size_t i = 0; i < 8; ++i)
|
||||
mutation_input[offset + i] = static_cast<std::uint8_t>(value >> (i * 8));
|
||||
};
|
||||
put_u64(0, 20); // target tick
|
||||
put_u64(8, first->identity);
|
||||
put_u64(16, 1); // exact offer event
|
||||
put_u64(24, 10); // offer tick
|
||||
mutation_input[32] = 1; // operator id
|
||||
const auto mutation =
|
||||
reserve_cellular_mutation(*db, a, *lease_a, alice, 1, 500, mutation_input, 5s);
|
||||
CHECK(mutation && mutation->region == a.region && mutation->target_tick == 20 &&
|
||||
mutation->successor_identity == 9223372036854775811ULL &&
|
||||
mutation->input == mutation_input);
|
||||
db = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
CHECK(reserve_cellular_mutation(*db, a, *lease_a, alice, 1, 500, mutation_input, 5s) ==
|
||||
*mutation);
|
||||
auto changed_mutation_input = mutation_input;
|
||||
changed_mutation_input[32] = 2;
|
||||
CHECK(failed(
|
||||
reserve_cellular_mutation(*db, a, *lease_a, alice, 1, 500, changed_mutation_input, 5s),
|
||||
LifeReservationError::identity_conflict));
|
||||
CHECK(failed(reserve_cellular_mutation(*db, a, *lease_a, alice, 1, 501, mutation_input, 5s),
|
||||
LifeReservationError::pending_mutation));
|
||||
const auto pending_mutations = load_pending_cellular_mutations(*db, a, *lease_a, 5s);
|
||||
CHECK(pending_mutations && pending_mutations->size() == 1 &&
|
||||
pending_mutations->front() == *mutation);
|
||||
auto invalid_mutation_input = mutation_input;
|
||||
invalid_mutation_input[32] = 0; // operator ID zero is invalid
|
||||
CHECK(failed(
|
||||
reserve_cellular_mutation(*db, a, *lease_a, alice, 1, 502, invalid_mutation_input, 5s),
|
||||
LifeReservationError::invalid));
|
||||
CHECK(reject_primitive_life(*db, a, *lease_a, alice, 1, 3, LifeRefusal::no_placement, 5s) ==
|
||||
LifeRefusal::no_placement);
|
||||
const auto pending = reserve(4);
|
||||
|
||||
Reference in New Issue
Block a user