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

#816 Omit environment-variables for robo test executions instead of throwing exception. #826

Merged
merged 9 commits into from
Jun 4, 2020

Conversation

adamfilipow92
Copy link
Contributor

@adamfilipow92 adamfilipow92 commented May 29, 2020

Fixes #816

Checklist

  • Unit tested
  • release_notes.md updated

@adamfilipow92 adamfilipow92 changed the title Add test case and fast fail on env filled on robo test Fast fail on env filled on robo test May 29, 2020
@codecov-commenter
Copy link

codecov-commenter commented May 29, 2020

Codecov Report

Merging #826 into master will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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     

@adamfilipow92 adamfilipow92 marked this pull request as draft May 29, 2020 15:37
@adamfilipow92 adamfilipow92 changed the title Fast fail on env filled on robo test Better validation for unsupported params in robo test May 29, 2020
@adamfilipow92 adamfilipow92 changed the title Better validation for unsupported params in robo test Fast fail for unsupported params in robo test May 29, 2020
@adamfilipow92
Copy link
Contributor Author

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?
@pawelpasterz @jan-gogo @bootstraponline @piotradamczyk5

@bootstraponline
Copy link
Contributor

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`() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [#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))

@adamfilipow92 adamfilipow92 force-pushed the #816-fast-fail-on-unsupported-robo-params branch from 04fd071 to ba0492d Compare June 1, 2020 12:05
@adamfilipow92 adamfilipow92 changed the title Fast fail for unsupported params in robo test Fast fail when using environment-variables in a robo test. Jun 1, 2020
@adamfilipow92
Copy link
Contributor Author

adamfilipow92 commented Jun 1, 2020

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.

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 environment-variables and if in thread we get more informations we make new issue. Additionally I checked this docs: https://firebase.google.com/docs/test-lab/reference/testing/rest/v1/projects.testMatrices#environmentvariable
I can't found more informations about unsupported variables in any test type.

Let me know what do you think.
@bootstraponline

@adamfilipow92 adamfilipow92 marked this pull request as ready for review June 1, 2020 12:41
@adamfilipow92 adamfilipow92 changed the title Fast fail when using environment-variables in a robo test. #816 Fast fail when using environment-variables in a robo test. Jun 1, 2020
@pawelpasterz
Copy link
Contributor

pawelpasterz commented Jun 1, 2020

@bootstraponline
With #817 flank gained ability to run both robo and instrumentation tests within one run. With this fail fast approach this feature will impossible to use if one wants to have env variables. Is it something we agree on? (I think it is more like design decision)

@jan-goral
Copy link
Contributor

jan-goral commented Jun 1, 2020

@bootstraponline
With #817 flank gained ability to run both robo and instrumentation tests within one run. With this fail fast approach this feature will impossible to use if one wants to have env variables. Is it something we agree on? (I think it is more like design decision)

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.

@pawelpasterz
Copy link
Contributor

pawelpasterz commented Jun 1, 2020

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

@bootstraponline
Copy link
Contributor

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 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(
Copy link
Contributor

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

@adamfilipow92 adamfilipow92 force-pushed the #816-fast-fail-on-unsupported-robo-params branch from 48fdf07 to a390983 Compare June 3, 2020 13:43
@adamfilipow92 adamfilipow92 changed the title #816 Fast fail when using environment-variables in a robo test. #816 Omit environment-variables for robo test executions instead of throwing exception. Jun 3, 2020
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 {
Copy link
Contributor

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) {
Copy link
Contributor

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 {
Copy link
Contributor

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
Copy link
Contributor

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

@adamfilipow92 adamfilipow92 force-pushed the #816-fast-fail-on-unsupported-robo-params branch from 9c1c8c7 to 6dfc957 Compare June 4, 2020 11:36
@adamfilipow92 adamfilipow92 merged commit 81303e5 into master Jun 4, 2020
@adamfilipow92 adamfilipow92 deleted the #816-fast-fail-on-unsupported-robo-params branch June 4, 2020 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better validation for unsupported params in robo test
6 participants