package testonly
import "github.com/google/trillian/cmd/createtree/testonly"
Index ¶
- func StartFakeAdminServer(server *FakeAdminServer) (net.Listener, func(), error)
- type FakeAdminServer
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 ¶
func (s *FakeAdminServer) CreateTree(ctx context.Context, req *trillian.CreateTreeRequest) (*trillian.Tree, error)
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.
Source Files ¶
- Version
- v1.0.3
- Published
- Nov 17, 2017
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 4 hours ago –
Tools for package owners.