Conformance

What a MCoP server must do to pass the Conformance SDK, how to run the suite against your own server, and which scenarios it checks.

The Conformance SDK (protocol/conformance) is a suite that any MCoP server deployment can run. It talks to the server only through the public client SDK, so it checks what an application sees, not the internals.

Server contract

A server under test MUST:

  1. register an agent with the ID mock as mockagent.Agent{} (no delay, no failure);
  2. accept the principals the suite provides and let the suite connect as any of them;
  3. isolate accounts: principals 2 and 3 are in other accounts than principals 0 and 1.

Running it

func TestConformance(t *testing.T) {
    conformance.Run(t, func(t *testing.T) conformance.Target {
        srv := startMyServer(t) // with the mock agent and the principals
        return conformance.Target{Connect: func(t testing.TB, p server.Principal) *robotelos.Client {
            return dialAs(t, srv, p)
        }}
    })
}

conformance.Run runs each scenario as a subtest with a fresh target. conformance.Scenarios() lists them, so a caller can run a subset.

Scenarios

ScenarioChecks
RoundTripA message reaches the mock agent and its reply reaches the client
CommandsAreIdempotentA retry with the same command_id and payload returns the original receipt and applies nothing
AccountsAreIsolatedA principal in one account cannot see or change another account’s conversation
ApprovalAnswersOnceAn approval is accepted once; a second answer is STALE
GroupInviteJoinAndTalkInvite, join and speak in a group
AgentsAnswerGroupMentionsOnlyIn a group, only mentioned agents reply
GroupAuthorizationRoles restrict who may invite, speak and change membership
RemovedParticipantStopsReceivingA removed participant’s stream ends with resnapshot_required
AgentsLeaveWithTheirOwnerAn agent leaves when its owner leaves

The scenarios run on every transport and on PostgreSQL. A server that fails any scenario is not conformant for that transport or store.

Client conformance

Clients are checked the same way: a client library passes if it completes the scenarios through the public API. A client written in another language SHOULD reproduce the same behavior for the cursor, retry and resnapshot rules in Delivery and Commands.

Next steps