Fix cellular profile migration test fixture
Foundation / checks (client) (push) Successful in 6s
Foundation / checks (deploy) (push) Successful in 7s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (tsan) (push) Successful in 8m54s
Foundation / checks (postgres) (push) Failing after 32m20s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 35m13s
Foundation / checks (client) (push) Successful in 6s
Foundation / checks (deploy) (push) Successful in 7s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (tsan) (push) Successful in 8m54s
Foundation / checks (postgres) (push) Failing after 32m20s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 35m13s
This commit is contained in:
@@ -193,20 +193,17 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
|
||||
auto endowment = primitive_endowment();
|
||||
CHECK(endowment);
|
||||
auto funding = endowment->body;
|
||||
funding.energy.value = endowment->reserve.energy.value + endowment->construction.value;
|
||||
funding.energy.value += endowment->reserve.energy.value + endowment->construction.value;
|
||||
for (std::size_t index = 0; index < funding.matter.size(); ++index)
|
||||
funding.matter[index].value += endowment->reserve.matter[index].value;
|
||||
auto primitive = PrimitiveLives::create({key.world, key.region, 1, 17, funding, {{0, 0}}});
|
||||
CHECK(primitive);
|
||||
LifeRequest founder;
|
||||
founder.account = filled<16>(0x5A);
|
||||
founder.action = 9;
|
||||
CHECK((*primitive)->spawn(founder, {1, 101, 201, 301, {0}}));
|
||||
auto habitat = CellularHabitat::create({key.world, key.region, 1, 1'000, 1'000, {}});
|
||||
CHECK(habitat);
|
||||
auto current =
|
||||
CellularLives::create(**primitive, std::move(*habitat), {{1'000, 1'000}, 0, 293'150});
|
||||
CHECK(current);
|
||||
CHECK(current && (*current)->lives().empty());
|
||||
auto legacy_bytes = (*current)->snapshot();
|
||||
legacy_bytes.erase(legacy_bytes.begin() + 220 + 168, legacy_bytes.begin() + 220 + 480);
|
||||
constexpr std::uint64_t legacy_magic = 0x3130564C43564541ULL;
|
||||
for (unsigned index = 0; index < 8; ++index)
|
||||
legacy_bytes[index] = static_cast<std::uint8_t>(legacy_magic >> (index * 8U));
|
||||
@@ -223,6 +220,9 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
|
||||
auto provisioned =
|
||||
provision_cellular_region(*owner, **objects, key, 1, **legacy, filled<16>(0x50), build, 5s);
|
||||
CHECK(provisioned);
|
||||
CHECK(owner->query("INSERT INTO evolution.life_allocators VALUES(9755,1000) "
|
||||
"ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
|
||||
return Postgres::connect({env("PGHOST"),
|
||||
{},
|
||||
@@ -249,17 +249,28 @@ void cellular_profile_migration_is_durable_and_recovers_without_a_tick() {
|
||||
const auto& predecessor_value = checked_value(predecessor);
|
||||
CHECK(predecessor_value.head.sequence == 0);
|
||||
|
||||
auto runtime = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
const auto account = filled<16>(0x5A);
|
||||
const auto control =
|
||||
claim_account_control(*runtime, key, authority_value, account, 1, 1, 20'000ms, 5s);
|
||||
CHECK(control);
|
||||
const auto requested = host->create_primitive_life(account, control->generation, 9);
|
||||
CHECK(requested.result == evo::network::PrimitiveLifeResult::pending &&
|
||||
requested.life_identity != 0 && host->queued_births().size() == 1);
|
||||
|
||||
CellularBatch batch;
|
||||
const auto predecessor_digest = sha256(predecessor_value.manifest);
|
||||
CHECK(predecessor_digest);
|
||||
batch.header = {
|
||||
key.world, key.region, 1, predecessor_value.head.commit, checked_value(predecessor_digest),
|
||||
0, 1};
|
||||
batch.ticks.resize(1);
|
||||
for (const auto& life : host->state()->lives())
|
||||
batch.ticks[0].lives.push_back({life.identity.life, {}});
|
||||
CellularTickIntents tick;
|
||||
tick.births.push_back(host->queued_births().front());
|
||||
batch.ticks.push_back(tick);
|
||||
const auto published = host->publish(batch);
|
||||
CHECK(published && published->committed.head.sequence == 1);
|
||||
CHECK(host->state()->lives().size() == 1 &&
|
||||
host->state()->lives().front().identity.born.value == 1);
|
||||
auto migrated =
|
||||
migrate_cellular_profile_to_v2(*owner, **migration_objects, authority_value,
|
||||
published->committed, filled<16>(0x51), build, 5s);
|
||||
|
||||
Reference in New Issue
Block a user