Skip to content

feat: Add comprehensive unit tests for S3 datastore#34

Open
sumitvekariya wants to merge 2 commits intostoracha:mainfrom
sumitvekariya:feature/s3-datastore-tests
Open

feat: Add comprehensive unit tests for S3 datastore#34
sumitvekariya wants to merge 2 commits intostoracha:mainfrom
sumitvekariya:feature/s3-datastore-tests

Conversation

@sumitvekariya
Copy link

  • Add complete test suite with 14 test functions covering all datastore operations
  • Tests include CRUD operations, query functionality, batch operations, and concurrent access
  • Use MinIO testcontainers for realistic S3 testing environment
  • Cover edge cases: special characters, path transformation, error handling
  • Add context cancellation and timeout testing
  • Verify interface compliance with go-datastore.Datastore and go-datastore.Batching
  • All tests pass successfully with ~73s execution time

Test coverage includes:

  • Basic operations: Put, Get, Has, GetSize, Delete
  • Query operations: prefix filtering, keys-only mode, unsupported filters
  • Batch operations: small batches, large batches (50+ operations), mixed operations
  • Concurrency: 10 goroutines with 100 total operations
  • Edge cases: path transformation, special characters, deep nesting
  • Error handling: context cancellation, timeouts, not-found scenarios
  • Resource management: Sync and Close operations

Closes #24

- Add complete test suite with 14 test functions covering all datastore operations
- Tests include CRUD operations, query functionality, batch operations, and concurrent access
- Use MinIO testcontainers for realistic S3 testing environment
- Cover edge cases: special characters, path transformation, error handling
- Add context cancellation and timeout testing
- Verify interface compliance with go-datastore.Datastore and go-datastore.Batching
- All tests pass successfully with ~73s execution time

Test coverage includes:
- Basic operations: Put, Get, Has, GetSize, Delete
- Query operations: prefix filtering, keys-only mode, unsupported filters
- Batch operations: small batches, large batches (50+ operations), mixed operations
- Concurrency: 10 goroutines with 100 total operations
- Edge cases: path transformation, special characters, deep nesting
- Error handling: context cancellation, timeouts, not-found scenarios
- Resource management: Sync and Close operations
- Fix batch delete to use s3Path() for proper root directory handling
- Ensures batch delete operations work correctly with RootDirectory configuration
- Fixes inconsistency where individual operations used s3Path() but batch delete did not

This ensures that when using a root directory configuration, batch delete operations
will correctly prefix the S3 keys with the root directory path, maintaining
consistency with other datastore operations.
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.

Add tests to S3 datastore implementation

1 participant