testutil

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AdminToken = "123e4567-e89b-12d3-a456-426614174000"

Variables

This section is empty.

Functions

func ConsulACLConfigFn

func ConsulACLConfigFn(c *testutil.TestServerConfig)

ConsulACLConfigFn configures a Consul test server with ACLs.

func ConsulServer

func ConsulServer(t *testing.T, cb testutil.ServerConfigCallback) *api.Config

ConsulServer initializes a Consul test server and returns Consul client config.

func SetECSConfigEnvVar

func SetECSConfigEnvVar(t *testing.T, val interface{})

SetECSConfigEnvVar the CONSUL_ECS_CONFIG_JSON environment variable to the JSON string of the provided value, with a test cleanup.

func TaskMetaHandler

func TaskMetaHandler(t *testing.T, resp string) http.Handler

TaskMetaHandler returns an http.Handler that always responds with the given string for the 'GET /task' request of the ECS Task Metadata server.

func TaskMetaHandlerFn

func TaskMetaHandlerFn(t *testing.T, respFn func() string) http.Handler

TaskMetaHandler wraps the respFn in an http.Handler for the ECS Task Metadata server. respFn should return a response to the 'GET /task' request.

func TaskMetaServer

func TaskMetaServer(t *testing.T, handler http.Handler)

TaskMetaServer starts a local HTTP server to mimic the ECS Task Metadata server. This sets ECS_CONTAINER_METADATA_URI_V4 and configures a test cleanup. Because of the environment variable, this is unsafe for running tests in parallel.

func TempDir

func TempDir(t *testing.T) string

TempDir creates a temporary directory. A test cleanup removes the directory and its contents.

Types

This section is empty.

Jump to

Keyboard shortcuts

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