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

Remove sharing dataset name across system tests. #2323

Merged
merged 1 commit into from
Sep 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions system_tests/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from system_test_utils import unique_resource_id


DATASET_NAME = 'system_tests' + unique_resource_id()
def _make_dataset_name(prefix):
return '%s%s' % (prefix, unique_resource_id())


def _rate_limit_exceeded(forbidden):
Expand Down Expand Up @@ -69,6 +70,7 @@ def tearDown(self):
doomed.delete()

def test_create_dataset(self):
DATASET_NAME = _make_dataset_name('create_dataset')
dataset = Config.CLIENT.dataset(DATASET_NAME)
self.assertFalse(dataset.exists())

Expand All @@ -79,6 +81,7 @@ def test_create_dataset(self):
self.assertEqual(dataset.name, DATASET_NAME)

def test_reload_dataset(self):
DATASET_NAME = _make_dataset_name('reload_dataset')
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset.friendly_name = 'Friendly'
dataset.description = 'Description'
Expand All @@ -92,7 +95,7 @@ def test_reload_dataset(self):
self.assertEqual(other.description, 'Description')

def test_patch_dataset(self):
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(_make_dataset_name('patch_dataset'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand All @@ -106,7 +109,7 @@ def test_patch_dataset(self):
self.assertEqual(dataset.description, 'Description')

def test_update_dataset(self):
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(_make_dataset_name('update_dataset'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand Down Expand Up @@ -145,7 +148,7 @@ def test_list_datasets(self):
self.assertEqual(len(created), len(datasets_to_create))

def test_create_table(self):
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(_make_dataset_name('create_table'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand All @@ -163,6 +166,7 @@ def test_create_table(self):
self.assertEqual(table.name, TABLE_NAME)

def test_list_tables(self):
DATASET_NAME = _make_dataset_name('list_tables')
dataset = Config.CLIENT.dataset(DATASET_NAME)
self.assertFalse(dataset.exists())

Expand Down Expand Up @@ -197,7 +201,7 @@ def test_list_tables(self):
self.assertEqual(len(created), len(tables_to_create))

def test_patch_table(self):
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(_make_dataset_name('patch_table'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand All @@ -219,7 +223,7 @@ def test_patch_table(self):
self.assertEqual(table.description, 'Description')

def test_update_table(self):
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(_make_dataset_name('update_table'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand All @@ -245,7 +249,7 @@ def test_update_table(self):
self.assertEqual(found.field_type, expected.field_type)
self.assertEqual(found.mode, expected.mode)

def test_load_table_then_dump_table(self):
def test_insert_data_then_dump_table(self):
import datetime
from google.cloud._helpers import UTC

Expand All @@ -259,7 +263,8 @@ def test_load_table_then_dump_table(self):
('Bhettye Rhubble', 27, None),
]
ROW_IDS = range(len(ROWS))
dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(
_make_dataset_name('insert_data_then_dump'))
self.assertFalse(dataset.exists())

retry_403(dataset.create)()
Expand Down Expand Up @@ -305,7 +310,8 @@ def test_load_table_from_local_file_then_dump_table(self):
]
TABLE_NAME = 'test_table'

dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(
_make_dataset_name('load_local_then_dump'))

retry_403(dataset.create)()
self.to_delete.append(dataset)
Expand Down Expand Up @@ -381,7 +387,8 @@ def test_load_table_from_storage_then_dump_table(self):

self.to_delete.insert(0, blob)

dataset = Config.CLIENT.dataset(DATASET_NAME)
dataset = Config.CLIENT.dataset(
_make_dataset_name('load_gcs_then_dump'))

retry_403(dataset.create)()
self.to_delete.append(dataset)
Expand Down