From 399d3d3f960786f616ab6085f142a9703b0391e0 Mon Sep 17 00:00:00 2001 From: HemangChothani <50404902+HemangChothani@users.noreply.github.com> Date: Wed, 20 May 2020 22:56:27 +0530 Subject: [PATCH] feat(bigtable): skip system tests failing with emulator (#18) * feat(bigtable): skip system test failing with emulator * feat(bigtable): nit * feat(bigtable): nit --- tests/system.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/system.py b/tests/system.py index e9e3ab791..dd77dd936 100644 --- a/tests/system.py +++ b/tests/system.py @@ -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. @@ -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() @@ -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() @@ -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() @@ -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) @@ -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)