conformance

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0, MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package conformance has the tests that check a server against the contract ritsu generates. They run on any store (Trials on a server.TrialStore): write a test that calls them with a function that gives an empty store of yours.

  • Vectors gives every vector of the packages to a server through its API.
  • Worked checks what each half-filled form of the vectors works out.
  • Trials tries each operation of a person among the vectors before it is done.
  • Concurrent sends many operations to the same tickets at once, and checks what the store kept.
  • WaitingCounts checks the counts of the tickets that wait for a person against the tickets.
  • WaitingOrder checks the order of those tickets.
  • MineOrder checks the order and the counts of a person's own requests.
  • Reminded checks that the store keeps whether a stage's reminder has rung.
  • Keeping checks the zone of the times a store answers, and how it forgets old operations.
  • Administration checks what the administration keeps: the starts of the versions, the record, the drafts and the imports of the organization's data.

CONTRIBUTING.md, at the root of the module, shows a test that calls them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Administration

func Administration(t *testing.T, s Setup)

Administration checks a store against what the administration keeps (the framework's DESIGN 13), through a server of the setup's packages and organization, on the first kind of the first package. It needs no vectors.

(a) Switches: the version is switched to never, back to its description's start, to the same
    start again (no record), and to now, each with the number read; a number read before is
    stale (409). The store keeps the start with its number raised by one and the record that
    decided it, and the version a new request takes follows each. A change whose starts of
    other versions (Change.Kept) are not as the store has them is ErrConflict, and writes
    nothing.
(b) The record of the switches: the lines by what they are, and the pages of every limit from
    one to one more than the lines, the newest first, with no line twice and none left out.
(c) Imports: a check of the source's data as it is says it is the latest's; a person added
    makes a draft with its difference, imported once with its digest (a digest that is not the
    draft's is refused, 400); of two drafts checked against one latest and imported at once,
    one is taken and the other is stale; a person's sixth draft forgets their oldest, and the
    sweep forgets the drafts past a day; the imports that add a snapshot are held to
    Config.ImportsPerDay (4 here) in 24 hours (429), and the store holds them too (a change
    past ImportsMax is ErrTooManyImports, and writes nothing); one of an older snapshot adds
    none; at start, data unchanged since its last import from the source is not imported
    again, and of two processes that start at once with new data, one imports it. The store
    compares the source's last import a start read (Change.LastImport) under its lock: another
    since, or one where it read none, is ErrConflict and writes nothing; and it holds the
    imports of any data in 24 hours (a change past ChangesMax is ErrTooManyImports, whether it
    adds a snapshot or not).
(d) One the gate does not allow changes nothing, reads nothing, and has no upload read.
(e) Record reads the record a start names (Start.Record), and answers ErrNotFound for an ID the
    store does not keep. A change with a record of an ID the store keeps is the store's error
    (none of ErrConflict, ErrKeyTaken and ErrTooManyImports), and writes nothing: no second
    record of the ID, no start, no key.
(f) A page's before names a move by its ID as Line.ID writes it (`<ticket>/<number>`), and by
    no other writing of it: a number with a zero before it, a sign, a fraction, past int64, or
    none gives no line, as a ticket's ID alone does.

func Bundles

func Bundles(t *testing.T, s Setup)

Bundles checks what a store keeps of the bundles (the framework's DESIGN 15.9), on the store alone:

(a) An empty store keeps no bundle, and has no archive of any digest (ErrNotFound).
(b) A new bundle is kept with its archive, the records of the versions it adds (What "bundle",
    read by those versions and by their kind, and by no other version) and the operation's key,
    its times to the microsecond in UTC, and all it was uploaded with: the key that signed it,
    its signature, how many vectors of each kind its check ran, and the ritsu that made it. The same digest again is ErrConflict, and writes
    nothing: no record, no key.
(c) A new state is kept only from the state and the hiding read: from another, ErrConflict, and
    nothing is written. An archive given again replaces the one kept, and none keeps it.
(d) Of two bundles that add a version, the second approved is ErrConflict, and nothing is
    written; once hidden (and its archive forgotten), it is listed hidden, with no archive.
(e) The bundles are listed by the time they were uploaded, then by digest.

func Concurrent

func Concurrent(t *testing.T, s Setup)

Concurrent sends many operations to the same tickets at once, through two servers on one store (two processes), and checks what the store kept:

(a) a ticket's moves, given to its kind's entries again in order, make the ticket the store keeps;
(b) no two things to do share a key;
(c) a refused operation changed nothing: no move has its key;
(d) when an operation was answered, its move, its ticket and its things to do were saved;
(e) no notice went out for a move that was not saved (the two processes share one notifier, as
    real ones share one mail system, and it sends a key once);
(f) only a comment is answered 429 (the server does not take it now, DESIGN 7.4), which changed
    nothing, as (c); and the comments of one person on one ticket that were taken are
    Config.CommentEvery apart, though they were sent at once to both processes.

The operations are submits the vectors take, then, at once on each ticket: the approvals of the ones it waits for (some sent twice with one key, to both servers), comments, a withdrawal, the timers as the clock moves on, and the agents' answers.

func Keeping

func Keeping(t *testing.T, s Setup)

Keeping checks what a store answers of what it keeps, apart from the tickets of the vectors: the zone of the times it answers, and the operations it forgets. It needs no vectors.

(a) A move of a new ticket is saved with every time it keeps in a zone other than UTC, finer
    than a microsecond: its time, when the ticket began to wait, a timer and a thing to do, with
    an operation's key; then an operation is begun, a snapshot of the organization saved and an
    upload kept, at such a time too. Each time a read answers (Ticket, Waiting, Mine, Moves,
    Operation, Begin for a new key and for a key begun before, Timers, DueTimers, ToDoList,
    ToDoItem, DueToDo, LatestOrganization, Organization, LetGoUploads) is the time given, cut to
    the microsecond, in UTC (its Location is time.UTC). When the setup's Configure gives a server
    Files, a file put with such a time, and one put with none, is answered (Stat, Open) in UTC:
    to any precision, as the Files contract says.
(b) Five operations are answered (their replies kept) and three begun (never answered) before a
    time, at times of their own, and one of each after it. ForgetOperations before that time,
    with a limit of two, forgets the two oldest of each sort and answers 4; called again, the
    next two replies and the last operation begun, and answers 3; again, the last reply, and
    answers 1; again, nothing, and answers 0. Operation answers ErrNotFound for a reply
    forgotten, and Begin of a key forgotten keeps it again; the ones after the time are kept.
(c) Seven operations are answered and seven begun, by five people, before all of (b): six of
    each at one time, and one a minute before them, whose person and key come after others. They
    are kept in the reverse of the order the store forgets them in, and the people and the keys
    are in other orders in a database's collation of a language than as Go compares strings:
    "Zoe" and "ann", "Key-2" and "key-1", "fay" and "éva". ForgetOperations with a limit of two
    forgets the older one first, then those of the one time by person, then by key, as Go
    compares strings (byte by byte), two of each sort at a time: it answers 4, 4, 4, 2 and 0.
(d) The uploads people made once for a key (Upload.Key). The second of a person's with one key is
    not recorded and is answered the first one's ID, past the person's limit too, and after a move
    holds the first; the same key is another upload of another person, and uploads with no key are
    each recorded. Of twenty kept at once with one key, with a limit of one and with none, one is
    recorded and each of the twenty is answered its ID. An upload let go is its key's no more:
    UploadOf answers ErrNotFound, and the next one kept with the key is recorded.
(e) The thing to do of (a), done at a time in that zone, is answered with DoneAt that time, cut to
    the microsecond, in UTC. What its work said (KeepOutcome) is answered as it was given, with
    OutcomeAt likewise, by ToDoItem and ToDoList; what it says again replaces it. What the work
    of another thing to do said before it was marked done stays when it is (a work may say it
    from Launch itself). KeepOutcome of an ID no thing to do has answers ErrNotFound.

func MineOrder

func MineOrder(t *testing.T, s Setup)

MineOrder checks the order of a person's own requests (Store.Mine, Server.Mine and the API's list_mine), and their counts (Server.CountMine). The order is the newest first, by when each was made (the first move that names the person as one whose request it is, kept to the microsecond), and requests of one time by ID, from the highest. Tickets of the vectors are put in a store emptied for it (Import) as one person's requests, of two kinds when the vectors have two, some back with the person, some done:

  • one, then two at one time, then two less than a microsecond apart (of one time, as a store keeps times; the later of the two with the lower ID), then one; the tickets of one time put in with the lower ID first, so that a store that reads them in the order it was given them, or by the time alone, fails;
  • one of another person.

Of the ones back with the person, two name who sent them back, who has no request of their own, and one the person took back. Then one that was sent back is withdrawn. Before and after it:

(a) Store.Mine reads the person's in that order, and so do its pages (Limit, and Before the last
    ticket of the page before), Kind and Status; the other person's is not read, and nothing
    of the one who sent some back;
(b) Server.Mine answers them in that order, a page at a time too;
(c) the API's list_mine answers them in that order a page at a time, each page saying whether
    the list holds more after it (`more`): not on the last, though as full as its limit;
(d) Server.CountMine answers how many of the person's there are by kind and by status, and how
    many were sent back, and so does the store's CountMine when the store is a
    server.MineCounter; for one with none, none.

It needs the vectors to have a ticket at a stage with an open part.

func Reminded

func Reminded(t *testing.T, s Setup)

Reminded checks that a store keeps whether a stage's reminder has rung (the stage's `reminded`, which contract 3 gives every stage; ringi's DESIGN 12.2) as the entries answer it, and reads it back so. It takes a kind whose vectors pause a stage, and the vector of a clock that rings the reminder of that stage (its ticket's `reminded` false, the ticket it answers true):

