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

Remove Orchestrator's single method fast path #2133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PhilGlass
Copy link

Overview

Fixes #2132.

Orchestrator has a fast path that skips test discovery if the test target is a single method. This doesn't work for parameterized tests, since even a single method target may expand to any number of parameterized test instances.

Proposed Changes

Remove the fast path and always run test discovery, because I don't think it's possible to know ahead of time whether a test target expands to exactly 1 test.

Tested locally by running:

bazelisk build :axt_m2repository
unzip bazel-bin/axt_m2repository.zip -d ~/.m2/

and running one of the parameterised tests in our repo against the 1.5.0-alpha03 orchestrator artifacts in ~/.m2 (mavenLocal() in Gradle build scripts).

getOutputStream(),
AndroidTestOrchestrator.this));
}
Log.i(TAG, "Starting test collection");
Copy link
Collaborator

Choose a reason for hiding this comment

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

this change looks reasonable but I'm concerned over the performance impact on the 'normal' case of just running a single, non-parameterized method. Test discovery will require launching and killing the target app process, so for large apps its not cheap.

Notably, some environments use a host-side based test collection mechanism. So with this change those environments might run test discovery twice.

Copy link
Author

Choose a reason for hiding this comment

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

That's very fair. I suppose there are a few alternatives:

  • Just accept and ideally document this wart for parameterized tests.
  • Some kind of speculative single-method execution path that would keep the current behaviour in the common case where it really is just 1 test, or report a list of tests back to orchestrator in the parameterized case.

But you may well have some better suggestions, I'm not that familar with the internals of androidx.test. 😅

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.

Orchestrator sometimes runs all the instances of a parameterized test in the same process
2 participants