-
Notifications
You must be signed in to change notification settings - Fork 118
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
#816 Omit environment-variables
for robo test executions instead of throwing exception.
#826
#816 Omit environment-variables
for robo test executions instead of throwing exception.
#826
Conversation
Codecov Report
@@ Coverage Diff @@
## master #826 +/- ##
============================================
- Coverage 81.27% 81.23% -0.05%
+ Complexity 641 637 -4
============================================
Files 166 167 +1
Lines 3237 3240 +3
Branches 463 463
============================================
+ Hits 2631 2632 +1
- Misses 342 343 +1
- Partials 264 265 +1 |
Now i have added fast fail for environment-variables. In testlab docs I cannot find any information about unsupported params in robo test. Maybe anyone have more informations? |
That's a great question. I think it's mostly trial and error at this point. We could also ask on #test-lab in the https://firebase.community/ Slack. |
@@ -1362,6 +1362,24 @@ AndroidArgs | |||
) | |||
} | |||
} | |||
|
|||
@Test(expected = FlankFatalError::class) | |||
fun `should fast fail wen robo test have env variables set`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun `should fast fail wen robo test have env variables set`() { | |
fun `should fast fail when the robo test has env variables set`() { |
@@ -131,7 +131,9 @@ class AndroidArgs( | |||
if (roboDirectives.isNotEmpty() && roboScript != null) throw FlankFatalError( | |||
"Options robo-directives and robo-script are mutually exclusive, use only one of them." | |||
) | |||
|
|||
if (isRoboTest && environmentVariables.isNotEmpty()) throw FlankFatalError( | |||
"Environment Variables not supported on Android Robo tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Environment Variables not supported on Android Robo tests" | |
"Environment variables are not currently supported on Android Robo tests" |
release_notes.md
Outdated
@@ -10,7 +10,7 @@ | |||
- [#812](https://github.com/Flank/flank/issues/812) Convert bitrise macOS workflow to github action. ([piotradamczyk5](https://github.com/piotradamczyk5)) | |||
- [#799](https://github.com/Flank/flank/pull/799) Refactor Shared object by splitting it into smaller functions. ([piotradamczyk5](https://github.com/piotradamczyk5)) | |||
- [#798](https://github.com/Flank/flank/pull/798) Remove failure nodes from tests that passed on retry so that Jenkins JUnit plugin marks them as successful. ([adamfilipow92](https://github.com/adamfilipow92)) | |||
- | |||
- [#826](https://github.com/Flank/flank/pull/826) Fast fail for unsupported params in robo test. ([adamfilipow92](https://github.com/adamfilipow92)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- [#826](https://github.com/Flank/flank/pull/826) Fast fail for unsupported params in robo test. ([adamfilipow92](https://github.com/adamfilipow92)) | |
- [#826](https://github.com/Flank/flank/pull/826) Fast fail when using `environment-variables` in a robo test. ([adamfilipow92](https://github.com/adamfilipow92)) |
04fd071
to
ba0492d
Compare
environment-variables
in a robo test.
Today, I checked #test-lab and I seen your thread. We got information about rest of TestSetup variables. "All of the other options in TestSetup etc should work for any test type." So maybe we should dedicate this pull request for Let me know what do you think. |
environment-variables
in a robo test.environment-variables
in a robo test.
@bootstraponline |
Maybe it's possible to just omit env variables for robo test executions instead of throwing exception? Exceptions are good when there are missing data but here we have additional data that is probably not needed for robo tests. |
That was my idea as well, +1 |
That makes sense to me. In the future, FTL may add env variable support for Robo tests. At that time, we'll want to remove this. |
@@ -131,7 +131,9 @@ class AndroidArgs( | |||
if (roboDirectives.isNotEmpty() && roboScript != null) throw FlankFatalError( | |||
"Options robo-directives and robo-script are mutually exclusive, use only one of them." | |||
) | |||
|
|||
if (isRoboTest && environmentVariables.isNotEmpty()) throw FlankFatalError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omit env variables for robo test executions instead of throwing exception
48fdf07
to
a390983
Compare
environment-variables
in a robo test.environment-variables
for robo test executions instead of throwing exception.
internal fun TestSetup.setEnvironmentVariables(args: AndroidArgs, testConfig: AndroidTestConfig) = this.apply { | ||
environmentVariables = if (args.environmentVariables.isNotEmpty() && testConfig is AndroidTestConfig.Instrumentation) { | ||
args.environmentVariables.map { it.toEnvironmentVariable() } | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
braces are redundant for this if-else expression
@@ -28,6 +29,15 @@ object GcAndroidTestMatrix { | |||
value = [email protected] | |||
} | |||
|
|||
@VisibleForTesting | |||
internal fun TestSetup.setEnvironmentVariables(args: AndroidArgs, testConfig: AndroidTestConfig) = this.apply { | |||
environmentVariables = if (args.environmentVariables.isNotEmpty() && testConfig is AndroidTestConfig.Instrumentation) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args.environmentVariables.isNotEmpty()
is redundant check, because is nothing wrong with running args.environmentVariables.map { it.toEnvironmentVariable() }
on empty args
@@ -28,6 +29,15 @@ object GcAndroidTestMatrix { | |||
value = [email protected] | |||
} | |||
|
|||
@VisibleForTesting | |||
internal fun TestSetup.setEnvironmentVariables(args: AndroidArgs, testConfig: AndroidTestConfig) = this.apply { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extension deserves for dedicated file. Check out setupAndroidTest
for example.
flank: | ||
max-test-shards: ${AVAILABLE_SHARD_COUNT_RANGE.last} | ||
max-test-shards: 50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be merged with latest master
9c1c8c7
to
6dfc957
Compare
Fixes #816
Checklist