Skip to content

Conversation

@jackdingilian
Copy link
Contributor

Adds BigtableClientOverride interface to provide a way to override client settings we need to change for testing.


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

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • 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.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@jackdingilian
Copy link
Contributor Author

@tonytanger

@tonytanger
Copy link
Contributor

LGTM

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @kennknowles for label java.
R: @chamikaramj for label io.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

/**
* Returns a new {@link BigtableIO.ReadChangeStream} that overrides the config of data and/or
* admin client for streaming changes and for managing the metadata. For testing purposes only.
* Not intended for use.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this is useful also for regional endpoints or some such? (no action required - it is certainly always easier to make things more visible than less visible)


@VisibleForTesting
BigtableConfig withBigtableClientOverride(BigtableClientOverride clientOverride) {
checkArgument(clientOverride != null, "clientOverride can not be null");
Copy link
Member

Choose a reason for hiding this comment

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

If someone has set the override and you want to clear it, how do you do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, I guess this check isn't really necessary. I'll remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

on second thought, all of the other withParameter functions here have similar null checks that wouldn't allow overrides.

I'm leaning towards keeping this to be consistent. I don't think there's a good reason to ever set this and then clear it.

Copy link
Member

Choose a reason for hiding this comment

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

OK that seems fine. It is backwards-compatible to start to allow nulls as a way to re-clear it. One reason to allow nulls is to allow someone to make a copy without forcing them to if (!= null) { set it } but just be able to do straight-line set to same value, whether or not it is null

*
* <p>Does not modify this object.
*/
@VisibleForTesting
Copy link
Member

Choose a reason for hiding this comment

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

It says visible for testing, but there are no tests. It seems like you can test this by setting up the PipelineOptions in the test before you expand the BigTableChangeStreamsAccessor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC this would require exposing all of the override parameters as PipelineOptions to users? We use this to connect to our internal testing environment. It requires fairly complicated client settings overrides that I don't think would ever be useful to expose to users

Copy link
Member

Choose a reason for hiding this comment

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

Oh I misread the whole change and thought there were already options for this (those do tend to be useful for redirecting a whole test at a different bigtable env or local endpoint). Nevermind for now!


@VisibleForTesting
BigtableConfig withBigtableClientOverride(BigtableClientOverride clientOverride) {
checkArgument(clientOverride != null, "clientOverride can not be null");
Copy link
Member

Choose a reason for hiding this comment

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

OK that seems fine. It is backwards-compatible to start to allow nulls as a way to re-clear it. One reason to allow nulls is to allow someone to make a copy without forcing them to if (!= null) { set it } but just be able to do straight-line set to same value, whether or not it is null

*
* <p>Does not modify this object.
*/
@VisibleForTesting
Copy link
Member

Choose a reason for hiding this comment

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

Oh I misread the whole change and thought there were already options for this (those do tend to be useful for redirecting a whole test at a different bigtable env or local endpoint). Nevermind for now!

@kennknowles kennknowles merged commit 23b583b into apache:master Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants