@@ -82,6 +82,12 @@ def lci_instance_id():
8282 return f"lci-instance-{ uuid .uuid4 ().hex [:10 ]} "
8383
8484
85+ @pytest .fixture (scope = "module" )
86+ def instance_partition_instance_id ():
87+ """Id for the instance that tests instance partitions."""
88+ return f"instance-partition-test-{ uuid .uuid4 ().hex [:10 ]} "
89+
90+
8591@pytest .fixture (scope = "module" )
8692def database_id ():
8793 return f"test-db-{ uuid .uuid4 ().hex [:10 ]} "
@@ -188,6 +194,18 @@ def test_create_instance_with_autoscaling_config(capsys, lci_instance_id):
188194 retry_429 (instance .delete )()
189195
190196
197+ def test_create_instance_partition (capsys , instance_partition_instance_id ):
198+ snippets .create_instance (instance_partition_instance_id )
199+ retry_429 (snippets .create_instance_partition )(
200+ instance_partition_instance_id , "my-instance-partition"
201+ )
202+ out , _ = capsys .readouterr ()
203+ assert "Created instance partition my-instance-partition" in out
204+ spanner_client = spanner .Client ()
205+ instance = spanner_client .instance (instance_partition_instance_id )
206+ retry_429 (instance .delete )()
207+
208+
191209def test_update_database (capsys , instance_id , sample_database ):
192210 snippets .update_database (instance_id , sample_database .database_id )
193211 out , _ = capsys .readouterr ()
0 commit comments