Skip to content

Commit

Permalink
Add support for results-dir.
Browse files Browse the repository at this point in the history
Fixes #78
  • Loading branch information
Nelson Osacky committed Nov 8, 2019
1 parent 95e01bc commit eabd1c6
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Changelog

## 0.8.1
Add support for resultsDir. [PR](https://github.com/runningcode/fladle/pull/80)

## 0.8.0
* BREAKING: devices now takes a `List<Map<String, String>>` instead of a `List<Device>`. See the [#README.md] for an example. [PR](https://github.com/runningcode/fladle/pull/76) Thanks [zlippard](https://github.com/zlippard).
* Add support for `keep-file-path`. [PR](https://github.com/runningcode/fladle/pull/77) Thanks [tahirhajizada](https://github.com/tahirhajizada).
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -177,6 +177,9 @@ The name of a Google Cloud Storage bucket where raw test results will be stored.
### keepFilePath
Keeps the full path of downloaded files from a Google Cloud Storage bucket. Required when file names are not unique. Disabled by default.

### resultsDir
The name of a unique Google Cloud Storage object within the results bucket where raw test results will be stored. The default is a timestamp with a random suffix.

---
### Error APK file not found
The app APK and the instrumentation apk are expected to have already been generated before calling runFlank.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Expand Up @@ -18,7 +18,7 @@ plugins {

dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:3.5.1")
implementation("com.android.tools.build:gradle:3.5.2")

testImplementation(gradleTestKit())
testImplementation("junit:junit:4.12")
Expand Down
Expand Up @@ -46,4 +46,10 @@ interface FladleConfig {
var resultsBucket: String?

var keepFilePath: Boolean

/**
* The name of a unique Google Cloud Storage object within the results bucket where raw test results will be stored
* (default: a timestamp with a random suffix).
*/
var resultsDir: String?
}
Expand Up @@ -22,5 +22,6 @@ data class FladleConfigImpl(
override var recordVideo: Boolean = true,
override var performanceMetrics: Boolean = true,
override var resultsBucket: String? = null,
override var keepFilePath: Boolean = false
override var keepFilePath: Boolean = false,
override var resultsDir: String?
) : FladleConfig
Expand Up @@ -49,6 +49,7 @@ open class FlankGradleExtension(project: Project) : FladleConfig {

override var keepFilePath: Boolean = false

override var resultsDir: String? = null
val configs: NamedDomainObjectContainer<FladleConfigImpl> = project.container(FladleConfigImpl::class.java) {
FladleConfigImpl(
name = it,
Expand All @@ -72,7 +73,8 @@ open class FlankGradleExtension(project: Project) : FladleConfig {
recordVideo = recordVideo,
performanceMetrics = performanceMetrics,
resultsBucket = resultsBucket,
keepFilePath = keepFilePath
keepFilePath = keepFilePath,
resultsDir = resultsDir
)
}

Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/java/com/osacky/flank/gradle/YamlWriter.kt
Expand Up @@ -93,6 +93,9 @@ internal class YamlWriter {
}
}
appendln(flakyTestAttemptsLine(config.flankVersion, config.flakyTestAttempts))
config.resultsDir?.let {
appendln(" results-dir: $it")
}
}

private fun flakyTestAttemptsLine(flankVersion: String, flakyTestAttempts: Int): String {
Expand Down
16 changes: 16 additions & 0 deletions buildSrc/src/test/java/com/osacky/flank/gradle/YamlWriterTest.kt
Expand Up @@ -308,6 +308,22 @@ class YamlWriterTest {
yamlWriter.writeAdditionalProperties(extension))
}

@Test
fun writeResultsDir() {
val extension = FlankGradleExtension(project).apply {
resultsDir = "resultsGoHere"
}

assertEquals(" use-orchestrator: false\n" +
" auto-google-login: false\n" +
" record-video: true\n" +
" performance-metrics: true\n" +
" timeout: 15m\n" +
" num-flaky-test-attempts: 0\n" +
" results-dir: resultsGoHere\n",
yamlWriter.writeAdditionalProperties(extension))
}

@Test
fun writeTestTargetsAndResultsHistoryName() {
val extension = FlankGradleExtension(project).apply {
Expand Down

0 comments on commit eabd1c6

Please sign in to comment.