package
1.21.0
Repository: https://github.com/aws/amazon-ecs-cli.git
Documentation: pkg.go.dev

# README

Amazon ECS CLI - Integration Tests

This directory contains tests intended to run against public Amazon Elastic Container Service endpoints and other AWS Services. They are meant to test end-to-end functionality by executing commands as an ecs-cli user would.

You may be charged for the AWS resources utilized while running these tests. It's not recommended to run these on an AWS account handling production work-loads.

Local test setup

  1. Set the following mandatory environment variables:

    # hardcode the CodeBuild ID since we're not using codebuild to run the tests
    export CODEBUILD_BUILD_ID="local-integ-test"
    # change this to the region you'd like to run the tests in
    export AWS_REGION="us-east-1"
    
  2. If your OS doesn't support the TMPDIR environment variable, then set it:

    # If your OS sets TMPDIR, you should get an output like /var/folders/13/y9bcvw7557d5bvlvrj8jz0k04gs5dl/T/
    echo $TMPDIR
    # Otherwise set the environment to a location of your choice
    export $TMPDIR="/tmp"
    

Running the tests

Linux

The best way to run them on Linux is via the make integ-test target.

A full example including setting necessary environment variables inline:

CODEBUILD_BUILD_ID=local-integ-test AWS_REGION=us-east-1 TMPDIR=/tmp make integ-test

Windows

The best way to run them on Windows is by building and running the tests with go from the project root:

  • go build -installsuffix cgo -a -ldflags '-s' -o ./bin/local/ecs-cli.exe ./ecs-cli/
  • go test -tags integ -v ./ecs-cli/integ/...

# Packages

Package cfn contains validation functions against a CloudFormation stack.
Package cmd contains ECS CLI command tests.
Package ecs contains validation functions against resources in ECS.

# Functions

GetCommand returns a Cmd struct with the right binary path & arguments.
GetRowValues takes a row of stdout and returns a slice of strings split by arbirary whitespace.
RetryUntilTimeout retries function f every sleepInS seconds until the timeoutInS expires.
RunCmd runs a command with args and returns its Stdout.
SuggestedResourceName returns a resource name matching the template "{CODEBUILD_BUILD_ID}-{identifier}".