Skip to content

Commit

Permalink
Make more delete fails non-blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Oct 24, 2024
1 parent 9076b70 commit b632d4b
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions tests/integration/control/pod/test_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@
from ...helpers import generate_index_name, generate_collection_name


def attempt_cleanup_collection(client, collection_name):
try:
time.sleep(10)
client.delete_collection(collection_name)
except Exception as e:
# Failures here usually happen because the backend thinks there is still some
# operation pending on the resource.
# These orphaned resources will get cleaned up by the cleanup job later.
print(f"Failed to cleanup collection: {e}")


def attempt_cleanup_index(client, index_name):
try:
time.sleep(10)
client.delete_index(index_name, -1)
except Exception as e:
# Failures here usually happen because the backend thinks there is still some
# operation pending on the resource.
# These orphaned resources will get cleaned up by the cleanup job later.
print(f"Failed to cleanup collection: {e}")


class TestCollectionsHappyPath:
def test_index_to_collection_to_index_happy_path(
self, client, environment, dimension, metric, ready_index, random_vector
Expand Down Expand Up @@ -78,8 +100,8 @@ def test_index_to_collection_to_index_happy_path(
assert results.vectors[v[0]].values == pytest.approx(v[1], rel=0.01)

# Cleanup
client.delete_collection(collection_name)
client.delete_index(index_name)
attempt_cleanup_collection(client, collection_name)
attempt_cleanup_index(client, index_name)

def test_create_index_with_different_metric_from_orig_index(
self, client, dimension, metric, environment, reusable_collection
Expand All @@ -94,5 +116,4 @@ def test_create_index_with_different_metric_from_orig_index(
metric=target_metric,
spec=PodSpec(environment=environment, source_collection=reusable_collection),
)
time.sleep(10)
client.delete_index(index_name, -1)
attempt_cleanup_index(client, index_name)

0 comments on commit b632d4b

Please sign in to comment.