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

test: Optimize quota usage in IT #1825

Merged
merged 3 commits into from
Apr 22, 2021
Merged

Conversation

pawelpasterz
Copy link
Contributor

@pawelpasterz pawelpasterz commented Apr 21, 2021

PR introduces a category approach in IT. Tests are divided into AndroidTest and IosTest category. It can be achieved with annotating tests with either @Category(AndroidTest::class) or @Category(IosTest::class)

Changes:

There are slightly different rules applied to each category.
AndroidTest category:

  • runs in parallel
  • no fail-fast
  • runs first

IosTest category:

  • runs tests sequentially
  • with fail-fast
  • depends on AndroidTest category

For each category 2 new gradle tasks were created instrumentationTestsAnroid and instrumentationTestsIos -- each runs corresponding category.

instrumentationTests task was refactored and now it depends on android and ios tasks, forcing android category tests to run before iOS

Great, but what does it give us actually?

Flank project keeps facing exceeded quota problem, mainly due to iOS tests that use physical devices.

With proposed changes, flank first runs android tests. If 'common' logic (meaning, shared by both android and ios) tests will fail, only virtual devices will be used. Since flank has like 2-3x more android tests we keep parallel settings to make it faster.

Once android category is done, ios starts. A combination of sequential run and fail-fast: true will terminate the test run with a minimal number of devices used to detect a problem.

To sum up:
➕ test coverage is the same
➕ we burn less quota if a problem is found
➖ full IT run takes more time, locally, on my machine its 16m 40s old vs 19m 12s new -- so it's about +15% longer time run

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@mergify
Copy link

mergify bot commented Apr 21, 2021

Title does not follow the guidelines of Conventional Commits.
Please adjust title before merge and use one of following prefix:

  • build - Changes that affect the build system or external dependencies (dependencies update)
  • ci - Changes to our CI configuration files and scripts (basically directory .github/workflows)
  • docs - Documentation only changes
  • feat - A new feature
  • fix - A bug fix
  • chore - Changes which does not touch the code (ex. manual update of release notes). It will not generate release notes changes
  • refactor - A code change that contains refactor
  • style - Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test - Adding missing tests or correcting existing tests and also changes for our test app
  • perf - A code change that improves performance (I do not think we will use it)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2021

Timestamp: 2021-04-22 12:41:18
Buildscan url for ubuntu-workflow run 774192996
https://gradle.com/s/ssvcl6oksjtgc

@pawelpasterz pawelpasterz changed the title tests: Optimize quota usage in IT test: Optimize quota usage in IT Apr 21, 2021
Copy link
Contributor

@Sloox Sloox left a comment

Choose a reason for hiding this comment

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

Good idea 👍

useJUnit {
includeCategories = setOf("integration.config.AndroidTest")
excludeCategories = setOf("integration.config.IosTest")
}
testLogging {
events("skipped", "failed")
exceptionFormat = TestExceptionFormat.FULL
}
maxParallelForks = Runtime.getRuntime().availableProcessors() / 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Lets remove this and see if it speeds it up.

Copy link
Contributor

Choose a reason for hiding this comment

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

i.e.:

Suggested change
maxParallelForks = Runtime.getRuntime().availableProcessors() / 2
maxParallelForks = Runtime.getRuntime().availableProcessors()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not, let's give it a try 👍🏻

@mergify
Copy link

mergify bot commented Apr 21, 2021

Title does not follow the guidelines of Conventional Commits.
Please adjust title before merge and use one of following prefix:

  • build - Changes that affect the build system or external dependencies (dependencies update)
  • ci - Changes to our CI configuration files and scripts (basically directory .github/workflows)
  • docs - Documentation only changes
  • feat - A new feature
  • fix - A bug fix
  • chore - Changes which does not touch the code (ex. manual update of release notes). It will not generate release notes changes
  • refactor - A code change that contains refactor
  • style - Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test - Adding missing tests or correcting existing tests and also changes for our test app
  • perf - A code change that improves performance (I do not think we will use it)

@pawelpasterz
Copy link
Contributor Author

As a follow-up task we can think of implementing additional comment triggers for each category (i.e.: @flank-it-android, @flank-it-ios)

@github-actions
Copy link
Contributor

Integration tests were triggered at 2021-04-21 08:26:16, you can track progress here

@pawelpasterz
Copy link
Contributor Author

Integration tests were triggered at 2021-04-21 08:26:16, you can track progress here

Damn 😅

@mergify mergify bot merged commit d4875c7 into master Apr 22, 2021
@mergify mergify bot deleted the optimize-quota-usage-for-it branch April 22, 2021 12:45
@github-actions github-actions bot locked and limited conversation to collaborators Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants