Skip to content

Fix S3 metrics test to actually test the correct code path #8

Fix S3 metrics test to actually test the correct code path

Fix S3 metrics test to actually test the correct code path #8

Workflow file for this run

on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
- name: Start LocalStack
uses: LocalStack/[email protected]
with:
image-tag: 'latest'
install-awslocal: 'true'
- name: Run tests
run: go test -v ./...
env:
# localstack requires these environment variables
AWS_DEFAULT_REGION: ap-northeast-1
# Credentials are important for localstack
# Without them, the tests will fail like:
# operation error S3: CreateBucket, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, failed to get API token, operation error ec2imds: getToken, http response error StatusCode: 400, request to EC2 IMDS failed
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
# These environment variables are required by main and main_test
# Without them, the tests will fail like:
# operation error S3: CreateBucket, exceeded maximum number of attempts, 3, https response error StatusCode: 500, RequestID: 346f5995-bbe8-41e2-be03-3a6ab0ad5edd, HostID: s9lzHYrFp76ZVxRcpX9+5cjAnEH2ROuNkd2BHfIa6UkFVdtjf5mKR3/eTPFvsiP/XV/VLi31234=, api error InternalError: exception while calling s3 with unknown operation: Unable to find operation for request to service s3: PUT /
S3_BUCKET: mybucket
S3_KEY: mykey