Documentation
¶
Index ¶
- func InitializeCluster(a *assert.Assertions, numNodes int) (cluster *Cluster, nodes []*Node)
- func NewServerForTest(address *kronospb.NodeAddr, clock *tm.ManualClock, oracle oracle.StateMachine, ...) *server.Server
- type Client
- func (c *Client) Close() error
- func (c *Client) KronosTime(ctx context.Context, server *kronospb.NodeAddr) (*kronospb.KronosTimeResponse, error)
- func (c *Client) KronosUptime(ctx context.Context, server *kronospb.NodeAddr) (*kronospb.KronosUptimeResponse, error)
- func (c *Client) OracleTime(ctx context.Context, server *kronospb.NodeAddr) (*kronospb.OracleTimeResponse, error)
- func (c *Client) Status(ctx context.Context, server *kronospb.NodeAddr) (*kronospb.StatusResponse, error)
- type Cluster
- func (tc *Cluster) IsClusterInSync(ctx context.Context, nodes ...*Node) error
- func (tc *Cluster) Node(idx int) *Node
- func (tc *Cluster) RestartNode(ctx context.Context, testNode *Node) *Node
- func (tc *Cluster) Stop()
- func (tc *Cluster) StopNode(ctx context.Context, testNode *Node)
- func (tc *Cluster) Tick(testNode *Node)
- func (tc *Cluster) TickN(testNode *Node, n int)
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeCluster ¶
func InitializeCluster(a *assert.Assertions, numNodes int) (cluster *Cluster, nodes []*Node)
InitializeCluster creates a cluster and sets a different time on each Node
func NewServerForTest ¶
func NewServerForTest( address *kronospb.NodeAddr, clock *tm.ManualClock, oracle oracle.StateMachine, client server.Client, oracleTimeCapDelta time.Duration, oracleUptimeCapDelta time.Duration, ) *server.Server
NewServerForTest returns a Server which can be used in unit tests
Types ¶
type Client ¶
type Client struct { // Latency is the Latency added to each request served Latency time.Duration // contains filtered or unexported fields }
Client is an in memory implementation of Client used in tests This is tested in server_test.go
func (*Client) KronosTime ¶
func (c *Client) KronosTime( ctx context.Context, server *kronospb.NodeAddr, ) (*kronospb.KronosTimeResponse, error)
KronosTime implements the Client interface.
func (*Client) KronosUptime ¶
type Cluster ¶
type Cluster struct { Nodes map[string]*Node StateMachine oracle.StateMachine Client *Client // contains filtered or unexported fields }
Cluster is an in memory Kronos cluster used in tests
func NewKronosCluster ¶
NewKronosCluster returns a new test kronos cluster
func (*Cluster) IsClusterInSync ¶
IsClusterInSync returns whether kronos time is in sync on all the Nodes of the cluster
func (*Cluster) RestartNode ¶
RestartNode replaces the given Node with a new Node
Click to show internal directories.
Click to hide internal directories.