osd_test: Answer etcd calls one by one in test_peering_flush_same_epoch_repeer #222

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:same-epoch-repeer-test-uaf into master

View File

@@ -4930,7 +4930,9 @@ void test_peering_flush_same_epoch_repeer()
assert(pg.flush_batch && !pg.flush_batch->flush_ops && pg.epoch == 1 && pg.reporting_epoch == 1);
assert(std::count(pg.target_history.begin(), pg.target_history.end(), std::vector<osd_num_t>({ 3, 4 })));
f.st_cli->resume();
// Answer calls one by one, like a real etcd: unpaused, the mock calls back inside etcd_txn()
auto etcd_answer = [&]() { while (f.st_cli->queue.size()) f.st_cli->resume(1); };
etcd_answer();
f.pump();
bool early = f.peer_has_sent_op(3, OSD_OP_SEC_STABILIZE);
printf(" first report landed: etcd history %s, stabilize sent: %s\n", etcd_sets().c_str(), early ? "yes" : "no");
@@ -4940,7 +4942,9 @@ void test_peering_flush_same_epoch_repeer()
answer_lists();
// A real watch advances this revision with every event, the mock doesn't; the history put compares against it
f.st_cli->etcd_watch_revision_pg = f.etcd_store.mod_revision;
etcd_answer();
f.tfd->tick((timespec){ .tv_sec = 0, .tv_nsec = 500000000 });
etcd_answer();
f.pump();
}
printf(" then: etcd history %s, stabilize sent to OSDs 3, 4: %s, %s\n", etcd_sets().c_str(),