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

test: update system tests for emulator #97

Merged
merged 4 commits into from
Jun 16, 2020
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
13 changes: 10 additions & 3 deletions tests/system/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ def _list_instances():


def setUpModule():
Config.CLIENT = Client()
if USE_EMULATOR:
from google.auth.credentials import AnonymousCredentials

emulator_project = os.getenv("GCLOUD_PROJECT", "emulator-test-project")
Config.CLIENT = Client(
project=emulator_project, credentials=AnonymousCredentials()
)
else:
Config.CLIENT = Client()
retry = RetryErrors(exceptions.ServiceUnavailable)

configs = list(retry(Config.CLIENT.list_instance_configs)())
Expand Down Expand Up @@ -1215,7 +1223,6 @@ def test_transaction_batch_update_wo_statements(self):
with self.assertRaises(InvalidArgument):
transaction.batch_update([])

@unittest.skipIf(USE_EMULATOR, "Skipping partitioned DML")
def test_execute_partitioned_dml(self):
# [START spanner_test_dml_partioned_dml_update]
retry = RetryInstanceState(_has_all_ddl)
Expand Down Expand Up @@ -1329,6 +1336,7 @@ def test_transaction_query_w_concurrent_updates(self):
PKEY = "query_w_concurrent_updates"
self._transaction_concurrency_helper(self._query_w_concurrent_update, PKEY)

@unittest.skipIf(USE_EMULATOR, "Skipping concurrent transactions")
def test_transaction_read_w_abort(self):
retry = RetryInstanceState(_has_all_ddl)
retry(self._db.reload)()
Expand Down Expand Up @@ -1848,7 +1856,6 @@ def test_read_with_range_keys_and_index_open_open(self):
expected = [data[keyrow]] + data[start + 1 : end]
self.assertEqual(rows, expected)

@unittest.skipIf(USE_EMULATOR, "Skipping partitioned reads")
def test_partition_read_w_index(self):
row_count = 10
columns = self.COLUMNS[1], self.COLUMNS[2]
Expand Down