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

Omit missing app apk if additional-app-test-apks specified #801

Merged
merged 3 commits into from
May 27, 2020

Conversation

jan-goral
Copy link
Contributor

@jan-goral jan-goral commented May 20, 2020

Fixes #800

Checklist

  • Documented
  • Unit tested
  • release_notes.md updated

@jan-goral jan-goral self-assigned this May 20, 2020
@jan-goral jan-goral changed the title Omit global app apk if additional-app-test-apks specified Omit missing app apk if additional-app-test-apks specified May 20, 2020
@jan-goral jan-goral marked this pull request as ready for review May 20, 2020 01:10
@codecov-commenter
Copy link

codecov-commenter commented May 20, 2020

Codecov Report

Merging #801 into master will increase coverage by 0.04%.
The diff coverage is 84.21%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #801      +/-   ##
============================================
+ Coverage     78.77%   78.82%   +0.04%     
+ Complexity      696      669      -27     
============================================
  Files           143      148       +5     
  Lines          2950     2966      +16     
  Branches        423      431       +8     
============================================
+ Hits           2324     2338      +14     
  Misses          354      354              
- Partials        272      274       +2     

@bootstraponline
Copy link
Contributor

bootstraponline commented May 20, 2020

Should we also omit missing test apk when using additiona-app-test-apks? I think Fladle wanted to specify all the app/test apks via additional-app-test-apks.

The PR title and release note only mention the app apk. Maybe the test apk is already optional?

@runningcode
Copy link
Contributor

runningcode commented May 20, 2020

Hey, thank you very much for doing this. Yes @bootstraponline is correct that we want to specify all app/test apks via additional app test apks.

That being said, and I really appreciate this change, after having implemented the plugin I think I am unlikely to take advantage of this API for now. Many of the largers companies who require automatically specifying their additional test apks will be stuck on flank 8.1.0 for the foreseeable future until firebase test lab supports more than 50 shards. If Fladle were to take advantage of this new API, it would not be backward compatible anymore.

That being said, I really hope google will change their mind about the 50 shard limitation and this api will greatly simplify this part of the code: https://github.com/runningcode/fladle/blob/master/buildSrc/src/main/java/com/osacky/flank/gradle/FulladlePlugin.kt#L42

@bootstraponline
Copy link
Contributor

@runningcode I already persuaded FTL to increase the limit, it will be raised to 250 in a few weeks. We will probably be breaking backwards compatibility in the next release. #792

https://firebase-community.slack.com/archives/C1MTSQ5QT/p1589242467494100?thread_ts=1589239891.491600

@jan-goral
Copy link
Contributor Author

Should we also omit missing test apk when using additiona-app-test-apks? I think Fladle wanted to specify all the app/test apks via additional-app-test-apks.

The PR title and release note only mention the app apk. Maybe the test apk is already optional?

Yes, test apk was already optional because robo tests requires only app apk

Copy link
Contributor

@pawelpasterz pawelpasterz left a comment

Choose a reason for hiding this comment

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

The only thing that bothers me is NPE, which I think is bad practise

).plus(
elements = additionalAppTestApks.map {
ResolvedApks(
app = it.app ?: appApk,
app = it.app ?: appApk!!,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think should throw here custom exception, not nasty NPE (which should not happen in kotlin app)

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed, I don't like force unwraps in the production code.

)
}

@Test(expected = Exception::class)
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to previous comment about NPE. We should check here for this particular custom exception.

@@ -104,13 +104,17 @@ class AndroidArgs(
override val hasMultipleExecutions: Boolean get() = super.hasMultipleExecutions || additionalAppTestApks.isNotEmpty()

init {
if (appApk == null) additionalAppTestApks.filter { (app, _) -> app == null }.let { missingApks ->
if (missingApks.isNotEmpty()) throw FlankFatalError("Cannot resolve app apk pair for ${missingApks.map { it.test }}")
Copy link
Contributor

Choose a reason for hiding this comment

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

I am wondering if it wasn't be better to print just apk file name not full path to file. For many (potential) incorrect pairs it would be hard to read something.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree a file name is easier to read. I think the full path will be useful when debugging problems in CI where the paths aren't obvious though. Maybe we could print each missing path on a new line to improve readability?

@@ -243,7 +243,7 @@ class AndroidRunCommand : CommonRunCommand(), Runnable {
// AndroidFlankYml

@Option(
names = ["--additional-app-test-apks"],
names = ["--app-test-apks", "--additional-app-test-apks"],
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably keep the flags 1:1 mapping with the yaml. --app-test-apks isn't a valid key name in the yaml.

@pawelpasterz pawelpasterz merged commit 27fdcb4 into master May 27, 2020
@pawelpasterz pawelpasterz deleted the 800-app-test-apks branch May 27, 2020 06:08
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.

Ignore missing app & test if additional-app-test-apks are specified
5 participants