helpers

package
v0.0.0-...-41d7134 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeTasks

func DescribeTasks(t *testing.T, clusterARN, region, taskARN string) (*ecs.DescribeTasksOutput, error)

func ExecuteRemoteCommand

func ExecuteRemoteCommand(t *testing.T, testConfig *config.TestConfig, clusterARN, taskARN, container, command string) (string, error)

ExecuteRemoteCommand executes a command inside a container in the task specified by taskARN.

func GetTaskIDFromARN

func GetTaskIDFromARN(taskARN string) string

func StopTask

func StopTask(t *testing.T, clusterARN, region, taskARN, reason string) string

Types

type ListTasksResponse

type ListTasksResponse struct {
	TaskARNs []string `json:"taskArns"`
}

func ListTasks

func ListTasks(t *testing.T, clusterARN, region, family string) (*ListTasksResponse, error)

type LogEvent

type LogEvent struct {
	Timestamp time.Time
	Message   string
}

type LogMessages

type LogMessages []LogEvent

func GetCloudWatchLogEvents

func GetCloudWatchLogEvents(t terratestTesting.TestingT, testConfig *config.TestConfig, clusterARN, taskId, containerName string) (LogMessages, error)

GetCloudWatchLogEvents fetches all log events for the given container.

func (LogMessages) Duration

func (lm LogMessages) Duration() time.Duration

Duration returns the difference between the max and min log timestamps. Returns a zero duration if there are zero or one log events.

func (LogMessages) Filter

func (lm LogMessages) Filter(filterStrings ...string) LogMessages

Filter returns those log events that contain any of the filterStrings.

func (LogMessages) Sort

func (lm LogMessages) Sort()

Sort will sort these log events by timestamp.

type MeshTask

type MeshTask struct {
	MeshTaskConfig
	// contains filtered or unexported fields
}

MeshTask represents a Consul ECS mesh task and provides utility functions for interacting with it.

func NewMeshTask

func NewMeshTask(t *testing.T, cfg MeshTaskConfig) *MeshTask

NewMeshTask creates an instance of a MeshTask. It returns an error if any required configuration fields are missing.

func (*MeshTask) ExecuteCommand

func (task *MeshTask) ExecuteCommand(container, command string) (string, error)

ExecuteCommand runs the command in the given container for the task.

func (*MeshTask) Healthy

func (task *MeshTask) Healthy() bool

Healthy indicates if all the service checks for the task are passing.

func (*MeshTask) QueryOpts

func (task *MeshTask) QueryOpts() *api.QueryOptions

QueryOpts returns the Consul API query options for the task.

func (*MeshTask) Registered

func (task *MeshTask) Registered() bool

Registered indicates if the service for the task is registered in Consul.

func (*MeshTask) TaskARN

func (task *MeshTask) TaskARN() (string, error)

TaskARN returns the ARN of the task instance for the service. If the ARN is already known it is returned, otherwise it is retrieved using the aws CLI using the properties of the service.

func (*MeshTask) WriteOpts

func (task *MeshTask) WriteOpts() *api.WriteOptions

WriteOpts returns the Consul API write options for the task.

type MeshTaskConfig

type MeshTaskConfig struct {
	ConsulClient *api.Client
	Name         string
	Partition    string
	Namespace    string
	Region       string
	ClusterARN   string
}

MeshTaskConfig holds the configuration for a Consul ECS MeshTask.

Jump to

Keyboard shortcuts

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