Skip to content
This repository was archived by the owner on Aug 31, 2022. It is now read-only.

Shading tolerant version reading #194

Merged
merged 4 commits into from
Dec 11, 2018

Conversation

danielnorberg
Copy link
Contributor

Hey, I just made a Pull Request!

Description

Shading tolerant version reading

Motivation and Context

If users (e.g. MC) shades flo-runner, we currently log an incorrect flo runner version.

Have you tested this? If so, how?

Checklist for PR author(s)

  • Changes are covered by unit test
  • All tests pass
  • Code coverage check passes
  • Error handling is tested
  • Errors are handled at the appropriate layer
  • Errors that cannot be handled where they occur are propagated
  • Relevant documentation updated
  • This PR has NO breaking change to public API
  • This PR has breaking change to public API and it is documented

Checklist for PR reviewer(s)

  • This PR has been incorporated in release note for the coming version
  • Risky changes introduced by this PR have been all considered

}

private static String readFloRunnerVersion() {
final String resource = "/com/spotify/flo/flo-runner.version";
Copy link
Contributor

Choose a reason for hiding this comment

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

If flo is shaded won't this path be different then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is relocated yes, but the shading plugin then also updates this string to reflect that. Added tests for that.

public void shouldReadFloVersion() throws IOException {
final String expectedVersion;
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(
Version.class.getResourceAsStream("/com/spotify/flo/flo-runner.version")))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test should never be shaded.

@NatashaL
Copy link
Contributor

NatashaL commented Dec 6, 2018

Other than the test failing due to memory, this looks good to me 👍

@NatashaL
Copy link
Contributor

Tried a fix here #198 although not sure if it's the best approach. @danielnorberg ptal

@danielnorberg danielnorberg force-pushed the shading-tolerant-version-reading branch from 9791113 to 8f15261 Compare December 11, 2018 01:51
@danielnorberg danielnorberg merged commit 09fe382 into master Dec 11, 2018
@NatashaL NatashaL deleted the shading-tolerant-version-reading branch December 11, 2018 09:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants