testonly

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartFakeAdminServer

func StartFakeAdminServer(server *FakeAdminServer) (net.Listener, func(), error)

StartFakeAdminServer starts a FakeAdminServer on a random port. Returns the started server, the listener it's using for connection and a close function that must be defer-called on the scope the server is meant to stop.

Types

type FakeAdminServer

type FakeAdminServer struct {
	trillian.TrillianAdminServer

	// Err will be returned by CreateTree if not nil.
	Err error
	// GeneratedKey will be used to set a tree's PrivateKey if a CreateTree request has a KeySpec.
	// This is for simulating key generation.
	GeneratedKey *any.Any
}

FakeAdminServer implements the TrillianAdminServer CreateTree RPC. The remaining RPCs are not implemented.

func (*FakeAdminServer) CreateTree

CreateTree returns req.Tree, unless s.Err is not nil, in which case it returns s.Err. This allows tests to examine the requested tree and check behavior under error conditions. If s.GeneratedKey and req.KeySpec are not nil, the returned tree will have its PrivateKey field set to s.GeneratedKey.

Jump to

Keyboard shortcuts

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