(a) The vector's ticket is put in a store (Import) and the clock is given to it (Deliver): the
    store keeps the ticket the vector answers, the stage's `reminded` true.
(b) One the stage waits for pauses the ticket through the API, a minute later, and resumes it,
    a minute after that: each is taken, and the store keeps the ticket the API answered, the
    stage's `reminded` true (a reminder that has rung is not set again when the stage is resumed).

It fails when no kind of the packages has such vectors.

func Summary

func Summary(cs []Counts) string

Summary writes the counts as lines, for a test's log.

func TicketsOrder

func TicketsOrder(t *testing.T, s Setup)

TicketsOrder checks the order of the requests of a kind (Store.Tickets, Server.Tickets and the API's list_tickets). The order is the newest first, by when each was made (the time of its first move, kept to the microsecond), and requests of one time by ID, from the highest. Tickets of the vectors are put in a store emptied for it (Import), of two kinds when the vectors have two, the requests of several people, some back with their requester, some done:

  • one, then two at one time, then two less than a microsecond apart (of one time, as a store keeps times; the later of the two with the lower ID), then one; the tickets of one time put in with the lower ID first, so that a store that reads them in the order it was given them, or by the time alone, fails;
  • one of the other kind among them, when the vectors have two kinds.

Then the newest is withdrawn, a minute after the last was made. Before and after it:

(a) Store.Tickets reads the kind's in that order, and so do its pages (Limit, and Before the last
    ticket of the page before) and Status; it reads none of the other kind, none of a version it
    is not given, none when it is given no version, and none after a Before of the other kind;
