From b831d0780af85fe91b034e45aa2da9ce55135e7a Mon Sep 17 00:00:00 2001 From: Piotr Adamczyk Date: Fri, 28 Aug 2020 16:45:15 +0200 Subject: [PATCH] fix: Bad validation of `local-result-dir` by Doctor --- .../main/kotlin/ftl/config/common/CommonFlankConfig.kt | 3 ++- .../firebase/test/android/AndroidDoctorCommandTest.kt | 9 ++++++++- .../ftl/cli/firebase/test/ios/IosDoctorCommandTest.kt | 10 ++++++++-- .../test_app_cases/flank-with_local_result_dir.yml | 6 ++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-with_local_result_dir.yml diff --git a/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt b/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt index 824006927c..66b0e9790d 100644 --- a/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt +++ b/test_runner/src/main/kotlin/ftl/config/common/CommonFlankConfig.kt @@ -177,7 +177,8 @@ data class CommonFlankConfig @JsonIgnore constructor( "keep-file-path", "output-style", "disable-results-upload", - "full-junit-result" + "full-junit-result", + "local-result-dir" ) const val defaultLocalResultsDir = "results" diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/AndroidDoctorCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/AndroidDoctorCommandTest.kt index 7e29d07249..5be4550977 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/AndroidDoctorCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/android/AndroidDoctorCommandTest.kt @@ -4,9 +4,9 @@ import com.google.common.truth.Truth.assertThat import ftl.cli.firebase.test.INVALID_YML_PATH import ftl.cli.firebase.test.SUCCESS_VALIDATION_MESSAGE import ftl.config.FtlConstants +import ftl.run.exception.YmlValidationError import ftl.test.util.FlankTestRunner import ftl.test.util.TestHelper.normalizeLineEnding -import ftl.run.exception.YmlValidationError import org.junit.Rule import org.junit.Test import org.junit.contrib.java.lang.system.SystemOutRule @@ -76,4 +76,11 @@ class AndroidDoctorCommandTest { run() } } + + @Test + fun `android doctor should not fail on local-result-dir`() { + AndroidDoctorCommand().apply { + configPath = "./src/test/kotlin/ftl/fixtures/test_app_cases/flank-with_local_result_dir.yml" + }.run() + } } diff --git a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosDoctorCommandTest.kt b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosDoctorCommandTest.kt index b22c5e6084..f5735aed5a 100644 --- a/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosDoctorCommandTest.kt +++ b/test_runner/src/test/kotlin/ftl/cli/firebase/test/ios/IosDoctorCommandTest.kt @@ -3,7 +3,6 @@ package ftl.cli.firebase.test.ios import com.google.common.truth.Truth.assertThat import ftl.cli.firebase.test.INVALID_YML_PATH import ftl.cli.firebase.test.SUCCESS_VALIDATION_MESSAGE -import ftl.cli.firebase.test.android.AndroidDoctorCommand import ftl.config.FtlConstants import ftl.test.util.FlankTestRunner import ftl.test.util.TestHelper.normalizeLineEnding @@ -71,9 +70,16 @@ class IosDoctorCommandTest { @Test(expected = YmlValidationError::class) fun `should terminate with exit code 1 when yml validation fails`() { - AndroidDoctorCommand().run { + IosDoctorCommand().run { configPath = INVALID_YML_PATH run() } } + + @Test + fun `ios doctor should not fail on local-result-dir`() { + IosDoctorCommand().apply { + configPath = FtlConstants.defaultIosConfig + }.run() + } } diff --git a/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-with_local_result_dir.yml b/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-with_local_result_dir.yml new file mode 100644 index 0000000000..46ac8e324b --- /dev/null +++ b/test_runner/src/test/kotlin/ftl/fixtures/test_app_cases/flank-with_local_result_dir.yml @@ -0,0 +1,6 @@ +gcloud: + app: ./src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk + test: ./src/test/kotlin/ftl/fixtures/tmp/apk/app-single-success-debug-androidTest.apk + results-dir: test_dir_2 +flank: + local-result-dir: flank