tasktest

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECSAgent

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

ECSAgent is a test server that simulates the ECS Agent metadata API.

func NewECSAgent

func NewECSAgent(t *testing.T) *ECSAgent

NewECSAgent builds a new test server that simulates the ECS Agent metadata API. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint-v4.html

func (*ECSAgent) Close

func (e *ECSAgent) Close()

Close closes the test server.

func (*ECSAgent) GetContainerMetaEndpoint

func (e *ECSAgent) GetContainerMetaEndpoint() string

GetContainerMetaEndpoint returns the container metadata endpoint.

func (*ECSAgent) GetTaskMetaEndpoint

func (e *ECSAgent) GetTaskMetaEndpoint() string

GetTaskMetaEndpoint returns the task metadata endpoint.

func (*ECSAgent) SetMetaURIEnv

func (e *ECSAgent) SetMetaURIEnv() *ECSAgent

SetMetaURIEnv is a helper function to set the server url for ECS_CONTAINER_METADATA_URI_V4 environment variable. This is useful for testing the ECS metadata API.

func (*ECSAgent) Start

func (e *ECSAgent) Start() *ECSAgent

Start starts the test server.

func (*ECSAgent) WithContainerMetaEndpoint

func (e *ECSAgent) WithContainerMetaEndpoint(containerCPU int) *ECSAgent

WithContainerMetaEndpoint sets up the container metadata endpoint on the test server.

func (*ECSAgent) WithContainerMetaEndpointInternalServerError

func (e *ECSAgent) WithContainerMetaEndpointInternalServerError() *ECSAgent

WithContainerMetaEndpointInternalServerError sets up the container metadata endpoint to return an internal server error.

func (*ECSAgent) WithContainerMetaEndpointInvalidJSON

func (e *ECSAgent) WithContainerMetaEndpointInvalidJSON() *ECSAgent

WithContainerMetaEndpointInvalidJSON sets up the container metadata endpoint to return invalid JSON.

func (*ECSAgent) WithTaskMetaEndpoint

func (e *ECSAgent) WithTaskMetaEndpoint(containerCPU, taskCPU int) *ECSAgent

WithTaskMetaEndpoint sets up the task metadata endpoint on the test server.

func (*ECSAgent) WithTaskMetaEndpointInternalServerError

func (e *ECSAgent) WithTaskMetaEndpointInternalServerError() *ECSAgent

WithTaskMetaEndpointInternalServerError sets up the task metadata endpoint to return an internal server error.

func (*ECSAgent) WithTaskMetaEndpointInvalidJSON

func (e *ECSAgent) WithTaskMetaEndpointInvalidJSON() *ECSAgent

WithTaskMetaEndpointInvalidJSON sets up the task metadata endpoint to return invalid JSON.

Jump to

Keyboard shortcuts

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