Skip to content

Commit

Permalink
feat(bigtable): skip system tests failing with emulator (#18)
Browse files Browse the repository at this point in the history
* feat(bigtable): skip system test failing with emulator

* feat(bigtable): nit

* feat(bigtable): nit
  • Loading branch information
HemangChothani committed May 20, 2020
1 parent 2b63746 commit 399d3d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/system.py
Expand Up @@ -657,6 +657,13 @@ def tearDown(self):
for table in self.tables_to_delete:
table.delete()

def _skip_if_emulated(self, message):
# NOTE: This method is necessary because ``Config.IN_EMULATOR``
# is set at runtime rather than import time, which means we
# can't use the @unittest.skipIf decorator.
if Config.IN_EMULATOR:
self.skipTest(message)

def test_list_tables(self):
# Since `Config.INSTANCE_DATA` is newly created in `setUpModule`, the
# table created in `setUpClass` here will be the only one.
Expand Down Expand Up @@ -691,6 +698,7 @@ def test_create_table(self):
self.assertEqual(sorted_tables, expected_tables)

def test_test_iam_permissions(self):
self._skip_if_emulated("Method not implemented in bigtable emulator")
temp_table_id = "test-test-iam-policy-table"
temp_table = Config.INSTANCE_DATA.table(temp_table_id)
temp_table.create()
Expand All @@ -701,6 +709,7 @@ def test_test_iam_permissions(self):
self.assertEqual(permissions, permissions_allowed)

def test_get_iam_policy(self):
self._skip_if_emulated("Method not implemented in bigtable emulator")
temp_table_id = "test-get-iam-policy-table"
temp_table = Config.INSTANCE_DATA.table(temp_table_id)
temp_table.create()
Expand All @@ -711,6 +720,7 @@ def test_get_iam_policy(self):
self.assertEqual(policy["version"], 0)

def test_set_iam_policy(self):
self._skip_if_emulated("Method not implemented in bigtable emulator")
temp_table_id = "test-set-iam-policy-table"
temp_table = Config.INSTANCE_DATA.table(temp_table_id)
temp_table.create()
Expand Down Expand Up @@ -742,6 +752,7 @@ def test_create_table_with_families(self):
self.assertEqual(retrieved_col_fam.gc_rule, gc_rule)

def test_create_table_with_split_keys(self):
self._skip_if_emulated("Split keys are not supported by Bigtable emulator")
temp_table_id = "foo-bar-baz-split-table"
initial_split_keys = [b"split_key_1", b"split_key_10", b"split_key_20"]
temp_table = Config.INSTANCE_DATA.table(temp_table_id)
Expand Down Expand Up @@ -1014,6 +1025,9 @@ def test_yield_rows_with_row_set(self):
self.assertEqual(found_row_keys, expected_row_keys)

def test_read_large_cell_limit(self):
self._maybe_emulator_skip(
"Maximum gRPC received message size for emulator is 4194304 bytes."
)
row = self._table.row(ROW_KEY)
self.rows_to_delete.append(row)

Expand Down

0 comments on commit 399d3d3

Please sign in to comment.