Skip to content

Tests, maintenance, refactorings#2594

Merged
afranken merged 28 commits intomainfrom
junie-ctd
Sep 1, 2025
Merged

Tests, maintenance, refactorings#2594
afranken merged 28 commits intomainfrom
junie-ctd

Conversation

@afranken
Copy link
Member

@afranken afranken commented Aug 30, 2025

Description

More Junie testing. Sometimes, the output is good, sometimes I need to refactor or reset the changes...

  • More unit tests
  • Stale PR/Issues

Related Issue

Tasks

  • I have signed the CLA.
  • I have written tests and verified that they fail without my change.

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...
@afranken afranken self-assigned this Aug 31, 2025
@afranken afranken requested a review from Copilot August 31, 2025 12:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @SpringBootTest with TestRestTemplate to @WebMvcTest with MockMvc for 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.

Comment on lines 1154 to 1165
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)
}
}
Copy link

Copilot AI Aug 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
.andExpect(header().string(AwsHttpHeaders.X_AMZ_VERSION_ID, "va1"))
.andExpect {
// ETag must be without quotes in XML body
content().string(containsString("<ETag>\"$hex\"</ETag>"))
Copy link

Copilot AI Aug 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
Comment on lines +1247 to +1248
content().string(not(containsString("<ObjectSize>")))
content().string(not(containsString("<StorageClass>")))
Copy link

Copilot AI Aug 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
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.
@afranken afranken changed the title Tests, maintenance Tests, maintenance, refactorings Sep 1, 2025
@afranken afranken merged commit cccf287 into main Sep 1, 2025
6 checks passed
@afranken afranken deleted the junie-ctd branch September 1, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants