feat(cellular): seed dev wildlife and tune budding playtests
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m27s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m16s
Foundation / image (push) Successful in 4m54s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m27s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m16s
Foundation / image (push) Successful in 4m54s
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "evo/persistence/life_reservation_store.hpp"
|
||||
#include "evo/persistence/sha256.hpp"
|
||||
#include "evo/server/cellular_region_host.hpp"
|
||||
#include "fixtures/cellular_ecology.hpp"
|
||||
#ifdef EVO_POSTGRES_M10
|
||||
#include "evo/server/cellular_session_batch.hpp"
|
||||
#endif
|
||||
@@ -20,6 +21,7 @@
|
||||
#include <thread>
|
||||
|
||||
void run_cellular_publication_tests();
|
||||
void run_starting_wildlife_publication_tests();
|
||||
namespace {
|
||||
using namespace evo::persistence;
|
||||
using namespace evo::server;
|
||||
@@ -1221,6 +1223,7 @@ void cellular_death_is_final_and_account_restarts() {
|
||||
} // namespace
|
||||
|
||||
void run_cellular_publication_tests() {
|
||||
run_starting_wildlife_publication_tests();
|
||||
cellular_birth_publication_is_durable();
|
||||
cellular_profile_migration_is_durable_and_recovers_without_a_tick();
|
||||
cellular_mutation_publication_binds_results();
|
||||
@@ -1412,3 +1415,86 @@ void run_cellular_publication_tests() {
|
||||
restarted_committed_value.head.sequence == 2);
|
||||
restarted->drain();
|
||||
}
|
||||
|
||||
void run_starting_wildlife_publication_tests() {
|
||||
auto source = evo::fixture::opening(980, true, 64, false, 14);
|
||||
const RegionKey key{source->world(), source->region()};
|
||||
auto owner = connect_as(env("PGUSER"));
|
||||
auto runtime = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
const auto build = filled<32>(0xD9);
|
||||
CHECK(owner->query("INSERT INTO evolution.retained_builds(build_identity) VALUES "
|
||||
"(decode(repeat('d9',32),'hex')) ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
const auto identity = [](std::uint8_t index) {
|
||||
auto id = filled<16>(0x18);
|
||||
id.back() = index;
|
||||
return id;
|
||||
};
|
||||
auto objects = FilesystemObjectStore::open(env("PGHOST"), key, max_cellular_lives_bytes);
|
||||
CHECK(objects);
|
||||
auto genesis =
|
||||
provision_cellular_region(*owner, **objects, key, 1, *source, identity(0), build, 5s);
|
||||
CHECK(genesis);
|
||||
auto head = *genesis;
|
||||
auto lease = acquire_region_lease(*runtime, key, build, 60s, 5s);
|
||||
CHECK(lease);
|
||||
CellularBatch batch{{key.world, key.region, 1, head.head.commit, head.head.digest, 0, 1}, {{}}};
|
||||
CHECK(source->advance_tick({}));
|
||||
auto first = publish_cellular_batch(*runtime, **objects, *lease, head, batch, *source,
|
||||
identity(1), build, 5s);
|
||||
CHECK(first);
|
||||
head = first->committed;
|
||||
const auto advance = [&](auto result) {
|
||||
CHECK(result);
|
||||
head = *result;
|
||||
};
|
||||
advance(migrate_cellular_boundary_profile(*runtime, **objects, *lease, head, identity(2), build,
|
||||
5s));
|
||||
advance(migrate_cellular_maturation_profile(*runtime, **objects, *lease, head, identity(3),
|
||||
build, 5s));
|
||||
advance(migrate_cellular_inheritance_profile(*runtime, **objects, *lease, head, identity(4),
|
||||
build, 5s));
|
||||
advance(migrate_cellular_photosynthesis_profile(*runtime, **objects, *lease, head, identity(5),
|
||||
build, {0, 1, {0}}, 5s));
|
||||
CellularLiquidRules liquid{
|
||||
.currents = {5, 48'000, 48'000, 250, 2, 4, 3000, 6000, 60, 300},
|
||||
.founder = {.thrust_q10 = 20'480,
|
||||
.reverse_thrust_q10 = 20'480,
|
||||
.forward_drag_ppm = 95'163,
|
||||
.lateral_drag_ppm = 95'163,
|
||||
.turn = 3'276},
|
||||
.deposits = {.drift_radius_um = 200,
|
||||
.max_drift_q10 = 100 * 1024,
|
||||
.drift_decay_ppm = 95'163,
|
||||
.merged_cap = 8,
|
||||
.bubble_radius_um = evo::biology::cellular_mote_radius_um}};
|
||||
advance(migrate_cellular_liquid_profile(*runtime, **objects, *lease, head, identity(6), build,
|
||||
liquid, 5s));
|
||||
const std::array<Sha256Digest, 1> builds{build};
|
||||
auto before = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
|
||||
CHECK(before && before->state->lives().empty());
|
||||
CellularRevampRules rules;
|
||||
auto expected = before->state->revamp_upgrade_candidate(rules, 32, 900'000);
|
||||
CHECK(expected);
|
||||
advance(migrate_cellular_revamp_profile(*runtime, **objects, *lease, head, identity(7), build,
|
||||
rules, 5s, {}, 32, 900'000));
|
||||
const auto opening_bytes = (*expected)->snapshot();
|
||||
CHECK(release_region_lease(*runtime, key, *lease, 5s));
|
||||
lease = acquire_region_lease(*runtime, key, build, 60s, 5s);
|
||||
CHECK(lease);
|
||||
auto recovered = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
|
||||
CHECK(recovered && recovered->state->snapshot() == opening_bytes &&
|
||||
recovered->state->lives().size() == 32 && recovered->state->tick() == 1);
|
||||
batch = {{key.world, key.region, 1, head.head.commit, head.head.digest, 1, 2}, {{}}};
|
||||
batch.ticks.front().lives = checked_value(wildlife_intents(*recovered->state, 2));
|
||||
CHECK(recovered->state->advance_tick(batch.ticks.front().lives));
|
||||
const auto tick_bytes = recovered->state->snapshot();
|
||||
auto tick = publish_cellular_batch(*runtime, **objects, *lease, head, batch, *recovered->state,
|
||||
identity(8), build, 5s);
|
||||
CHECK(tick);
|
||||
recovered = recover_cellular_checkpoint(*runtime, **objects, key, *lease, builds, 5s);
|
||||
CHECK(recovered && recovered->state->snapshot() == tick_bytes &&
|
||||
recovered->state->lives().size() == 32);
|
||||
CHECK(release_region_lease(*runtime, key, *lease, 5s));
|
||||
std::puts("starting wildlife publication and replacement-owner replay passed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user