-
Notifications
You must be signed in to change notification settings - Fork 92
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(spanner): add samples for instance partitions #1168
feat(spanner): add samples for instance partitions #1168
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
samples/samples/snippets_test.py
Outdated
@@ -188,6 +195,33 @@ def test_create_instance_with_autoscaling_config(capsys, lci_instance_id): | |||
retry_429(instance.delete)() | |||
|
|||
|
|||
def test_create_instance_partition(capsys, instance_partition_instance_id): | |||
spanner_client = spanner.Client() | |||
operation = spanner_client.instance_admin_api.create_instance( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we follow one of the 2 approaches,
- We can re-use existing instance that is already created in
def test_create_instance_explicit(spanner_client, create_instance_id):
This will prevent instance creation time when running tests and also reduce the no of instances that get created.
This test can be marked as dependent to the instance creation test like
@pytest.mark.dependency(name="create_instance_config") |
- If above one is complicated, then can we directly use snippets.create_instance to create an instance instead of rewriting the create logic here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented Approach 2. The challenge with reusing an existing instance is that there are several restrictions around instance partitions. Notably:
- An instance partition cannot have the same instance config as the parent instance
- Several Spanner features do not work in instances where the user has created one or more instance partitions.
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:
Fixes #<issue_number_goes_here> 🦕