Instead of replacing S3 with a different local storage in tests, run MinIO as a separate service and point the AWS SDK at it. Everything behaves as though it is communicating with S3, but files are stored locally.