Skip to content

Commit

Permalink
mocks: update list, fix unexported interfaces in bfd (#3878)
Browse files Browse the repository at this point in the history
  • Loading branch information
matzf authored Sep 18, 2020
1 parent 66755a2 commit b5c427e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
2 changes: 0 additions & 2 deletions go/pkg/router/bfd/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,4 @@ type (
DefaultIntervalGenerator = defaultIntervalGenerator
State = state
Event = event
Source = source
IntervalGenerator = intervalGenerator
)
8 changes: 4 additions & 4 deletions go/pkg/router/bfd/jitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (
// periodic BFD Control packets should be reduced by. If gen is nil, math/rand is used
// for randomness.
func computeInterval(transmitInterval time.Duration, detectMult uint,
gen intervalGenerator) time.Duration {
gen IntervalGenerator) time.Duration {

if transmitInterval <= 0 {
panic("transmission interval must be > 0")
Expand All @@ -65,7 +65,7 @@ func computeInterval(transmitInterval time.Duration, detectMult uint,
}

// IntervalGenerator generates integers in [x, y). It panics if x < 0 or if y <= x.
type intervalGenerator interface {
type IntervalGenerator interface {
Generate(x, y int) int
}

Expand All @@ -78,7 +78,7 @@ type defaultIntervalGenerator struct {
// Source is used for pseudorandomness. Implementations do
// not need to be strong enough for use in cryptography. If nil,
// the default random number generator in package rand is used.
Source source
Source Source
}

// Generate returns pseudorandom integers from [x, y). Generate panics
Expand All @@ -101,6 +101,6 @@ func (g defaultIntervalGenerator) intn(n int) int {

// Source is an pseudorandom number generator interface that is
// satisfied by package math/rand's Rand type.
type source interface {
type Source interface {
Intn(n int) int
}
24 changes: 15 additions & 9 deletions tools/gomocks
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,49 @@ from plumbum import local
from plumbum.cmd import cp, mkdir, rm, chmod

MOCK_TARGETS = [
("go/border/rctrl/grpc", "IfStateHandler"),
("go/cs/beacon", "DB,Transaction"),
("go/cs/beaconing",
"BeaconInserter,BeaconProvider,BeaconSender,RPC,SegmentProvider,SegmentStore"),
("go/cs/ifstate", "InterfaceStateSender,RevInserter"),
("go/cs/keepalive", "IfStatePusher,RevDropper"),
("go/cs/reservationstorage/backend", "DB,Transaction"),
("go/cs/revocation", "Store"),
("go/cs/segutil", "Policy"),
("go/hidden_path_srv/internal/registration", "Validator"),
("go/hidden_path_srv/internal/hpsegreq", "Fetcher"),
("go/hidden_path_srv/internal/registration", "Validator"),
("go/lib/ctrl/seg", "Signer"),
("go/lib/infra", "Messenger,ResponseWriter,Verifier,Handler"),
("go/lib/infra/messenger", "LocalSVCRouter,Resolver"),
("go/lib/infra", "Messenger,ResponseWriter,Verifier,Handler"),
("go/lib/infra/modules/segfetcher",
"DstProvider,ReplyHandler,Requester,RequestAPI,Resolver,Splitter,LocalInfo"),
"DstProvider,ReplyHandler,Requester,Resolver,RPC,Splitter,LocalInfo"),
("go/lib/infra/modules/seghandler", "Storage,Verifier"),
("go/lib/l4", "L4Header"),
("go/lib/pathdb", "PathDB,Transaction,ReadWrite"),
("go/lib/pathmgr", "Policy,Querier,Resolver"),
("go/lib/periodic/internal/metrics", "ExportMetric"),
("go/lib/pktcls", "Cond"),
("go/lib/revcache", "RevCache"),
("go/lib/sciond", "Service,Connector"),
("go/lib/sciond", "Connector"),
("go/lib/snet",
"PacketDispatcherService,Network,PacketConn,Path,PathQuerier,Router,RevocationHandler"),
"PacketDispatcherService,Network,PacketConn,Path,PathInterface," +
"PathMetadata,PathQuerier,Router,RevocationHandler"),
("go/lib/sock/reliable", "Dispatcher"),
("go/lib/sock/reliable/reconnect", "IOOperation,Reconnecter"),
("go/lib/svc", "RequestHandler,RoundTripper"),
("go/lib/svc/internal/ctxconn", "DeadlineCloser"),
("go/lib/svc", "RequestHandler,RoundTripper"),
("go/lib/topology", "Topology"),
("go/lib/underlay/conn", "Conn"),
("go/lib/xtest", "Callback"),
("go/pkg/cs/trust", "CACertProvider,PolicyGen,SignerGen"),
("go/pkg/cs/trust/grpc", "ChainBuilder,RenewalRequestVerifier,Signer"),
("go/pkg/cs/trust", "CACertProvider,PolicyGen,SignerGen"),
("go/pkg/proto/control_plane",
"ChainRenewalServiceServer,InterfaceStateConsumerServiceServer," +
"InterfaceStateServiceServer,TrustMaterialServiceServer"),
("go/pkg/router/bfd", "Source,IntervalGenerator"),
("go/pkg/router", "BatchConn"),
("go/pkg/sciond/fetcher", "Fetcher,Policy"),
("go/pkg/trust", "DB,Fetcher,Inspector,KeyRing,Provider,Recurser,Router,RPC"),
("go/pkg/trust",
"DB,Fetcher,Inspector,KeyRing,Provider,Recurser,Router,X509KeyPairLoader"),
("go/pkg/trust/renewal", "DB"),
("go/sig/egress/iface", "Session"),
("go/sig/egress/worker", "SCIONWriter"),
Expand Down

0 comments on commit b5c427e

Please sign in to comment.