fix(test): disable the GuardDuty organization admin GuardDutyMembersIntegrationTest enables - #3348
fix(test): disable the GuardDuty organization admin GuardDutyMembersIntegrationTest enables#3348okinaka wants to merge 2 commits into
Conversation
|
| Filename | Overview |
|---|---|
| src/test/java/io/github/hectorvent/floci/services/guardduty/GuardDutyMembersIntegrationTest.java | Adds scoped cleanup for the GuardDuty organization administrator and safely resets the teardown guard after successful removal. |
Reviews (3): Last reviewed commit: "test(guardduty): reset the teardown flag..." | Re-trigger Greptile
There was a problem hiding this comment.
🟢 Approval recommended
The change is a focused test-only cleanup that addresses an identified state leak without altering product behavior.
Pull request overview
This PR fixes cross-test state leakage in the GuardDuty integration tests by ensuring an organization admin account enabled during GuardDutyMembersIntegrationTest is disabled during teardown, preventing MacieOrganizationIntegrationTest.sharedAdminRouteKeepsGuardDutyBehavior from observing leftover GuardDuty admin state via the shared /admin route.
Changes:
- Add an
@AfterEachteardown inGuardDutyMembersIntegrationTestto disable the GuardDuty organization admin account created during the test. - Guard the teardown with an instance flag so only the test that enabled the admin performs the disable.
File summaries
| File | Description |
|---|---|
| src/test/java/io/github/hectorvent/floci/services/guardduty/GuardDutyMembersIntegrationTest.java | Adds flag-guarded @AfterEach cleanup to disable the org admin account enabled by the test, preventing leakage into Macie tests. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ntegrationTest enables GuardDutyMembersIntegrationTest enables account 444444444444 as a GuardDuty organization admin and never disables it. Those admin accounts are shared by every @QuarkusTest class in the same Surefire fork, and Macie answers the same /admin route, so MacieOrganizationIntegrationTest.sharedAdminRouteKeepsGuardDutyBehavior fails whenever it runs after this class: it asks for an empty admin list on the GuardDuty credential scope and gets 444444444444 back. Disable the admin in @AfterEach, guarded by a flag so the teardown only runs for the test that enabled one and a single-method run of the class still works.
dfc23f1 to
990cd1e
Compare
The flag survives the disable, so a switch to PER_CLASS instance lifecycle would have the next test's teardown issue a second /admin/disable and fail on the expected 400.
Summary
GuardDutyMembersIntegrationTestenables account 444444444444 as a GuardDutyorganization admin and never disables it. Those admin accounts live in a store
shared by every
@QuarkusTestclass in the same Surefire fork, and Macieanswers the same
/adminroute, soMacieOrganizationIntegrationTest.sharedAdminRouteKeepsGuardDutyBehaviorfailswhenever it runs after this class: it asks for an empty admin list on the
GuardDuty credential scope and gets 444444444444 back.
The admin is now disabled in
@AfterEach, guarded by a flag so the teardownruns only for the test that enabled one and a single-method run of the class
still works. The teardown goes through
/admin/disable, the same route the testused to create the state, rather than reaching for the service.
GuardDutyControllerIntegrationTestalready disables what it enables, so thiswas the only class leaving one behind.
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
No product code changes: this is test state that leaks between classes, in the
same shape as the DetectiveIntegrationTest teardown, and the fix follows that
one's flag-guarded
@AfterEachpattern.Reproduced and verified locally.
GuardDutyMembersIntegrationTestplusMacieOrganizationIntegrationTestin one fork fails before this change on theassertion above and passes after (7 tests). The org-admin neighbourhood is green
as well:
GuardDuty*,Macie*,Detective*,Inspector2*andSecurityHub*run to 74 tests, no failures.
A full local
./mvnw teston this branch runs 19120 tests with one error left,and it is not this one:
ContainerPlatformDockerIntegrationTestfails on thishost because Docker 29's containerd image store reports an empty Os and
Architecture for a foreign-platform image, which is unrelated to this change.
Before the change, that same run had this Macie failure alongside it.
Checklist
./mvnw testpasses locally