Repository: googleapis/google-cloud-python

Issue:
Bigtable:  new system test failure
#5513 caused a new (non-flaky, AFAICT) [system test failure](https://circleci.com/gh/GoogleCloudPlatform/google-cloud-python/7142):

```python

    def test_create_table_with_split_keys(self):
        temp_table_id = 'foo-bar-baz-split-table'
        initial_split_keys = [b'split_key_1', b'split_key_10',
                              b'split_key_20', b'']
        temp_table = Config.INSTANCE.table(temp_table_id)
        temp_table.create(initial_split_keys=initial_split_keys)
        self.tables_to_delete.append(temp_table)
    
        # Read Sample Row Keys for created splits
        sample_row_keys = temp_table.sample_row_keys()
        self.assertEqual(set([srk.row_key for srk in sample_row_keys]),
>                        set(initial_split_keys))
E       AssertionError: Items in the second set but not the first:
E       'split_key_1'
E       'split_key_10'
E       'split_key_20'
```


Discussion:
@tseaver I fixed in my brach feature/initial_split_keys_on_table on PR #5513

@aneepct The new system test added in PR #5513 is the one which is failing (it fails repeatably for me on my local machine, too).
@tseaver I am going to create new PR for this.
@aneepct, thanks!
@tseaver Fixed the system test at #5606

Resolving patch:
diff --git a/bigtable/google/cloud/bigtable/table.py b/bigtable/google/cloud/bigtable/table.py
--- a/bigtable/google/cloud/bigtable/table.py
+++ b/bigtable/google/cloud/bigtable/table.py
@@ -208,7 +208,7 @@ def create(self, initial_split_keys=[], column_families={}):
         table = admin_messages_v2_pb2.Table(column_families=families)
 
         split = table_admin_messages_v2_pb2.CreateTableRequest.Split
-        splits = [split(key=key) for key in initial_split_keys]
+        splits = [split(key=_to_bytes(key)) for key in initial_split_keys]
 
         table_client.create_table(parent=instance_name, table_id=self.table_id,
                                   table=table, initial_splits=splits)


Test patch:
diff --git a/bigtable/tests/system.py b/bigtable/tests/system.py
--- a/bigtable/tests/system.py
+++ b/bigtable/tests/system.py
@@ -263,15 +263,19 @@ def test_create_table_with_families(self):
     def test_create_table_with_split_keys(self):
         temp_table_id = 'foo-bar-baz-split-table'
         initial_split_keys = [b'split_key_1', b'split_key_10',
-                              b'split_key_20', b'']
+                              b'split_key_20']
         temp_table = Config.INSTANCE.table(temp_table_id)
         temp_table.create(initial_split_keys=initial_split_keys)
         self.tables_to_delete.append(temp_table)
 
         # Read Sample Row Keys for created splits
         sample_row_keys = temp_table.sample_row_keys()
-        self.assertEqual(set([srk.row_key for srk in sample_row_keys]),
-                         set(initial_split_keys))
+        actual_keys = [srk.row_key for srk in sample_row_keys]
+
+        expected_keys = initial_split_keys
+        expected_keys.append(b'')
+
+        self.assertEqual(actual_keys, expected_keys)
 
     def test_create_column_family(self):
         temp_table_id = 'test-create-column-family'