Skip to content

Comments

feat(s3tables): add S3 Tables service basic implementation#210

Merged
sivchari merged 8 commits intomainfrom
feat/s3tables-basic-implementation
Feb 12, 2026
Merged

feat(s3tables): add S3 Tables service basic implementation#210
sivchari merged 8 commits intomainfrom
feat/s3tables-basic-implementation

Conversation

@sivchari
Copy link
Owner

Summary

Implement S3 Tables service emulation for awsim.

Features

TableBucket operations:

  • CreateTableBucket
  • DeleteTableBucket
  • GetTableBucket
  • ListTableBuckets

Namespace operations:

  • CreateNamespace
  • DeleteNamespace
  • GetNamespace
  • ListNamespaces

Table operations:

  • CreateTable
  • DeleteTable
  • GetTable
  • ListTables

Implementation Details

  • Uses REST JSON protocol similar to EKS
  • In-memory storage with thread-safe operations
  • Proper error handling with AWS-compatible error codes
  • ARN generation following AWS format

Files Added/Modified

  • internal/service/s3tables/types.go - Type definitions
  • internal/service/s3tables/storage.go - Storage interface and memory implementation
  • internal/service/s3tables/handlers.go - HTTP handlers
  • internal/service/s3tables/service.go - Service registration
  • internal/server/router.go - Added /s3tables prefix
  • test/integration/s3tables_test.go - Integration tests

Test plan

  • Integration tests for all operations
  • Build passes
  • go vet passes

Closes #154

Implement S3 Tables service emulation with the following operations:

TableBucket operations:
- CreateTableBucket
- DeleteTableBucket
- GetTableBucket
- ListTableBuckets

Namespace operations:
- CreateNamespace
- DeleteNamespace
- GetNamespace
- ListNamespaces

Table operations:
- CreateTable
- DeleteTable
- GetTable
- ListTables

Add integration tests for all operations using AWS SDK v2.
Add /s3tables prefix to router to avoid conflicts with S3 wildcard routes.

Closes #154
- Add path component constants to avoid goconst errors
- Remove unused status parameter from writeJSON
- Add nolint:tagliatelle comments for AWS API field names
- Refactor ListTables to reduce funlen and nestif complexity
- Fix wsl lint error in GetTable
- Fix integration test Format type check
- Change HTTP methods: PUT for Create operations, GET for Get/List, DELETE for Delete
- Remove /s3tables prefix from routes to match SDK paths:
  - /buckets for TableBucket operations
  - /namespaces/{arn} for Namespace operations
  - /tables/{arn} for Table operations
  - /get-table for GetTable (uses query params)
- Update path extraction functions to work without /s3tables prefix
- Update GetTable handler to read from query params (tableBucketARN, namespace, name)
- Update router.go prefixes to include S3 Tables paths

SDK sends requests directly to /buckets, /namespaces, /tables paths
without any service-specific prefix since S3 Tables uses a separate
endpoint in AWS (s3tables.region.amazonaws.com).
The S3 Tables routes no longer have the /s3tables prefix, so the
test client should use the base endpoint without it.
ARNs contain '/' characters (e.g., bucket/test-table-bucket) which are
URL-encoded as %2F. When Go's http.Request decodes the URL, the encoded
slash becomes a literal '/' character, causing path splitting to
incorrectly parse the ARN.

This fix adds a getURLPath() helper function that returns RawPath
(which preserves URL encoding) when available, falling back to the
decoded Path otherwise. All handlers now use this helper to correctly
extract ARNs from URL paths.
TestS3Tables_GetTable and TestS3Tables_GetTableBucket were both using
'test-get-table-bucket', causing a conflict when tests run concurrently
or when cleanup doesn't complete before the next test starts.

Renamed the bucket in TestS3Tables_GetTable to 'test-get-table-test-bucket'
to ensure test isolation.
@github-actions
Copy link
Contributor

📊 Integration Test Coverage Report

Total Coverage: 65.5%

@sivchari sivchari marked this pull request as ready for review February 12, 2026 08:20
@sivchari sivchari merged commit 4481a1e into main Feb 12, 2026
3 checks passed
@sivchari sivchari deleted the feat/s3tables-basic-implementation branch February 12, 2026 08:21
@github-actions github-actions bot mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S3 Tables: Service implementation

1 participant