testhelper

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatRegistrationResponse

func FormatRegistrationResponse(resp *api.JobRegisterResponse) string

func FormatStopResponse

func FormatStopResponse(resp string) string

func HTTPTest

func HTTPTest(t *testing.T, cb func(c *agent.Config), f func(srv *agent.TestAgent))

HTTPTest generates a non-ACL enabled single node cluster, without automatically enabling test parallelism. This is necessary for any test that uses the environment.

func HTTPTestMultiRegionCluster

func HTTPTestMultiRegionCluster(t *testing.T, cb1, cb2 func(c *agent.Config), f func(s1 *agent.TestAgent, s2 *agent.TestAgent))

HTTPTestMultiRegionCluster generates a multi-region two node cluster, without automatically enabling test parallelism. This is necessary for any test that uses the environment.

func HTTPTestMultiRegionClusterParallel

func HTTPTestMultiRegionClusterParallel(t *testing.T, cb1, cb2 func(c *agent.Config), f func(s1 *agent.TestAgent, s2 *agent.TestAgent))

HTTPTestMultiRegionClusterParallel generates a multi-region two node cluster and automatically enables test parallelism. This will panic on test which use the environment. For those, use httpTestMultiRegionCluster instead.

func HTTPTestParallel

func HTTPTestParallel(t *testing.T, cb func(c *agent.Config), f func(srv *agent.TestAgent))

HTTPTestParallel generates a non-ACL enabled single node cluster and automatically enables test parallelism.

func HTTPTestWithACL

func HTTPTestWithACL(t *testing.T, cb func(c *agent.Config), f func(srv *agent.TestAgent))

HTTPTestWithACL generates an ACL enabled single node cluster, without automatically enabling test parallelism. This is necessary for any test that uses the environment.

func HTTPTestWithACLParallel

func HTTPTestWithACLParallel(t *testing.T, cb func(c *agent.Config), f func(srv *agent.TestAgent))

HTTPTestWithACLParallel generates a ACL enabled single node cluster and automatically enables test parallelism.

func MakeTestNamespaces

func MakeTestNamespaces(t *testing.T, c *api.Client)

func NewTestClient

func NewTestClient(testAgent *agent.TestAgent) (*api.Client, error)

func NomadCleanup

func NomadCleanup(s *agent.TestAgent) (error, error)

func NomadJobStatus

func NomadJobStatus(s *agent.TestAgent, jobID string) (*api.Job, error)

func NomadPurge

func NomadPurge(s *agent.TestAgent, jobID string) error

func NomadRun

func NomadRun(s *agent.TestAgent, path string) error

func NomadStop

func NomadStop(s *agent.TestAgent, jobID string) error

func WithAgentConfig

func WithAgentConfig(opts ...AgentOption) func(*agent.Config)

WithAgentConfig creates a callback function that applies all of the provided AgentOptions to the agent.Config.

func WithDefaultConfig

func WithDefaultConfig() func(c *agent.Config)

WithDefaultConfig provides an agent.Config callback that generally applies across all tests

Types

type AgentOption

type AgentOption func(*agent.Config)

AgentOption is a functional option used as an argument to `WithAgentConfig`

func ACLEnabled

func ACLEnabled() AgentOption

ACLEnabled is an AgentOption used to configure the TestServer with ACLs enabled. Once started, this agent will need to have the ACLs bootstrapped.

func LogLevel

func LogLevel(level string) AgentOption

LogLevel is an AgentOption used to control the log level of the TestServer

func Region

func Region(name string) AgentOption

Region is an AgentOption used to control the log level of the TestServer

func TLSEnabled

func TLSEnabled() AgentOption

TLSEnabled is an AgentOption used to configure the TestServer with a set of test mTLS certificates.

Jump to

Keyboard shortcuts

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