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

feat: integration test for the psl sink and source #22

Merged
merged 2 commits into from
Aug 12, 2021

Conversation

palmere-google
Copy link
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

@palmere-google palmere-google requested a review from a team as a code owner July 28, 2021 15:53
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 28, 2021
@palmere-google palmere-google requested a review from a team as a code owner July 28, 2021 20:34
@palmere-google palmere-google force-pushed the palmere-dev-test branch 5 times, most recently from 6c930f1 to f7008c6 Compare July 30, 2021 20:46
.collect(Collectors.toList()))
.get();

while (CollectSink.values().size() < 100) {
Copy link
Contributor

Choose a reason for hiding this comment

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

fewer magic constants if you could- I think INTEGER_STRINGS.size()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's much clearer


Publisher<MessageMetadata> publisher = getPublisher();

StreamExecutionEnvironment env =
Copy link
Contributor

Choose a reason for hiding this comment

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

put in SetUp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


// A testing sink which stores messages in a static map to prevent them from being lost when
// the sink is serialized.
private static class CollectSink implements SinkFunction<String>, Serializable {
Copy link
Contributor

Choose a reason for hiding this comment

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

make its own class- independently useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do in another pr

// the sink is serialized.
private static class CollectSink implements SinkFunction<String>, Serializable {
// Note: doesn't store duplicates.
private static final Set<String> collector = Collections.synchronizedSet(new HashSet<>());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. Instead, I'd use a private static local HashSet, and add synchronized on the methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to nack this. It's a bit weird since there are some instance methods and some class methods - I think using synchronized invites someone to hold an object level lock when they should be holding the class lock

@palmere-google palmere-google merged commit 1c654d1 into master Aug 12, 2021
@palmere-google palmere-google deleted the palmere-dev-test branch August 12, 2021 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants