Skip to content

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Mar 27, 2025

Adds a runfiles tree to the input and also runs the test with path mapping enabled.

@fmeum fmeum requested a review from a team as a code owner March 27, 2025 10:30
@fmeum fmeum requested review from Copilot and removed request for a team March 27, 2025 10:30
@github-actions github-actions bot added team-Remote-Exec Issues and PRs for the Execution (Remote) team awaiting-review PR is awaiting review from an assigned reviewer labels Mar 27, 2025
@fmeum fmeum requested a review from tjgq March 27, 2025 10:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to improve test coverage of the remote worker functionality by adding a runfiles tree input and enabling tests with conditional path mapping. Key changes include:

  • Parameterizing the test method with a boolean flag (enablePathMapping) to control path mapping behavior.
  • Adding a runfiles tree setup for tool artifacts and updating assertions to include directories.
  • Updating persistent worker key hash values based on the enablePathMapping parameter.
Comments suppressed due to low confidence (2)

src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java:2335

  • [nitpick] Consider renaming 'toolDat' to a more descriptive name such as 'toolData' to improve clarity.
Artifact toolDat = ActionsTestUtil.createArtifact(artifactRoot, "tool.dat");

src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java:2367

  • [nitpick] The persistent worker key hash literals are duplicated across the test; consider extracting them as constants to reduce potential inconsistencies and improve maintainability.
enablePathMapping ? "0d8336db089ad9f8754f8c551c6c38430e506becfa06508aeebcfbc4530a6c69" : "b218f80e9b457a2b84a130e75266bda866876f9b6b1ca576334ee0fe7961abac"

@fmeum fmeum force-pushed the path-mapped-tool-files branch from e86555f to 7fc368e Compare March 27, 2025 10:36
@fmeum
Copy link
Collaborator Author

fmeum commented Mar 27, 2025

@tjgq I pushed a new commit to make the runfiles layout more realistic, which is needed for the test to keep passing with my planned changes.

@tjgq tjgq added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 14, 2025
fmeum added 2 commits April 14, 2025 17:53
Adds a runfiles tree to the input and also runs the test with path mapping enabled.
@fmeum fmeum force-pushed the path-mapped-tool-files branch from fe93556 to c79dd56 Compare April 14, 2025 16:14
@fmeum fmeum requested a review from tjgq April 14, 2025 16:14
@fmeum
Copy link
Collaborator Author

fmeum commented Apr 14, 2025

I resolved the conflict.

.setValue(
"628637504c26bb74fb6bb3f60fb7132b3aa574b866db4181770774882a8853e5"))
enablePathMapping
? "85e3ad12f36ccb7b5eddbfe8f6bc28f57004634c537faac32d33a30b8d456bb8"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to compute these hashes from the respective paths? In particular, we need to take into account the product name (outputs paths will be blaze-out/... instead of bazel-out/... when we run these tests internally)

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, nevermind; it doesn't look like the paths in this test contain the product name (the tests are failing internally but it must be some other reason - let me take a look)

Copy link
Contributor

@tjgq tjgq Apr 15, 2025

Choose a reason for hiding this comment

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

Oh, it's the TestConstants.WORKSPACE_NAME (it's google3 instead of _main internally).

I guess there isn't a better way to do this than switch on the workspace name, since computing the persistentWorkerKey using the production logic defeats the point of the test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I rewrote the test to avoid 1) any hardcoded digests and 2) access to non-root directories in the Merkle tree, which will help preserve the test as is when I change the Merkle tree computation.

@fmeum fmeum requested review from Copilot and tjgq April 15, 2025 13:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • src/test/java/com/google/devtools/build/lib/remote/BUILD: Language not supported
Comments suppressed due to low confidence (2)

src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java:2337

  • [nitpick] Consider renaming 'toolDat' to 'toolData' for improved clarity.
Artifact toolDat = ActionsTestUtil.createArtifact(artifactRoot, "tool.dat");

src/test/java/com/google/devtools/build/lib/remote/RemoteExecutionServiceTest.java:2330

  • Consider adding explicit test cases for when 'enablePathMapping' is true and false to ensure both scenarios are adequately covered.
public void buildRemoteActionForRemotePersistentWorkers(@TestParameter boolean enablePathMapping) throws Exception {

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 16, 2025
@fmeum fmeum deleted the path-mapped-tool-files branch April 23, 2025 10:33
fmeum added a commit to fmeum/bazel that referenced this pull request Apr 25, 2025
Adds a runfiles tree to the input and also runs the test with path mapping enabled.

Closes bazelbuild#25713.

PiperOrigin-RevId: 748303401
Change-Id: I5cc8b9954424a045b3a6bf62aff3984b582a7ab5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants