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

[BEAM-10080] Fix LocalFileSystemsTest to work with Java 11 #12225

Merged
merged 1 commit into from Jul 13, 2020

Conversation

kennknowles
Copy link
Member

The LocalFileSystemsTest relied on System.setProperty("user.dir") to set the working directory for file resolution, to simulate a user trying to resolve and stage files relative to where they launch their pipeline.

Setting System.setProperty("user.dir") was never intended to work, but it worked by luck up to and including Java 8. In Java 11 is no longer works. There is no replacement, short of launching a subprocess with a different working directory.

We can get adequate test coverage by calling package-private helper methods.


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Dataflow Flink Samza Spark Twister2
Go Build Status --- Build Status --- Build Status ---
Java Build Status Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status Build Status
Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
--- Build Status ---
XLang --- --- Build Status --- Build Status ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@kennknowles
Copy link
Member Author

R: @tysonjh

@kennknowles
Copy link
Member Author

Failures at https://ci-beam.apache.org/job/beam_PreCommit_Java_Commit/12269/ look like unrelated flakes.

@kennknowles
Copy link
Member Author

Run Java PreCommit

@kennknowles
Copy link
Member Author

https://ci-beam.apache.org/job/beam_PreCommit_Java_Phrase/2460/ includes these already-filed flakes:

@kennknowles
Copy link
Member Author

Run Java PreCommit

1 similar comment
@kennknowles
Copy link
Member Author

Run Java PreCommit

}

@VisibleForTesting
List<MatchResult> match(String pwd, List<String> specs) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

pwd is a bit unclear as a parameter name.

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to baseDir

// both Windows and correct file resolution.
// The root cause is that globs are not files but we are using file manipulation libraries
// to work with them.
final File relativeFile = new File(spec);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the relativeFile name to something else? It may actually be an absolute file and that would be confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to specAsFile since basically it is just cramming the string into a File object, and renamed file into absoluteFile since it is now rooted in a base directory unless it was already absolute.

Copy link
Member Author

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

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

Since you've approved with naming caveats, I'm merging the rename into existing commits instead of pushing fixup commits for further review.

}

@VisibleForTesting
List<MatchResult> match(String pwd, List<String> specs) throws IOException {
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to baseDir

// both Windows and correct file resolution.
// The root cause is that globs are not files but we are using file manipulation libraries
// to work with them.
final File relativeFile = new File(spec);
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed to specAsFile since basically it is just cramming the string into a File object, and renamed file into absoluteFile since it is now rooted in a base directory unless it was already absolute.

@kennknowles
Copy link
Member Author

https://ci-beam.apache.org/job/beam_PreCommit_Java_Commit/12328/ contains two flakes:

@kennknowles
Copy link
Member Author

Run Java PreCommit

@kennknowles
Copy link
Member Author

SparkPortableExecutionTest flake. https://issues.apache.org/jira/browse/BEAM-10460

Opened #12243 to increase the timeout, which is currently 25% higher than some success runs I've seen so there's a chance that it is just a performance or test infra flake.

@kennknowles
Copy link
Member Author

Run Java PreCommit

@kennknowles
Copy link
Member Author

Finally green!

@kennknowles kennknowles merged commit c522239 into apache:master Jul 13, 2020
@kennknowles kennknowles deleted the localfilesystem-java11 branch July 13, 2020 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants