test

package
v0.0.0-...-975194c Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(checkTimeout time.Duration, binaryLocation string, redundancy, numberOfNodes int) (*Cluster, error)

func (*Cluster) CreateFile

func (c *Cluster) CreateFile(fileName string, node int) (*os.File, error)

CreateFIle creates a file for reading and writing with the node with index node (which starts from 0).

func (*Cluster) DeleteFile

func (c *Cluster) DeleteFile(fileName string, node int) error

func (*Cluster) Destroy

func (c *Cluster) Destroy() error

func (*Cluster) FileContains

func (c *Cluster) FileContains(fileName string, contents []byte) Diff

FileContains checks if all the nodes in the cluster have the same contents for a file. If the files aren't consistent with what is expected within the checkTimout, an error is returned.

func (*Cluster) FileDoesntExist

func (c *Cluster) FileDoesntExist(fileName string) Diff

func (*Cluster) FileExists

func (c *Cluster) FileExists(fileName string) Diff

func (*Cluster) OpenFile

func (c *Cluster) OpenFile(fileName string, node int) (*os.File, error)

OpenFile opens a file for reading and writing with the node with index node (which starts from 0).

func (*Cluster) RenameFile

func (c *Cluster) RenameFile(fileName, newName string, node int) error

func (*Cluster) Start

func (c *Cluster) Start() error

func (*Cluster) StartNode

func (c *Cluster) StartNode(node int) error

func (*Cluster) StopNode

func (c *Cluster) StopNode(node int) error

func (*Cluster) WaitReady

func (c *Cluster) WaitReady(duration time.Duration) error

type Diff

type Diff interface {
	HasDiff() bool
	Diff() string
}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(binaryLocation string, cfg spork.Config, out io.Writer) (*Node, error)

NewNode returns a node that uses the spork binary to run nodes. The binary's stdout & stderr are redirected into out.

func (*Node) CreateFile

func (n *Node) CreateFile(fileName string) (*os.File, error)

func (*Node) DeleteFile

func (n *Node) DeleteFile(fileName string) error

func (*Node) Destroy

func (n *Node) Destroy() error

func (*Node) FileDiff

func (n *Node) FileDiff(fileName string, contents []byte) Diff

func (*Node) FileDoesntExist

func (n *Node) FileDoesntExist(fileName string) Diff

func (*Node) FileExists

func (n *Node) FileExists(fileName string) Diff

func (*Node) OpenFile

func (n *Node) OpenFile(fileName string) (*os.File, error)

func (*Node) Ready

func (n *Node) Ready() <-chan struct{}

Ready returns a channel that will be closed iff the node hasn't had any log activity in the last two seconds (= activityTimeout)

func (*Node) RenameFile

func (n *Node) RenameFile(fileName, newName string) error

func (*Node) Start

func (n *Node) Start() error

func (*Node) Stop

func (n *Node) Stop() error

Stop sends a stop signal to spork and waits for it to terminate.

func (*Node) Stopped

func (n *Node) Stopped() bool

Jump to

Keyboard shortcuts

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