Documentation
¶
Overview ¶
Package remotetest is an in-memory ZenNotes server for tests: the note routes a read, change and write needs, with or without conditional note writes (znserver supportsConditionalNoteWrites).
Index ¶
Constants ¶
const BinaryEnv = "ZENNOTES_SERVER_CONTRACT_BINARY"
BinaryEnv names a ZenNotes server binary for the tests that run against a real server; CI's server-contract job sets it from the server's main.
Variables ¶
This section is empty.
Functions ¶
func StartBinary ¶
StartBinary runs the server binary on loopback over vaultRoot, with its configuration in a temporary directory and token as its auth token, and returns its base URL once it answers. The process stops with the test.
Types ¶
type Proxy ¶
Proxy forwards to a server and runs BeforeWrite before it forwards each note write, for a test to land another client's save in between a read and the write that follows it.
func (*Proxy) SetBeforeWrite ¶
func (p *Proxy) SetBeforeWrite(hook func())
SetBeforeWrite replaces the hook.
func (*Proxy) WriteStatuses ¶
WriteStatuses lists the status the server gave each note write, in order.
type Server ¶
type Server struct {
*httptest.Server
// Conditional is a server that hands out sha256 and honours baseSha256.
// Without it the server is an older one: no hash, base ignored.
Conditional bool
// BeforeWrite runs before each write is applied, for a test to land a save
// from another device in between a read and a write (with Set).
BeforeWrite func(path string)
// contains filtered or unexported fields
}
Server holds notes by vault-relative path.