Skip to content

Commit

Permalink
Tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sloox authored and mergify-bot committed May 24, 2021
1 parent 6dd5667 commit fedbd70
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions test_runner/src/test/kotlin/ftl/gc/GcIosTestMatrixTest.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package ftl.gc

import com.google.testing.model.IosDeviceList
import flank.common.isWindows
import ftl.api.TestMatrixIos
import ftl.args.IosArgs
import ftl.client.google.GcToolResults
import ftl.client.google.run.ios.executeIosTests
import ftl.ios.xctest.FIXTURES_PATH
import ftl.run.model.XcTestContext
import ftl.run.platform.ios.createIosTestConfig
import ftl.test.util.FlankTestRunner
import io.mockk.every
import io.mockk.mockk
import io.mockk.unmockkAll
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Assume.assumeFalse
Expand All @@ -25,49 +26,46 @@ class GcIosTestMatrixTest {

@Test(expected = IllegalArgumentException::class)
fun `build negativeShardErrors`() {
val iosArgs = mockk<IosArgs>(relaxed = true)

GcIosTestMatrix.build(
iosDeviceList = IosDeviceList(),
args = iosArgs,
toolResultsHistory = GcToolResults.createToolResultsHistory(iosArgs),
otherFiles = mapOf(),
additionalIpasGcsPaths = emptyList(),
iosTestContext = XcTestContext("", "", "", false, "")
)
}

@Test(expected = IllegalArgumentException::class)
fun `build invalidShardErrors`() {
val iosArgs = mockk<IosArgs>(relaxed = true)
GcIosTestMatrix.build(
iosDeviceList = IosDeviceList(),
args = iosArgs,
toolResultsHistory = GcToolResults.createToolResultsHistory(iosArgs),
otherFiles = mapOf(),
additionalIpasGcsPaths = emptyList(),
iosTestContext = XcTestContext("", "", "", false, "")
)
runBlocking {
val iosArgs = mockk<IosArgs>(relaxed = true) {
every { otherFiles } returns emptyMap()
every { devices } returns emptyList()
every { resultsHistoryName } returns ""
}

val type = TestMatrixIos.Type.XcTest(
xcTestGcsPath = "",
xcodeVersion = "",
testSpecialEntitlements = false,
matrixGcsPath = "",
xcTestRunFileGcsPath = ""
)
val config = createIosTestConfig(iosArgs)
executeIosTests(config, listOf(type))
}
}

@Test
fun `build validArgs`() {
assumeFalse(isWindows) // TODO enable it on #1180

val iosArgs = mockk<IosArgs>(relaxed = true)
every { iosArgs.testTimeout } returns "3m"
every { iosArgs.resultsBucket } returns "/hi"
every { iosArgs.project } returns "123"
every { iosArgs.xctestrunFile } returns "$FIXTURES_PATH/ios/EarlGreyExample/EarlGreyExampleSwiftTests.xctestrun"

GcIosTestMatrix.build(
iosDeviceList = IosDeviceList(),
args = iosArgs,
toolResultsHistory = GcToolResults.createToolResultsHistory(iosArgs),
otherFiles = mapOf(),
additionalIpasGcsPaths = emptyList(),
iosTestContext = XcTestContext("", "", "", false, "")
)
runBlocking {
assumeFalse(isWindows) // TODO enable it on #1180

val iosArgs = mockk<IosArgs>(relaxed = true)
every { iosArgs.testTimeout } returns "3m"
every { iosArgs.resultsBucket } returns "/hi"
every { iosArgs.project } returns "123"
every { iosArgs.xctestrunFile } returns "$FIXTURES_PATH/ios/EarlGreyExample/EarlGreyExampleSwiftTests.xctestrun"

val type = TestMatrixIos.Type.XcTest(
xcTestGcsPath = "",
xcodeVersion = "",
testSpecialEntitlements = false,
matrixGcsPath = "",
xcTestRunFileGcsPath = ""
)
val config = createIosTestConfig(iosArgs)
executeIosTests(config, listOf(type))
}
}

@Test
Expand Down

0 comments on commit fedbd70

Please sign in to comment.