Skip to content

Comments

Fix cross-test interference in SingleLensModeTest#481

Merged
temcguir merged 1 commit intomainfrom
temcguir/single_lens_camera_test_stability
Feb 19, 2026
Merged

Fix cross-test interference in SingleLensModeTest#481
temcguir merged 1 commit intomainfrom
temcguir/single_lens_camera_test_stability

Conversation

@temcguir
Copy link
Collaborator

Added CameraXResetRule to ensure CameraX is shut down before and after
tests that require specific configuration (e.g. SingleLensModeTest).
This prevents failures where a previous test initializes CameraX, causing
subsequent calls to ProcessCameraProvider.configureInstance to be
ignored, and ensures SingleLensModeTest doesn't pollute the state for
subsequent tests. This allows the test to be run in a non-orchestrator
environment without affecting other tests.

The rule uses ProcessCameraProvider.shutdownAsync() to perform the reset
with a 10-second timeout to prevent indefinite hanging while allowing
sufficient time for resource release. To ensure this method is available
at runtime in the test process, androidx.camera:camera-lifecycle was
added as a test dependency.

@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Added CameraXResetRule to ensure CameraX is shut down before and after
tests that require specific configuration (e.g. SingleLensModeTest).
This prevents failures where a previous test initializes CameraX, causing
subsequent calls to ProcessCameraProvider.configureInstance to be
ignored, and ensures SingleLensModeTest doesn't pollute the state for
subsequent tests. This allows the test to be run in a non-orchestrator
environment without affecting other tests.

The rule uses ProcessCameraProvider.shutdownAsync() to perform the reset
with a 10-second timeout to prevent indefinite hanging while allowing
sufficient time for resource release. To ensure this method is available
at runtime in the test process, androidx.camera:camera-lifecycle was
added as a test dependency.
@temcguir temcguir force-pushed the temcguir/single_lens_camera_test_stability branch from 6a8feaf to 4fcf83d Compare February 19, 2026 07:22
@temcguir
Copy link
Collaborator Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a CameraXResetRule to prevent test interference by resetting CameraX state between tests. This is a great addition for improving test stability. The implementation is solid, adding the necessary dependency and applying the rule where needed. I've suggested one improvement to the CameraXResetRule implementation to simplify it by using a more direct static API from CameraX, which makes the utility more robust and easier to read.

@temcguir temcguir merged commit 43c2774 into main Feb 19, 2026
13 of 14 checks passed
@temcguir temcguir deleted the temcguir/single_lens_camera_test_stability branch February 19, 2026 21:24
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.

2 participants