Help us shape the future of Go! Take the 2026 Go Developer Survey

testutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2015 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForLeader

func WaitForLeader(t *testing.T, rpc rpcFn)

func WaitForResult

func WaitForResult(test testFn, error errorFn)

Types

type ClientConfig

type ClientConfig struct {
	Enabled bool `json:"enabled"`
}

ClientConfig is used to configure the client

type PortsConfig

type PortsConfig struct {
	HTTP int `json:"http,omitempty"`
	RPC  int `json:"rpc,omitempty"`
	Serf int `json:"serf,omitempty"`
}

Ports is used to configure the network ports we use.

type ServerConfig

type ServerConfig struct {
	Enabled         bool `json:"enabled"`
	BootstrapExpect int  `json:"bootstrap_expect"`
}

ServerConfig is used to configure the nomad server.

type ServerConfigCallback

type ServerConfigCallback func(c *TestServerConfig)

ServerConfigCallback is a function interface which can be passed to NewTestServerConfig to modify the server config.

type TestServer

type TestServer struct {
	PID    int
	Config *TestServerConfig

	HTTPAddr   string
	SerfAddr   string
	HttpClient *http.Client
	// contains filtered or unexported fields
}

TestServer is the main server wrapper struct.

func NewTestServer

func NewTestServer(t *testing.T, cb ServerConfigCallback) *TestServer

NewTestServerConfig creates a new TestServer, and makes a call to an optional callback function to modify the configuration.

func (*TestServer) Stop

func (s *TestServer) Stop()

Stop stops the test Nomad server, and removes the Nomad data directory once we are done.

type TestServerConfig

type TestServerConfig struct {
	NodeName          string        `json:"name,omitempty"`
	DataDir           string        `json:"data_dir,omitempty"`
	Region            string        `json:"region,omitempty"`
	DisableCheckpoint bool          `json:"disable_update_check"`
	LogLevel          string        `json:"log_level,omitempty"`
	Ports             *PortsConfig  `json:"ports,omitempty"`
	Server            *ServerConfig `json:"server,omitempty"`
	Client            *ClientConfig `json:"client,omitempty"`
	DevMode           bool          `json:"-"`
	Stdout, Stderr    io.Writer     `json:"-"`
}

TestServerConfig is the main server configuration struct.

Jump to

Keyboard shortcuts

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