Command Palette

Search for a command to run...

Back to skills
skill № 81584

SS14 Tests PoolManager

An in-depth guide to the SS14 integration test framework: PoolManager, TestPair lifecycle, server/client synchronization, action emulation and pitfalls.

FreeNo executable scripts
makura-gamesby makura-games★ 74 GitHub stars

Install SS14 Tests PoolManager in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

SS14 Integration Test Framework

When to use

Use this skill when needed:

  • understand how PoolManager and reusing server/client pairs actually work;
  • it is safe to configure PoolSettings and PairSettings;
  • correctly synchronize server and client ticks;
  • emulate player actions (input, UI, BUI, interactions);
  • analyze typical pool problems and flaky behavior.

If the task is specifically about designing and writing a new test as a product, use a separate skill ss14-tests-authoring. Here the focus is only on the infrastructure and execution mechanics.

Quality filter before transferring the pattern to work:

  • do not use examples older than 2 years;
  • do not use fragments that contain TODO/problematic comments on the test topic;
  • if in doubt, choose a more recent and lower-level example from the engine.

Pool model: what is important to remember :)

PairSettings sets the couple’s life policy:

  • Destructive: the test can “break” the pair.
  • Fresh: require a new pair.
  • Connected: whether an active client↔server session is needed.
  • NoLoadTestPrototypes: Don't load test prototypes (expensive and not reusable).
  • Dirty: disables fast-recycle.

Critical calculated properties:

public virtual bool MustNotBeReused => Destructive || NoLoadTestPrototypes;
public virtual bool MustBeNew => Fresh || NoLoadTestPrototypes;

Consequence:

  • MustBeNew == true => the pool creates a new pair;
  • MustNotBeReused == true => the pair after the test is not returned to reuse.

How PoolManager selects and prepares a pair

The algorithm is essentially this:

  1. If MustBeNew, a new pair is created.
  2. Otherwise, a suitable one is taken from the pool.
  3. If CanFastRecycle(...) == true, only ApplySettings(...) applies.
  4. Otherwise, the full RecycleInternal(...) is executed.
  5. After the pair is issued, stabilization ticks and tick delta synchronization are run.

Practical conclusion:

  • even after a “quick” return, immediate stability cannot be assumed;
  • after critical operations, RunTicksSync(...) and SyncTicks(...) are always appropriate.

Lifecycle couples and return to the pool ⚠️

Correct way:

  1. Take a pair.
  2. Execute the script.
  3. Call CleanReturnAsync().

What CleanReturnAsync() does:

  • Cleanup() pairs;
  • clearing/returning changed CVars;
  • checking that client/server are alive (if the test is not destructive);
  • check runtime exceptions;
  • transfer the pair to Ready or complete destruction if reuse is prohibited.

If you don't call CleanReturnAsync(), dirty-dispose will work via DisposeAsync():

  • the pair is destroyed;
  • a warning appears;
  • the performance and stability of the test run degrades.

Server/client: correct execution contract

IIntegrationInstance has strict discipline:

  • WaitPost(...) / Post(...): mutations only.
  • WaitAssertion(...) / Assert(...): checks and Assert.That(...).
  • WaitIdleAsync(): ensures that the queue is processed.

Responsibilities cannot be mixed:

  • assertions inside Post(...) give noisy and hard to read crashes;
  • mutations in WaitAssertion(...) break the cause-and-effect model of the test.

Specificity of PoolSettings in content

Setting options in content integration tests:

  • InLobby = true automatically requires connected state.
  • DummyTicker is used for an easier mode without full round-flow.
  • Dirty = true is needed if the test changes the state of the round, readiness, lobby phases, etc.
  • AdminLogsEnabled enable only when the test actually checks the admin logs.

CanFastRecycle in the content additionally takes into account:

  • DummyTicker,
  • Map,
  • InLobby.

Emulate player actions

1) Enter (keybind)

In production code this is done through ClientFullInputCmdMessage and InputSystem.HandleInputCommand(...).

// Emulation of pressing keybind in a client instance.
var funcId = inputManager.NetworkBindMap.KeyFunctionID(ContentKeyFunctions.TryPullObject);
var msg = new ClientFullInputCmdMessage(client.Timing.CurTick, client.Timing.TickFraction, funcId)
{
    State = BoundKeyState.Down,
    Coordinates = client.EntMan.GetCoordinates(targetCoords),
    Uid = client.EntMan.GetEntity(targetNetEntity),
};

await client.WaitPost(() =>
{
    inputSystem.HandleInputCommand(clientSession, ContentKeyFunctions.TryPullObject, msg);
});

2) Click on the UI control

The standard way is to send Down + Up via GUIBoundKeyEventArgs and DoGuiEvent(...):

// Pressed the button.
await client.DoGuiEvent(control, downArgs);
await pair.RunTicksSync(1);

// Released the button.
await client.DoGuiEvent(control, upArgs);
await pair.RunTicksSync(1);

3) BUI message

After SendMessage(...) they usually give additional ticks for round-trip client↔server:

await client.WaitPost(() => bui.SendMessage(msg));
await pair.RunTicksSync(15); // handling reserve on both sides

4) Server interaction directly

For low-level interaction

Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the SS14 Tests PoolManager skill do?

An in-depth guide to the SS14 integration test framework: PoolManager, TestPair lifecycle, server/client synchronization, action emulation and pitfalls.

How do I install the SS14 Tests PoolManager skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the SS14 Tests PoolManager skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare SS14 Tests PoolManager with