Files
floci/compatibility-tests/sdk-test-awscli/test/test_helper/common-setup.bash
T
Conor Heine eeefb729c4 test: move compatibility tests into this repo (#225)
* test: move compatibility tests into this repo
* fix: add StatisticValues parsing to CloudWatchMetricsJsonHandler
* fix: add missing required abstract methods to EmulatorConfig in EventBridgeSchedulerIntegrationTest
* test: add sdk tests for multipart S3 copy coverage
* fix: cover and fix smithy cbor and multipart s3 copy regressions
* test: migrate more test coverage to new folder
* test: add missing ec2 expectation in healthcheck test
* docs: update READMEs in `./compatibility-tests`
2026-04-06 09:35:53 -05:00

53 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Common setup for bats tests
# Load bats-support and bats-assert
# Supports both local lib/ directory and BATS_LIB_PATH for Docker
_COMMON_SETUP_DIR="${BATS_TEST_DIRNAME}"
if [[ -d "${_COMMON_SETUP_DIR}/../../lib/bats-support" ]]; then
load "${_COMMON_SETUP_DIR}/../../lib/bats-support/load.bash"
load "${_COMMON_SETUP_DIR}/../../lib/bats-assert/load.bash"
elif [[ -n "${BATS_LIB_PATH}" ]]; then
load "${BATS_LIB_PATH}/bats-support/load.bash"
load "${BATS_LIB_PATH}/bats-assert/load.bash"
else
echo "Error: Cannot find bats-support/bats-assert libraries" >&2
exit 1
fi
# Environment configuration
export FLOCI_ENDPOINT="${FLOCI_ENDPOINT:-http://localhost:4566}"
export AWS_DEFAULT_REGION="${AWS_DEFAULT_REGION:-us-east-1}"
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-test}"
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-test}"
# Helper function to run AWS CLI commands with endpoint
aws_cmd() {
aws --endpoint-url "$FLOCI_ENDPOINT" --region "$AWS_DEFAULT_REGION" --output json "$@" 2>&1
}
# Generate unique name for test resources
unique_name() {
local prefix="${1:-test}"
echo "${prefix}-$(date +%s)-$$"
}
# Wait for DynamoDB table to exist
ddb_wait_table() {
local table_name="$1"
aws_cmd dynamodb wait table-exists --table-name "$table_name" >/dev/null 2>&1 || true
}
# Extract JSON value using jq
json_get() {
local json="$1"
local path="$2"
echo "$json" | jq -r "$path" 2>/dev/null || echo ""
}
# Check if operation is unsupported
is_unsupported_operation() {
local output="$1"
[[ "$output" == *"(UnsupportedOperation)"* ]] || [[ "$output" == *" is not supported."* ]]
}