Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add IT for large shard test suite #1737

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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