chore(tests): clean leftover test state on shared CI app#256
Open
nijeesh-stream wants to merge 1 commit into
Open
chore(tests): clean leftover test state on shared CI app#256nijeesh-stream wants to merge 1 commit into
nijeesh-stream wants to merge 1 commit into
Conversation
655aee8 to
eacfed0
Compare
Three test classes routinely fail on CI because the shared test app accumulates state across runs whenever a prior PR's job died before its inline teardown could fire: - ChannelTypeTest / CommandTest: hit the per-app 50-item cap on custom channel types and custom commands (CustomChannelTypeLimit / CustomCommandLimit on the backend). Add @BeforeAll sweeps that list and best-effort delete the non-system entries. - UserTest: User.queryBanned() returns a paginated slice, so once enough zombie bans pile up, the just-created ban under test ends up past the first page and the 'assertTrue(stream.anyMatch...)' check fails. Add @BeforeAll cleanup that pages through and unbans each. - TaskStatusTest: the default 5s waitFor was routinely too short for Channel.deleteMany under load. Bump that one test to 5 minutes. All sweeps are best-effort: anything still in use just returns an error from delete()/unban() and is skipped.
eacfed0 to
391dc50
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three test classes routinely fail on CI because the shared test app accumulates state across runs whenever a prior PR's job died before its inline teardown could fire. None of these are SDK behavior bugs — they are infra/seeding gaps that surface as red CI on unrelated PRs.
ChannelTypeTest/CommandTest— 50-item quotaBoth classes tear down their state inline at the end of each test. When a CI run dies mid-test before the
delete(...)call fires, the leftover entry stays on the shared test app. Once enough zombies accumulate, every new run hits the per-app cap (CustomChannelTypeLimit = 50,CustomCommandLimit = 50on the backend):Blocks 17 tests across the two classes. Add a
@BeforeAllsweep on each that lists, filters out system defaults, and best-effort deletes the rest.UserTest— paginatedqueryBannedmisses new banSeveral ban-related tests do
User.ban().request()thenUser.queryBanned().request()and assert the new ban is in the response withassertTrue(bans.stream().anyMatch(...)).queryBannedreturns a paginated slice. Once enough zombie bans accumulate on the shared app the just-created ban ends up past page 1 and the assertion fails withexpected: <true> but was: <false>.Fix:
@BeforeAll cleanupLeftoverBansthat pages through and best-effort unbans each. Affects 5 tests (Can ban user,Can ban user with delete reactions,Can shadow ban user,Can list banned user,Can unban user).TaskStatusTest— defaultwaitFortoo short fordeleteManyChannel.deleteMany(...).request().getTaskId()and then pollTaskStatus.get(taskId)for completion. The defaultwaitFortimeout (5s, defined onBasicTest) is routinely too short for the asynq queue under load. Bump that one test to 5 minutes.All sweeps are best-effort: anything still in active use returns an error from
delete()/unban()and is skipped.Test plan
./gradlew spotlessCheck compileTestJava— cleanChannelTypeTest+CommandTest+UserTest+TaskStatusTest