Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/go-test-bootstrap/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Set up Go test environment
description: Sets up Go from go.mod and installs Ginkgo.

runs:
using: 'composite'
steps:
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod

- name: Install Ginkgo
shell: bash
run: go install github.com/onsi/ginkgo/v2/ginkgo@latest
16 changes: 9 additions & 7 deletions .github/actions/s3-integration-run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ inputs:
description: 'AWS Region Name'
required: true
stack_name:
description: 'CloudFormation Stack Name (required for IAM tests)'
required: true
description: 'CloudFormation Stack Name'
required: false
default: ''
test_type:
description: 'Type of test to run (e.g.,aws, aws-iam, aws-assume)'
required: true
focus_regex:
description: 'Ginkgo Focus Regex for tests to run'
required: false
label_filter:
description: 'Ginkgo Label Filter for tests to run'
required: true
s3_endpoint_host:
description: 'Custom S3 Endpoint Host'
required: false
Expand All @@ -43,15 +44,16 @@ runs:
if [[ "${{inputs.test_type}}" == "aws" ]]; then
export role_arn="${{inputs.role_arn}}"
export s3_endpoint_host="${{inputs.s3_endpoint_host}}"
export focus_regex="${{inputs.focus_regex}}"
export label_filter="${{inputs.label_filter}}"
echo "Running standard AWS integration tests..."
./.github/scripts/s3/run-integration-aws.sh
elif [[ "${{inputs.test_type}}" == "aws-iam" ]]; then
export label_filter="${{inputs.label_filter}}"
echo "Running AWS IAM role tests..."
./.github/scripts/s3/run-integration-aws-iam.sh
elif [[ "${{inputs.test_type}}" == "aws-assume" ]]; then
export assume_role_arn="${{inputs.role_arn}}"
export focus_regex="${{inputs.focus_regex}}"
export label_filter="${{inputs.label_filter}}"
echo "Running AWS assume role tests..."
./.github/scripts/s3/run-integration-aws-assume.sh
else
Expand Down
10 changes: 8 additions & 2 deletions .github/scripts/s3/assets/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import subprocess


def test_runner_handler(event, context):
os.environ['S3_CLI_PATH'] = './s3cli'
os.environ['BUCKET_NAME'] = event['bucket_name']
Expand All @@ -11,9 +12,14 @@ def test_runner_handler(event, context):
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

label_filter = event.get('label_filter', 'aws && iam-role')

try:
output = subprocess.check_output(['./integration.test', '-ginkgo.focus', 'AWS STANDARD IAM ROLE'],
env=os.environ, stderr=subprocess.STDOUT)
output = subprocess.check_output(
['./integration.test', '-ginkgo.label-filter', label_filter],
env=os.environ,
stderr=subprocess.STDOUT,
)
logger.debug("INTEGRATION TEST OUTPUT:")
logger.debug(output)
except subprocess.CalledProcessError as e:
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/s3/run-integration-aws-assume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ source "${script_dir}/utils.sh"
: "${access_key_id:?}"
: "${secret_access_key:?}"
: "${region_name:=unset}"
: "${focus_regex:?}"
: "${label_filter:?}"
: "${assume_role_arn:=unset}"
: "${s3_endpoint_host:=unset}"


# Just need these to get the stack info
export AWS_ACCESS_KEY_ID=${access_key_id}
export AWS_SECRET_ACCESS_KEY=${secret_access_key}
Expand All @@ -32,5 +31,6 @@ export S3_HOST=${s3_endpoint_host}

pushd "${repo_root}" > /dev/null
echo -e "\n running tests with $(go version)..."
ginkgo -r --focus="${focus_regex}" s3/integration/
echo "Selecting specs via label filter: ${label_filter}"
ginkgo -r --label-filter="${label_filter}" s3/integration/
popd > /dev/null
7 changes: 4 additions & 3 deletions .github/scripts/s3/run-integration-aws-iam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ source "${script_dir}/utils.sh"
: "${secret_access_key:?}"
: "${region_name:?}"
: "${stack_name:?}"
: "${label_filter:?}"

# Just need these to get the stack info and to create/invoke the Lambda function
export AWS_ACCESS_KEY_ID=${access_key_id}
Expand All @@ -24,11 +25,11 @@ bucket_name=$(get_stack_info_of "${stack_info}" "BucketName")
iam_role_arn=$(get_stack_info_of "${stack_info}" "IamRoleArn")

# Create JSON payload and base64 encode it
lambda_payload_json="{\"region\": \"${region_name}\", \"bucket_name\": \"${bucket_name}\", \"s3_host\": \"s3.amazonaws.com\"}"
lambda_payload_json="{\"region\": \"${region_name}\", \"bucket_name\": \"${bucket_name}\", \"s3_host\": \"s3.amazonaws.com\", \"label_filter\": \"${label_filter}\"}"
lambda_payload_base64=$(echo -n "${lambda_payload_json}" | base64)

lambda_log=$(mktemp -t "XXXXXX-lambda.log")
trap "cat ${lambda_log}" EXIT
trap 'cat "${lambda_log}"' EXIT

# Go to the repository root (3 levels up from script directory)

Expand Down Expand Up @@ -95,7 +96,7 @@ pushd "${repo_root}" > /dev/null
echo "Lambda execution log output for ${log_stream_name}"

tries=0
> lambda_output.log
: > lambda_output.log
while [[ ( "$(du lambda_output.log | cut -f 1)" -eq "0" ) && ( $tries -ne 20 ) ]] ; do
sleep 2
tries=$((tries + 1))
Expand Down
9 changes: 5 additions & 4 deletions .github/scripts/s3/run-integration-aws.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ source "${script_dir}/utils.sh"
: "${secret_access_key:?}"
: "${region_name:?}"
: "${stack_name:?}"
: "${focus_regex:?}"
: "${role_arn:=}"
: "${label_filter:?}"
: "${s3_endpoint_host:=unset}"


# Just need these to get the stack info
export AWS_ACCESS_KEY_ID=${access_key_id}
export AWS_SECRET_ACCESS_KEY=${secret_access_key}
export AWS_DEFAULT_REGION=${region_name}
export AWS_ROLE_ARN=${role_arn}
export AWS_ROLE_ARN=${role_arn-}
stack_info=$(get_stack_info "${stack_name}")

if [ -n "${AWS_ROLE_ARN}" ]; then
Expand All @@ -48,5 +48,6 @@ export S3_HOST=${s3_endpoint_host}

pushd "${repo_root}" > /dev/null
echo -e "\n running tests with $(go version)..."
ginkgo -r --focus="${focus_regex}" s3/integration/
echo "Selecting specs via label filter: ${label_filter}"
ginkgo -r --label-filter="${label_filter}" s3/integration/
popd > /dev/null
4 changes: 3 additions & 1 deletion .github/scripts/s3/run-integration-s3-compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ source "${script_dir}/utils.sh"
: "${bucket_name:?}"
: "${s3_endpoint_host:?}"
: "${s3_endpoint_port:?}"
: "${label_filter:=s3-compatible}"

export ACCESS_KEY_ID=${access_key_id}
export SECRET_ACCESS_KEY=${secret_access_key}
Expand All @@ -24,5 +25,6 @@ export S3_PORT=${s3_endpoint_port}

pushd "${repo_root}" > /dev/null
echo -e "\n running tests with $(go version)..."
ginkgo -r --focus="S3 COMPATIBLE" s3/integration/
echo "Selecting specs via label filter: ${label_filter}"
ginkgo -r --label-filter="${label_filter}" s3/integration/
popd > /dev/null
Loading
Loading