Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a65026

Browse filesBrowse files
jbatswast
authored andcommitted
bigquery: add system test for dataset update with etag (#4052)
1 parent 2df7adb commit 8a65026
Copy full SHA for 8a65026

File tree

Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-1
lines changed

‎bigquery/tests/system.py

Copy file name to clipboardExpand all lines: bigquery/tests/system.py
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import six
2626

27+
from google.api.core.exceptions import PreconditionFailed
2728
from google.cloud import bigquery
2829
from google.cloud.bigquery.dataset import Dataset, DatasetReference
2930
from google.cloud.bigquery.table import Table
@@ -158,7 +159,11 @@ def test_update_dataset(self):
158159
ds3 = Config.CLIENT.update_dataset(ds2, ['labels'])
159160
self.assertEqual(ds3.labels, {'color': 'green', 'shape': 'circle'})
160161

161-
# TODO(jba): test that read-modify-write with ETag works.
162+
# If we try to update using d2 again, it will fail because the
163+
# previous update changed the ETag.
164+
ds2.description = 'no good'
165+
with self.assertRaises(PreconditionFailed):
166+
Config.CLIENT.update_dataset(ds2, ['description'])
162167

163168
def test_list_datasets(self):
164169
datasets_to_create = [

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.