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

Allow APKs with zero tests without throwing an exception #741

Merged
merged 6 commits into from
Apr 29, 2020

Conversation

fondesa
Copy link
Contributor

@fondesa fondesa commented Apr 24, 2020

Description

This PR is a follow-up of our discussion on Slack about supporting APKs with zero tests.
Issue: #739

Motivation

This behaviour can be useful for projects with several Android modules.
Usually, in big projects, Flank is configured automatically on each Android module. Not configuring it automatically would be dangerous since you usually want to run all your tests on the CI without forgetting some of them.

Important notes

When the sharding is disabled, Flank already supported zero tests APK, since it supported invalid APKs. To be coherent with it, I reproduced the same behaviour when the sharding is enabled.

However, IMHO, it would be useful to distinguish an invalid APK from an APK with zero tests, regardless of whether the sharding is enabled or not. What do you think about this? In case, I could work on that too in another PR.

@bootstraponline
Copy link
Contributor

However, IMHO, it would be useful to distinguish an invalid APK from an APK with zero tests, regardless of whether the sharding is enabled or not. What do you think about this? In case, I could work on that too in another PR.

I think invalid APKs should throw an exception. APKs with zero tests should be filtered out entirely and not uploaded to gcloud.

@bootstraponline
Copy link
Contributor

apk validation is done server side by FTL, we don't have a great way to detect if an APK is valid on the client. We can detect the test counts client side though.

@fondesa
Copy link
Contributor Author

fondesa commented Apr 24, 2020

apk validation is done server side by FTL

Didn't know that, nice to know.

we don't have a great way to detect if an APK is valid on the client.

Agree, in case we can still do a light validation as optimization counting the dex files through DexParser.readDexFiles. In this way, if an APK doesn't contain dex files, we can avoid to upload it on gcloud since we already know it's an invalid APK.

@bootstraponline
Copy link
Contributor

Agree, in case we can still do a light validation as optimization counting the dex files through DexParser.readDexFiles. In this way, if an APK doesn't contain dex files, we can avoid to upload it on gcloud since we already know it's an invalid APK.

I can't trust DexParser in the future though, that's why disable sharding was added. That code path completely bypasses dex parser.
linkedin/dex-test-parser#31

The Android bytecode evolves. I removed the APK validation check because when dex parser breaks, we need a release valve that doesn't involve being able to read the bytecode. The hypershard example we're working on is related.

@fondesa
Copy link
Contributor Author

fondesa commented Apr 24, 2020

Understood, thanks for the explanation.

BTW, let me know if you want me to make some changes to this PR.

@bootstraponline
Copy link
Contributor

Thanks! I will let @pawelpasterz and @jan-gogo review the code. We're trying to make sure there's at least two engineers looking at incoming pull requests.

The code looks reasonable.

pawelpasterz
pawelpasterz previously approved these changes Apr 26, 2020
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.

Thanks for contributing!
Remember to update https://github.com/Flank/flank/blob/master/release_notes.md
:)

@pawelpasterz pawelpasterz merged commit ab719d2 into Flank:master Apr 29, 2020
@pawelpasterz pawelpasterz linked an issue Apr 29, 2020 that may be closed by this pull request
@fondesa fondesa deleted the handle-zero-test-apk branch May 11, 2020 11:03
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.

Skip apks with 0 tests instead of failing
4 participants