@@ -143,20 +143,28 @@ async def create_instance(
143143 default_storage_type = storage_type ,
144144 )
145145
146- create_instance_request = admin_v2 .CreateInstanceRequest (
147- parent = instance_admin_client .common_project_path (project_id ),
148- instance_id = instance_id ,
149- instance = admin_v2 .Instance (
150- display_name = instance_id [
151- :30
152- ], # truncate to 30 characters because of character limit
153- ),
154- clusters = clusters ,
155- )
156- operation = await instance_admin_client .create_instance (create_instance_request )
157- instance = await operation .result ()
146+ # Instance and cluster creation are currently unsupported in the Bigtable emulator
147+ if os .getenv (BIGTABLE_EMULATOR ):
158148
159- instances_to_delete .append (instance )
149+ # All we need for system tests so far is the instance name.
150+ instance = admin_v2 .Instance (
151+ name = instance_admin_client .instance_path (project_id , instance_id ),
152+ )
153+ else :
154+ create_instance_request = admin_v2 .CreateInstanceRequest (
155+ parent = instance_admin_client .common_project_path (project_id ),
156+ instance_id = instance_id ,
157+ instance = admin_v2 .Instance (
158+ display_name = instance_id [
159+ :30
160+ ], # truncate to 30 characters because of character limit
161+ ),
162+ clusters = clusters ,
163+ )
164+ operation = await instance_admin_client .create_instance (create_instance_request )
165+ instance = await operation .result ()
166+
167+ instances_to_delete .append (instance )
160168
161169 # Create a table within the instance
162170 create_table_request = admin_v2 .CreateTableRequest (
@@ -289,6 +297,11 @@ async def test_optimize_restored_table(
289297 second_instance_storage_type ,
290298 expect_optimize_operation ,
291299):
300+ if os .getenv (BIGTABLE_EMULATOR ):
301+ pytest .skip (
302+ reason = "Backups are not supported in the Bigtable emulator" ,
303+ )
304+
292305 # Create two instances. We backup a table from the first instance to a new table in the
293306 # second instance. This is to test whether or not different scenarios trigger an
294307 # optimize_restored_table operation
0 commit comments