Skip to content

Commit b1747ac

Browse files
dkrizanclaude
andcommitted
fix: ktlint format and CDN config branching test race
- Collapse waitForPendingCleanups body expression to single line - Wait for async branch cleanup before asserting CDN config deleted Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 04dcc33 commit b1747ac

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

ee/backend/app/src/main/kotlin/io/tolgee/ee/service/branching/BranchCleanupWorker.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,5 @@ class BranchCleanupWorker(
110110
/**
111111
* Blocks until all in-flight cleanups have finished (success or failure).
112112
*/
113-
fun waitForPendingCleanups(timeoutMs: Long = 30_000) =
114-
branchCleanupTracker.waitForPendingCleanups(timeoutMs)
113+
fun waitForPendingCleanups(timeoutMs: Long = 30_000) = branchCleanupTracker.waitForPendingCleanups(timeoutMs)
115114
}

ee/backend/tests/src/test/kotlin/io/tolgee/ee/api/v2/controllers/ContentDeliveryConfigBranchingTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import io.tolgee.fixtures.andIsBadRequest
1313
import io.tolgee.fixtures.andIsNotFound
1414
import io.tolgee.fixtures.andIsOk
1515
import io.tolgee.fixtures.node
16+
import io.tolgee.ee.service.branching.BranchCleanupWorker
1617
import io.tolgee.service.contentDelivery.ContentDeliveryConfigService
1718
import io.tolgee.testing.annotations.ProjectJWTAuthTestMethod
1819
import io.tolgee.testing.assert
@@ -37,6 +38,9 @@ class ContentDeliveryConfigBranchingTest : ProjectAuthControllerTest("/v2/projec
3738
@Autowired
3839
private lateinit var batchJobConcurrentLauncher: BatchJobConcurrentLauncher
3940

41+
@Autowired
42+
private lateinit var branchCleanupWorker: BranchCleanupWorker
43+
4044
@BeforeEach
4145
fun setup() {
4246
batchJobConcurrentLauncher.pause = true
@@ -130,6 +134,8 @@ class ContentDeliveryConfigBranchingTest : ProjectAuthControllerTest("/v2/projec
130134
fun `delete branch deletes CDN configs for that branch`() {
131135
performProjectAuthDelete("branches/${testData.featureBranch.id}").andIsOk
132136

137+
branchCleanupWorker.waitForPendingCleanups()
138+
133139
executeInNewTransaction {
134140
contentDeliveryConfigService.find(testData.featureBranchCdnConfig.self.id).assert.isNull()
135141
// main branch configs are unaffected

0 commit comments

Comments
 (0)