envoyproxy / envoyproxy/envoy-mobile
An ability to run tests on Android emulator
- Dominant language
- Java
- Stars
- 566
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
Add a support for running Android tests on Android emulator to properly test all code that runs when Envoy Mobile runs on real Android devices.
Some of the code that's executed when Envoy Mobile runs on Android is hidden behind a compiler flag check that looks as follow: `#if defined(__ANDROID_API__)`. For example: https://github.com/envoyproxy/envoy-mobile/blob/4cf9236a0e1ce23d48d6202bbfc25820d88d7f03/library/common/jni/android_jni_utility.cc#L19
To properly test this code Envoy Mobile has to be build under android cc tool chain and the app (or test host) has to run on an emulator or a real device. As of now, there are no option to run tests like this in Envoy Mobile repo. Since testing of such code is impossible it's currently untested which leads to issues like https://github.com/envoyproxy/envoy-mobile/issues/2432.
On the surface it seems that we could add support for running Android tests on emulator by using `android_instrumentation_test` macro that's documented in [here](https://docs.bazel.build/versions/main/android-instrumentation-test.html). There is a GH issue https://github.com/bazelbuild/bazel/issues/7069 which seems to suggest that this specific bazel macro does not currently work on macOS. That should not be a problem if we are OK with running these tests on Linux machine.
Contributor guide
Assessment
This issue has not been assessed yet.