Help us shape the future of Go! Take the 2026 Go Developer Survey

sessiontest

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sessiontest checks session.Store implementations against the contract the built-in stores follow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newStore func(t *testing.T) session.Store)

Run runs the conformance tests against stores made by newStore, which must return an empty store independent of the others; it is called once per subtest and subtests run in parallel. The contract:

  • Get of a missing session returns session.ErrNotFound; Delete of a missing session succeeds.
  • Save stores a snapshot: messages, state (as JSON values), ID and timestamps round-trip, and later changes to the saved or loaded session are not stored.
  • Each Save increments the stored revision by one, starting at 1, and Get returns the session at its stored revision. A session loaded before its stored copy was deleted is stored again by Save, at the next revision after the one it was loaded at.
  • Saving a session loaded, created by session.GetOrCreate or saved earlier returns session.ErrConflict when the stored session changed since, without changing it; other sessions overwrite. This holds for concurrent saves.
  • List returns every session, most recently updated first, then by ID.
  • IDs are case-sensitive, though a store whose medium cannot tell IDs differing only in case apart may reject the second one; IDs outside the pattern documented on session.Store are rejected by Get, Save and Delete.
  • Payloads of several megabytes are stored.

Types

This section is empty.

Jump to

Keyboard shortcuts

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