fix: file a test's drop against the tick the world is on #113
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/world-test-tick"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A test that writes
tick: 0when it drops something on the floor is statingwhen the drop happened, and
World.GroundItemsfiles the despawn 300 ticksafter it. On a world that has been up for more than three minutes that pile is
born already overdue, so the sweep takes it before the assertion reads it.
That is why two tests passed alone and failed in the suite — 28 seconds of
world against 670:
World.FiremakingWorldTest, "a fire on a fire is refused from a pilealready lying under the fire": the pile it drops is gone by the time it
looks.
World.Content.LightTest, "the loop over the real floor": the loop haltssaying the logs have disappeared, because on the real floor they have.
Both read as flakiness and both are arithmetic.
The fix
Support.PlayerHost.join/2already had the answer and threw it away.World.join/2states the tick it seats a player on — the same fact a realsession is given, and the tick
World.Player.Hostis seeded with — so thereply now carries it and the firemaking test drops against it. The other 37
call sites take
_tick.For a test with no player to ask,
Support.WorldClock.tick/0reads the world'sown clock, which is the
:sys.get_state/1idiom this suite already uses in 72places to wait for a tick to land.
World.Content.LightTestandWorld.ItemSpawnsWorldTestfile their drops against it.World.GroundItemsTestkeeps its literals on purpose: there the ticks are thesubject rather than a timestamp —
despawn_at == 300,expire(299) == []—and the arithmetic is what is being asserted.
Verified where the failure lives
Both defects are invisible to the file alone, so the whole suite is the oracle:
4275/4276, twice, the single red being the snapshot key list that is fixed
on
fix/tick-snapshot-setup-key. Before this branch the same run was 4274/4276.