(b) Server.Tickets answers them in that order, a page at a time too: the server's gate
    (server.AllowAll) lets everyone see every ticket;
(c) the API's list_tickets answers them in that order a page at a time, each page saying whether
    the list holds more after it (`more`): not on the last, though as full as its limit.

It needs the vectors to have a ticket at a stage with an open part.

func WaitingCounts

func WaitingCounts(t *testing.T, s Setup)

WaitingCounts checks Server.CountWaiting, the counts the start page of the pages shows, against Server.Waiting. Tickets of the vectors of two kinds are put in with the approvers of their open parts written over, so that they wait for a person, for the people the person stands in for as a proxy (one from a day through a day, for every kind; one from that day on, for the first kind alone), for the person and one of them at once, and for others; then two of them move on, one to wait for someone else and one to wait for no one. On days before, in and after the proxies' days:

(a) when the store is a server.WaitingCounter, its count for each person is what its Waiting
    reads for the person alone, counted by kind;
(b) for each person, Server.CountWaiting is what Server.Waiting answers, counted by kind;
(c) the counts are the ones the case says: a ticket that waits for the person and for one they
    stand in for is counted once, none is counted for a proxy outside its days, of a kind it does
    not name or of a submit proxy, and a ticket that moved on is counted for the people it waits
    for now.

The people of the case are added to each version of the organization, each a member of its first team at the lowest position, as a proxy's row names people of the organization (DESIGN 13.3).

It needs the vectors of two kinds to have a ticket at a stage, with an open part.

func WaitingOrder

func WaitingOrder(t *testing.T, s Setup)

