Conversation
These were written by Junie, but needed tweaking and refactoring.
These were written by Junie, but needed tweaking and refactoring.
These were written by Junie, but needed tweaking and refactoring.
Let Junie refactor the test gradually, step 1
Let Junie refactor the test gradually, step 2
Let Junie refactor the test gradually, step 3
Let Junie refactor the test gradually, step 4
Let Junie refactor the test gradually, step 1
Let Junie refactor the test gradually, step 2
Let Junie refactor the test gradually, step 3
Let Junie refactor the test gradually, step 4
Let Junie refactor the test gradually, step 1
Let Junie refactor the test gradually, step 2
Let Junie refactor the test gradually, step 3
For unknown reasons, Junie never imports functions or classes...
There was a problem hiding this comment.
Pull Request Overview
This PR focuses on test maintenance and improvements across the S3Mock testing framework. It modernizes test implementations, improves test organization, and enhances test cleanup mechanisms.
Key changes include:
- Migrating controller tests from
@SpringBootTestwithTestRestTemplateto@WebMvcTestwithMockMvcfor better performance and isolation - Adding a new GitHub Actions workflow for automatic stale issue/PR management
- Refactoring test helper methods and improving code reuse through shared base classes
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Multiple controller test files | Modernized test framework from TestRestTemplate to MockMvc |
| BaseControllerTest.kt | Centralized common test utilities and helper methods |
| StoreTestBase.kt | Added bucket name tracking for improved test cleanup |
| Various store test files | Enhanced test coverage and improved helper method organization |
| .github/workflows/stale.yml | New automated workflow for managing stale issues and PRs |
| HeaderUtil.java | Updated string comparison utilities to use newer Apache Commons methods |
| BucketStore.java | Added method overloads for better API design |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| arrayListOf<UUID>().apply { | ||
| for (id in idCache) { | ||
| objectStore.deleteObject(metadataFrom(TEST_BUCKET_NAME), id, null) | ||
| objectStore.deleteObject(metadataFrom("bucket1"), id, null) | ||
| objectStore.deleteObject(metadataFrom("bucket2"), id, null) | ||
| objectStore.deleteObject(metadataFrom("destinationBucket"), id, null) | ||
| objectStore.deleteObject(metadataFrom("sourceBucket"), id, null) | ||
| BUCKET_NAMES.forEach { | ||
| objectStore.deleteObject(metadataFrom(it), id, null) | ||
| } | ||
| this.add(id) | ||
| } | ||
| }.also { | ||
| for (id in it) { | ||
| idCache.remove(id) | ||
| } | ||
| } |
There was a problem hiding this comment.
[nitpick] The cleanup method iterates through all bucket names for each object ID, resulting in O(n*m) complexity where n is the number of IDs and m is the number of buckets. Consider batching operations or using a more efficient cleanup strategy.
| .andExpect(header().string(AwsHttpHeaders.X_AMZ_VERSION_ID, "va1")) | ||
| .andExpect { | ||
| // ETag must be without quotes in XML body | ||
| content().string(containsString("<ETag>\"$hex\"</ETag>")) |
There was a problem hiding this comment.
[nitpick] The test is checking XML content structure with string matching. Consider using a more robust XML assertion library or structured XML parsing to make the test less brittle to formatting changes.
| content().string(not(containsString("<ObjectSize>"))) | ||
| content().string(not(containsString("<StorageClass>"))) |
There was a problem hiding this comment.
[nitpick] The test is checking XML content structure with string matching. Consider using a more robust XML assertion library or structured XML parsing to make the test less brittle to formatting changes.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Let Junie suggest refactorings to idiomatic Kotlin.
Description
More Junie testing. Sometimes, the output is good, sometimes I need to refactor or reset the changes...
Related Issue
Tasks