-
Notifications
You must be signed in to change notification settings - Fork 101
docs: allow multiple KMS keys to create CMEK database/backup #1191
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
57fdb72
Removed api files
hwin16 dbd6192
Merge branch 'main' into main
harshachinta 8864875
Fixed lint errors
hwin16 df768c4
Merge branch 'main' of https://github.com/hwin16/python-spanner
hwin16 8758cad
Fixed integration tests.
hwin16 ac9da9b
Fixed lint in snippets_test.py
hwin16 d0ee59e
Merge branch 'main' into main
hwin16 cd5830e
Resolved comments from reviewer
hwin16 b8654e8
Merge branch 'main' of https://github.com/hwin16/python-spanner
hwin16 39c9393
Merge branch 'main' into main
surbhigarg92 0764f83
chore: skip tests since KMS keys are not added to test project
harshachinta e566f7a
Merge branch 'main' into main
harshachinta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,8 +13,8 @@ | |
| # limitations under the License. | ||
| import uuid | ||
|
|
||
| import pytest | ||
| from google.api_core.exceptions import DeadlineExceeded | ||
| import pytest | ||
| from test_utils.retry import RetryErrors | ||
|
|
||
| import backup_sample | ||
|
|
@@ -93,6 +93,45 @@ def test_create_backup_with_encryption_key( | |
| assert kms_key_name in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(name="create_backup_with_multiple_kms_keys") | ||
| def test_create_backup_with_multiple_kms_keys( | ||
| capsys, | ||
| multi_region_instance, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a fixture for this multi_region_instance? |
||
| multi_region_instance_id, | ||
| sample_multi_region_database, | ||
| kms_key_names, | ||
| ): | ||
| backup_sample.create_backup_with_multiple_kms_keys( | ||
| multi_region_instance_id, | ||
| sample_multi_region_database.database_id, | ||
| CMEK_BACKUP_ID, | ||
| kms_key_names, | ||
| ) | ||
| out, _ = capsys.readouterr() | ||
| assert CMEK_BACKUP_ID in out | ||
| assert kms_key_names[0] in out | ||
| assert kms_key_names[1] in out | ||
| assert kms_key_names[2] in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(depends=["create_backup_with_multiple_kms_keys"]) | ||
| def test_copy_backup_with_multiple_kms_keys( | ||
| capsys, multi_region_instance_id, spanner_client, kms_key_names | ||
| ): | ||
| source_backup_path = ( | ||
| spanner_client.project_name | ||
| + "/instances/" | ||
| + multi_region_instance_id | ||
| + "/backups/" | ||
| + CMEK_BACKUP_ID | ||
| ) | ||
| backup_sample.copy_backup_with_multiple_kms_keys( | ||
| multi_region_instance_id, COPY_BACKUP_ID, source_backup_path, kms_key_names | ||
| ) | ||
| out, _ = capsys.readouterr() | ||
| assert COPY_BACKUP_ID in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(depends=["create_backup"]) | ||
| @RetryErrors(exception=DeadlineExceeded, max_tries=2) | ||
| def test_restore_database(capsys, instance_id, sample_database): | ||
|
|
@@ -121,6 +160,26 @@ def test_restore_database_with_encryption_key( | |
| assert kms_key_name in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(depends=["create_backup_with_multiple_kms_keys"]) | ||
| @RetryErrors(exception=DeadlineExceeded, max_tries=2) | ||
| def test_restore_database_with_multiple_kms_keys( | ||
| capsys, | ||
| multi_region_instance_id, | ||
| sample_multi_region_database, | ||
| kms_key_names, | ||
| ): | ||
| backup_sample.restore_database_with_multiple_kms_keys( | ||
| multi_region_instance_id, CMEK_RESTORE_DB_ID, CMEK_BACKUP_ID, kms_key_names | ||
| ) | ||
| out, _ = capsys.readouterr() | ||
| assert (sample_multi_region_database.database_id + " restored to ") in out | ||
| assert (CMEK_RESTORE_DB_ID + " from backup ") in out | ||
| assert CMEK_BACKUP_ID in out | ||
| assert kms_key_names[0] in out | ||
| assert kms_key_names[1] in out | ||
| assert kms_key_names[2] in out | ||
|
|
||
|
|
||
| @pytest.mark.dependency(depends=["create_backup", "copy_backup"]) | ||
| def test_list_backup_operations(capsys, instance_id, sample_database): | ||
| backup_sample.list_backup_operations( | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.