Skip to content

Commit

Permalink
chore: Add more cleanup for match engine index test.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 631091852
  • Loading branch information
lingyinw authored and Copybara-Service committed May 6, 2024
1 parent 510c833 commit 262b184
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/system/aiplatform/test_matching_engine_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ def test_create_get_list_matching_engine_index(self, shared_state):
location=e2e_base._LOCATION,
)

# Clean up resources from previous test runs.
for index_endpoint in aiplatform.MatchingEngineIndexEndpoint.list():
for deployed_index in index_endpoint.deployed_indexes:
index_endpoint.undeploy_index(deployed_index_id=deployed_index.id)
index_endpoint.delete()

for index in aiplatform.MatchingEngineIndex.list():
index.delete()

# Create an index
index = aiplatform.MatchingEngineIndex.create_tree_ah_index(
display_name=_TEST_INDEX_DISPLAY_NAME,
Expand Down Expand Up @@ -446,6 +455,15 @@ def test_matching_engine_stream_index(self, shared_state):
location=e2e_base._LOCATION,
)

# Clean up resources from previous test runs.
for index_endpoint in aiplatform.MatchingEngineIndexEndpoint.list():
for deployed_index in index_endpoint.deployed_indexes:
index_endpoint.undeploy_index(deployed_index_id=deployed_index.id)
index_endpoint.delete()

for index in aiplatform.MatchingEngineIndex.list():
index.delete()

# Create an index
stream_index = aiplatform.MatchingEngineIndex.create_tree_ah_index(
display_name=_TEST_STREAM_INDEX_DISPLAY_NAME,
Expand Down

0 comments on commit 262b184

Please sign in to comment.