Add fenced cellular region host
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 41s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / checks (network) (push) Failing after 3m4s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 4m14s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 41s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / checks (network) (push) Failing after 3m4s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (client) (push) Canceled after 4m14s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Profile-4 publication and recovery against the migration-backed PostgreSQL adapter.
|
||||
#include "evo/persistence/checkpoint_store.hpp"
|
||||
#include "evo/persistence/sha256.hpp"
|
||||
#include "evo/server/cellular_region_host.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <source_location>
|
||||
@@ -46,7 +47,6 @@ std::string hex(std::span<const std::uint8_t> bytes) {
|
||||
|
||||
void run_cellular_publication_tests() {
|
||||
auto owner = connect_as(env("PGUSER"));
|
||||
auto db = connect_as(env("EVO_PG_RUNTIME_USER"));
|
||||
constexpr RegionKey key{9756, 1};
|
||||
const auto build = filled<32>(0xD9);
|
||||
CHECK(owner->query("INSERT INTO evolution.retained_builds(build_identity) VALUES "
|
||||
@@ -83,34 +83,48 @@ void run_cellular_publication_tests() {
|
||||
CHECK(objects && (*objects)->put(payload));
|
||||
CHECK(owner->query("SELECT evolution.provision_region_checkpoint($1::bytea)",
|
||||
std::array{hex(*genesis_bytes)}, 5s));
|
||||
auto predecessor = load_region_checkpoint(*owner, key, 5s);
|
||||
CHECK(predecessor);
|
||||
const auto lease = acquire_region_lease(*db, key, build, 20'000ms, 5s);
|
||||
CHECK(lease);
|
||||
|
||||
const auto predecessor_digest = sha256(predecessor->manifest);
|
||||
CHECK(predecessor_digest);
|
||||
const auto connect = [&]() -> std::expected<std::unique_ptr<Postgres>, PgFailure> {
|
||||
return Postgres::connect({env("PGHOST"), {}, env("PGPORT"), env("PGDATABASE"),
|
||||
env("EVO_PG_RUNTIME_USER"), {}, {}}, 5s);
|
||||
};
|
||||
CellularHostConfig config{key, 1, {}, build, {build}};
|
||||
auto made_host = CellularRegionHost::create(config, connect, std::move(*objects));
|
||||
CHECK(made_host);
|
||||
auto host = std::move(*made_host);
|
||||
CHECK(host->step().ready);
|
||||
CellularBatch batch;
|
||||
batch.header = {key.world, key.region, 1, predecessor->head.commit, *predecessor_digest, 0, 2};
|
||||
const auto predecessor_digest = sha256(host->committed()->manifest);
|
||||
CHECK(predecessor_digest);
|
||||
batch.header = {key.world, key.region, 1, host->committed()->head.commit,
|
||||
*predecessor_digest, 0, 2};
|
||||
batch.ticks.resize(2);
|
||||
for (auto& tick : batch.ticks)
|
||||
tick.lives.push_back({(*opening)->lives()[0].identity.life, {}});
|
||||
const auto replay = replay_cellular_batch(**opening, batch);
|
||||
const auto replay = replay_cellular_batch(*host->state(), batch);
|
||||
CHECK(replay);
|
||||
CellularActionRecord action;
|
||||
action.account = founder.account;
|
||||
action.action_id = 77;
|
||||
action.input[0] = 1; // Tick 1, neutral movement, no patch target.
|
||||
const std::array actions{action};
|
||||
auto published = publish_cellular_batch(*db, **objects, *lease, *predecessor, batch,
|
||||
**replay, filled<16>(0x22), build, 5s, {}, actions);
|
||||
auto published = host->publish(batch, actions);
|
||||
CHECK(published && published->committed.head.sequence == 1 &&
|
||||
published->committed.head.end_tick == 2);
|
||||
published->committed.head.end_tick == 2 &&
|
||||
host->state()->snapshot() == (**replay).snapshot());
|
||||
CHECK(host->take_finalized_actions() ==
|
||||
std::vector<FinalCellularAction>{{action, 1}});
|
||||
host->drain();
|
||||
host.reset();
|
||||
|
||||
auto recovered = recover_cellular_checkpoint(*db, **objects, key, *lease,
|
||||
std::span{&build, 1}, 5s);
|
||||
CHECK(recovered && recovered->manifest.sequence == 1 && recovered->state->tick() == 2 &&
|
||||
recovered->state->snapshot() == (**replay).snapshot() &&
|
||||
recovered->actions == std::vector<CellularActionRecord>{action});
|
||||
CHECK(release_region_lease(*db, key, *lease, 5s));
|
||||
auto restarted_objects = FilesystemObjectStore::open(env("PGHOST"), key,
|
||||
max_cellular_lives_bytes);
|
||||
CHECK(restarted_objects);
|
||||
auto made_restarted = CellularRegionHost::create(config, connect,
|
||||
std::move(*restarted_objects));
|
||||
CHECK(made_restarted);
|
||||
auto restarted = std::move(*made_restarted);
|
||||
CHECK(restarted->step().ready && restarted->state()->tick() == 2 &&
|
||||
restarted->state()->snapshot() == (**replay).snapshot() &&
|
||||
restarted->committed()->head.sequence == 1);
|
||||
restarted->drain();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user