package integration
import "github.com/google/trillian/testonly/integration"
Package integration provides test-only code for performing integrated tests of Trillian functionality.
Index ¶
- Variables
- func GetTestDB(testID string) (*sql.DB, error)
- func NewRegistryForTests(testID string) (extension.Registry, error)
- type LogEnv
- func NewLogEnv(ctx context.Context, numSequencers int, testID string) (*LogEnv, error)
- func NewLogEnvWithRegistry(ctx context.Context, numSequencers int, testID string, registry extension.Registry) (*LogEnv, error)
- func (env *LogEnv) Close()
- func (env *LogEnv) CreateLog() (int64, error)
- type MapEnv
Variables ¶
var ( // SequencerInterval is the time between runs of the sequencer. SequencerInterval = 100 * time.Millisecond )
Functions ¶
func GetTestDB ¶
GetTestDB drops and recreates the test database. Returns a database connection to the test database.
func NewRegistryForTests ¶
NewRegistryForTests returns an extension.Registry for integration tests. A new database will be recreated, as per GetTestDB.
Types ¶
type LogEnv ¶
type LogEnv struct { LogOperation server.LogOperation Sequencer *server.LogOperationManager ClientConn *grpc.ClientConn DB *sql.DB // PublicKey is the public key that verifies responses from this server. PublicKey crypto.PublicKey // contains filtered or unexported fields }
LogEnv is a test environment that contains both a log server and a connection to it.
func NewLogEnv ¶
NewLogEnv creates a fresh DB, log server, and client. The numSequencers parameter indicates how many sequencers to run in parallel; if numSequencers is zero a manually-controlled test sequencer is used. testID should be unique to each unittest package so as to allow parallel tests.
func NewLogEnvWithRegistry ¶
func NewLogEnvWithRegistry(ctx context.Context, numSequencers int, testID string, registry extension.Registry) (*LogEnv, error)
NewLogEnvWithRegistry uses the passed in Registry to create a log server, and client. The numSequencers parameter indicates how many sequencers to run in parallel; if numSequencers is zero a manually-controlled test sequencer is used. testID should be unique to each unittest package so as to allow parallel tests.
func (*LogEnv) Close ¶
func (env *LogEnv) Close()
Close shuts down the server.
func (*LogEnv) CreateLog ¶
CreateLog creates a log and signs the first empty tree head.
type MapEnv ¶
type MapEnv struct { // Objects that need Close(), in order of creation. DB *sql.DB // Public fields MapClient trillian.TrillianMapClient AdminClient trillian.TrillianAdminClient // contains filtered or unexported fields }
MapEnv is a map server and connected client.
func NewMapEnv ¶
NewMapEnv creates a fresh DB, map server, and client.
func NewMapEnvFromConn ¶
NewMapEnvFromConn connects to a map server.
func NewMapEnvWithRegistry ¶
func NewMapEnvWithRegistry(ctx context.Context, testID string, registry extension.Registry) (*MapEnv, error)
NewMapEnvWithRegistry uses the passed in Registry to create a map server and client. testID should be unique to each unittest package so as to allow parallel tests.
func (*MapEnv) Close ¶
func (env *MapEnv) Close()
Close shuts down the server.
Source Files ¶
db.go logenv.go mapenv.go port.go registry.go
Directories ¶
Path | Synopsis |
---|---|
testonly/integration/etcd |
- Version
- v1.0.2
- Published
- Oct 10, 2017
- Platform
- js/wasm
- Imports
- 27 packages
- Last checked
- 2 hours ago –
Tools for package owners.