Documentation
¶
Overview ¶
Package testinstance builds an initialized instance for tests of the HTTP layers (API, web UI): init --demo with the test CA, the services wired like the server does, a fake clock and helpers for users and TOTP codes. It is imported by tests only.
Index ¶
Constants ¶
const BrowserOrigin = "https://pki.homelab.lan:9443"
BrowserOrigin is where the tests' browser runs (passkeys, step 17).
const Password = "a long password for the HTTP tests"
Password is the password of every user made with User.
Variables ¶
var Console = keys.Who{Actor: audit.Actor{Type: audit.ActorUser, Name: "console:test"}, Principal: authz.Console()}
Console is the console operator of the tests.
Functions ¶
func Audit ¶
Audit lists "action/result" of an audit log (direct entries are there at once; outbox entries need a delivery, which these tests don't run).
Types ¶
type Instance ¶
type Instance struct {
Auth *auth.Service
Engine *ca.Engine
Ring *keys.Keyring
Presets *preset.Set
Clock *clock.Fake
// SystemDB, InstanceAudit, TenantAudit and PKIDB are open for checks.
SystemDB, InstanceAudit, TenantAudit, PKIDB *store.DB
// Config is the configuration init ran with (data directory, auth key).
Config config.Config
Passphrase string // unseal passphrase
DemoPassword string // password of the init user "demo"
CAIDs map[string]string
// contains filtered or unexported fields
}
Instance is an initialized instance, sealed.
func New ¶
New runs init --demo with the test CA and wires the services. The clock is not on a whole second: the engine works in seconds, sessions in milliseconds, and the tests must see both.
func (*Instance) Deliver ¶
Deliver moves the outbox entries of system.db and pki.db into their audit logs, as the server's deliverer does.