From 3611907b792d5b942b4f10e225269072dcb77a85 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 30 Mar 2020 19:13:07 +0530 Subject: [PATCH 1/3] feat(bigtable): skip system test failing with emulator --- tests/system.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/system.py b/tests/system.py index e9e3ab791..d6140c659 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 _maybe_emulator_skip(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._maybe_emulator_skip("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._maybe_emulator_skip("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._maybe_emulator_skip("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._maybe_emulator_skip("Split keys 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" + ) row = self._table.row(ROW_KEY) self.rows_to_delete.append(row) From 68292f5d971ad114e4e964165cd25f163b182d87 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 17 Apr 2020 19:08:45 +0530 Subject: [PATCH 2/3] feat(bigtable): nit --- tests/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system.py b/tests/system.py index d6140c659..c48537200 100644 --- a/tests/system.py +++ b/tests/system.py @@ -752,7 +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._maybe_emulator_skip("Split keys not supported by Bigtable emulator") + self._maybe_emulator_skip("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) @@ -1026,7 +1026,7 @@ def test_yield_rows_with_row_set(self): def test_read_large_cell_limit(self): self._maybe_emulator_skip( - "Maximum grpc received message size for emulator is 4194304" + "Maximum gRPC received message size for emulator is 4194304 bytes." ) row = self._table.row(ROW_KEY) self.rows_to_delete.append(row) From 0bc68b03efd63de3fab594a8342009d5cc275170 Mon Sep 17 00:00:00 2001 From: HemangChothani Date: Wed, 20 May 2020 16:26:36 +0530 Subject: [PATCH 3/3] feat(bigtable): nit --- tests/system.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/system.py b/tests/system.py index c48537200..dd77dd936 100644 --- a/tests/system.py +++ b/tests/system.py @@ -657,7 +657,7 @@ def tearDown(self): for table in self.tables_to_delete: table.delete() - def _maybe_emulator_skip(self, message): + 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. @@ -698,7 +698,7 @@ def test_create_table(self): self.assertEqual(sorted_tables, expected_tables) def test_test_iam_permissions(self): - self._maybe_emulator_skip("Method not implemented in bigtable emulator") + 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() @@ -709,7 +709,7 @@ def test_test_iam_permissions(self): self.assertEqual(permissions, permissions_allowed) def test_get_iam_policy(self): - self._maybe_emulator_skip("Method not implemented in bigtable emulator") + 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() @@ -720,7 +720,7 @@ def test_get_iam_policy(self): self.assertEqual(policy["version"], 0) def test_set_iam_policy(self): - self._maybe_emulator_skip("Method not implemented in bigtable emulator") + 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() @@ -752,7 +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._maybe_emulator_skip("Split keys are not supported by Bigtable emulator") + 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)