Add idempotence-s3fs-nio module for S3 bucket test resource generation#113
Add idempotence-s3fs-nio module for S3 bucket test resource generation#113
Conversation
|
🚀 Deployed to Netlify: View Preview |
| { | ||
|
|
||
| private String basedir = System.getProperty("org.carlspring.testing.idempotence.basedir") != null ? | ||
| System.getProperty("org.carlspring.testing.idempotence.basedir") : |
There was a problem hiding this comment.
@copilot :
This property should actually be org.carlspring.testing.idempotence.s3fs.basedir. Could you please also change this wherever else it's required?
There was a problem hiding this comment.
Done in e08094e. Renamed the system property to org.carlspring.testing.idempotence.s3fs.basedir in S3fsNioIdempotenceProperties, S3TestResourceExtension, and the docs.
|
@copilot , There is no functionaity test that uses the annotations to generate the resource in the S3 bucket and then check if the resource really exists. Could you please implement this? |
Added in e5e88ef. To wire this up correctly, Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
🚀 Deployed to Netlify: View Preview |
|
@copilot : Could you now, please:
|
Done in f936f21.
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
f32186e to
992ae34
Compare
Co-authored-by: carlspring <1436265+carlspring@users.noreply.github.com>
…edir Co-authored-by: carlspring <1436265+carlspring@users.noreply.github.com>
…urceCopier Co-authored-by: carlspring <1436265+carlspring@users.noreply.github.com>
…ionalityAWSTest Co-authored-by: carlspring <1436265+carlspring@users.noreply.github.com>
f936f21 to
90422b0
Compare
|
🚀 Deployed to Netlify: View Preview |
Adds a new Maven module
idempotence-s3fs-niothat enables the idempotence framework to copy test resources into Amazon S3 buckets (or S3-compatible stores like MinIO) via the carlspring/s3fs-nio NIO2 FileSystem provider.New module:
idempotence-s3fs-nioS3fsNioIdempotenceProperties—AbstractIdempotencePropertiesimpl; default basedirs3:///idempotence-test-resources, overridable viaorg.carlspring.testing.idempotence.s3fs.basedirS3fsNioPathTransformer—PathTransformerimpl; strips Maven (target/test-classes) and Gradle (build/resources/test,build/classes/java/test) prefixes to produce relative S3 key pathsS3ResourceCopier— copies classpath resources to S3 usingFiles.copy(InputStream, S3Path, REPLACE_EXISTING)via the NIO2 API; the basedir is resolved lazily per invocation so the endpoint can be overridden at test timeS3TestResourceExtension— JUnit Jupiter@ExtendWithentry point; performs pre-test S3 cleanup viaFiles.walkFileTree()then delegates toS3ResourceCopierS3FileSystemUtils— shared utility to get or create the S3FileSystemfrom a base URI (handles both AWS and custom endpoints)META-INF/services/forIdempotencePropertiesandPathTransformerUsage
Point at a local MinIO instance by setting:
AWS credentials and region are resolved via the SDK's default provider chain.
Functional tests
S3BasicFunctionalityMinIOTestEnd-to-end verification using a real MinIO instance started automatically via Testcontainers (skipped when Docker is unavailable):
MinIOContainer, configuress3fs.*system properties, creates the target bucket, and wiresIdempotencePropertiesServiceto point at the running instance.testSingleFile,testWithPatterns,testMultipleWithPatterns) use@TestResources/@TestResourceannotations to trigger resource copying, then assert the uploaded S3 objects exist viaFiles.exists()on the NIO2 path.IdempotencePropertiesService) is restored in@AfterAll.S3BasicFunctionalityAWSTestEnd-to-end verification against a real AWS S3 bucket (skipped unless the
AWS_ACCESS_KEY_IDenvironment variable is set):S3fsNioIdempotencePropertiesdefaults — reads the target S3 location from theorg.carlspring.testing.idempotence.s3fs.basedirsystem property (defaults tos3:///idempotence-test-resources).~/.aws/credentials, EC2 instance profile). The target bucket must already exist.@AfterAlland restoresIdempotencePropertiesService.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.