Skip to content

Commit

Permalink
test: Add IT for large shard test suite (#1737)
Browse files Browse the repository at this point in the history
Fixes #1650

## Test Plan
> How do we know the code works?

New IT succeed.

## Checklist

- [x] Integration tests updated
  • Loading branch information
piotradamczyk5 authored and jan-goral committed Mar 26, 2021
1 parent 72a2d29 commit 596ce90
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package integration

import FlankCommand
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import run
import utils.CONFIGS_PATH
import utils.FLANK_JAR_PATH
import utils.androidRunCommands
import utils.asOutputReport
import utils.assertCostMatches
import utils.assertCountOfFailedTests
import utils.assertCountOfSkippedTests
import utils.assertExitCode
import utils.assertTestCountMatches
import utils.findTestDirectoryFromOutput
import utils.firstTestSuiteOverview
import utils.json
import utils.loadAsTestSuite
import utils.removeUnicode
import utils.toJUnitXmlFile
import utils.toOutputReportFile

class ManyTestsOnSingleShardIT {

private val name = this::class.java.simpleName

@Test
fun `return with exit code 0 and has correct output`() {
val result = FlankCommand(
flankPath = FLANK_JAR_PATH,
ymlPath = "$CONFIGS_PATH/flank_android_many_tests_on_single_shard.yml",
params = androidRunCommands
).run("./", name)
val expectedTestCount = 60

assertExitCode(result, 0)

val resOutput = result.output.removeUnicode()
val outputDirectory = resOutput.findTestDirectoryFromOutput()

// validate JUnitReport.xml
val testSuites = outputDirectory.toJUnitXmlFile().loadAsTestSuite()
assertThat(testSuites.testSuites.first().testCases.size).isEqualTo(expectedTestCount)
(0 until expectedTestCount).forEach { testNumber ->
assertThat(testSuites.testSuites.any { it.name == "test$testNumber" })
assertThat(testSuites.assertCountOfFailedTests(0))
assertThat(testSuites.assertCountOfSkippedTests(0))
}

// validate general
val outputReport = outputDirectory.toOutputReportFile().json().asOutputReport()
outputReport.assertCostMatches()
assertThat(outputReport.testResults).isNotEmpty()
assertThat(outputReport.weblinks).isNotEmpty()
assertThat(outputReport.error).isEmpty()
outputReport.firstTestSuiteOverview.assertTestCountMatches(total = expectedTestCount)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
gcloud:
app: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app_many_tests-debug.apk
test: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app_many_tests-debug-androidTest.apk

flank:
disable-sharding: true
disable-results-upload: true
disable-usage-statistics: true
output-report: json

0 comments on commit 596ce90

Please sign in to comment.