WaitingOrder checks the order of the tickets that wait for people (Store.Waiting, Server.Waiting and the API's list_waiting): the newest first, by when each began to wait (TicketRecord.Since, kept to the microsecond), and tickets of one time by ID, from the highest; and that a move that leaves a ticket where it was leaves that time as it was. Tickets of the vectors are put in a store emptied for it (Import), with their times and their IDs in other orders, and the tickets of one time put in with the lower ID first, so that a store that reads them in the order it was given them fails:

  • four at a stage, with the approvers of their open parts written over, so that they wait for one person, and the times their stages started written over: two started at one time;
  • four back with their requester, put in at four times (a ticket back with its requester waits since it came back: here, since it was put in), two of them less than a microsecond apart: of one time, as a store keeps times, the later of the two with the lower ID;
  • one that waits for no one.

Then:

(a) each ticket's Since (Store.Ticket) is when it began to wait, cut to the microsecond, and zero
    for the one that waits for no one;
(b) Store.Waiting reads them in that order, for each of the two people and for both at once, and
    so do its pages (Limit, and Before the last ticket of the page before) and Kind;
(c) Server.Waiting answers them in that order, a page at a time too;
(d) the ticket that came back first is given a comment of the vectors that leaves a ticket back
    with its requester, through the API, after all those times: it is taken, and the ticket's
    Since, and its place in (b) and (c), are as they were;
(e) the API's list_waiting answers them in that order a page at a time (apiPages), each page
    saying whether the list holds more after it (`more`).

It needs the vectors to have a ticket at a stage with an open part, and a comment taken on a ticket back with its requester that leaves it there.

Types

type Counts

type Counts struct {
	Kind     string
	Vectors  int
	Agree    int
	HTTP     int
	Deliver  map[string]int
	Failures []string
	// Bodies are the vectors whose bodies the API answered 400, with the answer.
	Bodies []string
}

Counts are what Vectors ran: of each kind, how many vectors, how many agreed, and how they went in.

func Trials

func Trials(t *testing.T, s Setup) []Counts

Trials checks Server.Try against Server.Do with the vectors: each vector whose event is a person's operation (the ones Vectors sends through the HTTP API) is tried, then done, on a server of its own. Try must answer what Do then answers, and keep nothing: the ticket, its moves, its timers and things to do, the person's key, the books' calls, the notices and the audit log are as they were before it. The store must be a server.TrialStore, so that the books are asked (no call is left NotAsked). It answers the counts of each kind: Vectors are the vectors tried, Agree the ones that agree, and Deliver the ones that are not a person's operation, by why.

func Vectors

func Vectors(t *testing.T, s Setup) []Counts

Vectors gives every vector of the packages to a server through its API and checks the answers: a refusal of the same kind, or the same ticket and the same things to do, kept by the store. It checks the part of the organization the kind's entry was called with too: the vector's, cut as ringi's DESIGN 7.5 says. A person's operation goes through the HTTP handler, and each answer the handler gives must be of the shape the contract gives it (Package.CheckAnswer); a timer, a flow's answer, an administrator's operation with no person, and a body the API does not take (answered 400) go through Deliver. It answers the counts of each kind.

func Worked

func Worked(t *testing.T, s Setup) []Counts

Worked gives each vector of what a form works out (requests/vectors/worked/) to a server and checks the answers: through the API's worked_<name> (POST /requests/<name>/worked) where the version is the one a new request takes on the day of the vectors (2026-11-16, at 10:00 in the kind's offset), else through Server.Worked, the way the pages ask it. Each answer must be the vector's, as JSON, and of the shape the contract gives it (Package.CheckAnswer). A package whose kinds have no Worked entry has no such vectors; one whose kinds have one and no vectors fails. It answers the counts of each kind.

type Setup

type Setup struct {
	// Packages are the generated packages; their vectors (requests/vectors/) are the tests.
	Packages []*server.Package
	// Store gives an empty store. It is called for each vector, and for each run of Concurrent.
	Store func(t testing.TB) server.Store
	// Organization reads the organization's data the vectors were written with.
	Organization server.OrgSource
	// Configure, when set, completes each server's configuration (Files, BooksApart…).
	Configure func(*server.Config)
	// Kinds, when set, names the kinds whose vectors are run; else all.
	Kinds []string
}

Setup is what the conformance tests are given.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL