Skip to content

Commit

Permalink
Fixed a flaky test for monorepo
Browse files Browse the repository at this point in the history
Fixed a flaky test in PaddleMonorepoProjectConfigurationsTest and added some explanation to the last line
  • Loading branch information
khbminus committed Mar 13, 2023
1 parent 8c815b7 commit 2642a6c
Showing 1 changed file with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import io.paddle.project.extensions.descriptor
import io.paddle.project.extensions.routeAsString
import io.paddle.utils.deepResolve
import java.io.File
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
import kotlin.test.assertNull
import kotlin.test.*

internal class PaddleMonorepoProjectConfigurationsTest {
private val resources: File = File("src").deepResolve("test", "resources")
Expand Down Expand Up @@ -45,6 +42,30 @@ internal class PaddleMonorepoProjectConfigurationsTest {
val rootDir = resources.resolve("flat-monorepo")
val projectProvider = PaddleProjectProvider.getInstance(rootDir)

// Projects structure:
// ┌──────────┐
// │ │
// │ monorepo │
// │ │
// └───┬─┬────┘
// │ │
// ┌────────┘ └────────┐
// ▼ ▼
//┌────────────┐ ┌────────────┐
//│ │ │ │
//│ subproject │ │ subproject │
//│ one │ │ one │
//│ │ │ │
//└────┬───────┘ └──────┬─────┘
// │ │
// └────────┐ ┌────────┘
// ▼ ▼
// ┌──────────┐
// │ │
// │ monorepo │
// │ │
// └──────────┘

val monorepo = projectProvider.getProject(rootDir)
val subprojectOne = projectProvider.getProject(rootDir.resolve("subproject-one"))
val subprojectTwo = projectProvider.getProject(rootDir.resolve("subproject-two"))
Expand All @@ -71,6 +92,9 @@ internal class PaddleMonorepoProjectConfigurationsTest {
assertEquals(":monorepo", monorepo.routeAsString)
assertEquals(":monorepo:subproject-one", subprojectOne.routeAsString)
assertEquals(":monorepo:subproject-two", subprojectTwo.routeAsString)
assertEquals(":monorepo:subproject-one:common", common.routeAsString)
assertTrue(
":monorepo:subproject-one:common" == common.routeAsString ||
":monorepo:subproject-two:common" == common.routeAsString
)
}
}
}

0 comments on commit 2642a6c

Please sign in to comment.