Skip to content

Commit

Permalink
AndroidInstrumentationTestTest checks artifacts by name, not by name …
Browse files Browse the repository at this point in the history
…and configuration.

Future changes to Android rules will result in dependencies not being in the top-level target configuration, this change is to future-proof the tests.

PiperOrigin-RevId: 354352930
  • Loading branch information
katre authored and copybara-github committed Jan 28, 2021
1 parent a4cc7a2 commit cef82b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.
package com.google.devtools.build.lib.rules.android;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.truth.Truth.assertThat;
import static com.google.devtools.build.lib.actions.util.ActionsTestUtil.getFirstArtifactEndingWith;

Expand Down Expand Up @@ -175,15 +176,18 @@ public void testTestExecutableRunfiles() throws Exception {
.getDefaultRunfiles()
.getAllArtifacts()
.toList());
assertThat(runfiles)
assertThat(runfiles.stream().map(Artifact::toString).collect(toImmutableList()))
.containsAtLeast(
getDeviceFixtureScript(getConfiguredTarget("//javatests/com/app:device_fixture")),
getInstrumentationApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")),
getTargetApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")),
getDeviceFixtureScript(getConfiguredTarget("//javatests/com/app:device_fixture"))
.toString(),
getInstrumentationApk(getConfiguredTarget("//javatests/com/app:instrumentation_app"))
.toString(),
getTargetApk(getConfiguredTarget("//javatests/com/app:instrumentation_app")).toString(),
getConfiguredTarget("//javatests/com/app/ait:foo.txt")
.getProvider(FileProvider.class)
.getFilesToBuild()
.getSingleton());
.getSingleton()
.toString());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ java_test(
"//src/main/java/com/google/devtools/build/lib/rules/android",
"//src/main/java/com/google/devtools/build/lib/skyframe:configured_target_and_data",
"//src/test/java/com/google/devtools/build/lib/actions/util",
"//third_party:guava",
"//third_party:junit4",
"//third_party:truth",
],
Expand Down

0 comments on commit cef82b3

Please sign in to comment.