diff --git a/cortexapps_cli/commands/catalog.py b/cortexapps_cli/commands/catalog.py index 2717b891..c5e575f1 100644 --- a/cortexapps_cli/commands/catalog.py +++ b/cortexapps_cli/commands/catalog.py @@ -122,24 +122,6 @@ def delete( client.delete("api/v1/catalog/" + tag) -@app.command() -def delete_by_type( - ctx: typer.Context, - types: CatalogCommandOptions.types = None, -): - """ - Dangerous operation that will delete all entities that are of the given type - """ - client = ctx.obj["client"] - - #TODO: check if types is a regex of form: ([-A-Za-z]+,)+ - - params = { - "types": types - } - - client.delete("api/v1/catalog", params=params) - @app.command() def descriptor( ctx: typer.Context, diff --git a/data/run-time/catalog-delete-by-type-entity.yaml b/data/run-time/catalog-delete-by-type-entity.yaml deleted file mode 100644 index b33be910..00000000 --- a/data/run-time/catalog-delete-by-type-entity.yaml +++ /dev/null @@ -1,5 +0,0 @@ -openapi: 3.0.1 -info: - title: Delete By Type Test Entity - x-cortex-tag: cli-test-delete-by-type-entity - x-cortex-type: cli-test-delete-by-type diff --git a/data/run-time/entity-type-delete-by-type.json b/data/run-time/entity-type-delete-by-type.json deleted file mode 100644 index 8af27dbb..00000000 --- a/data/run-time/entity-type-delete-by-type.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "description": "Temporary entity type for testing delete-by-type.", - "name": "CLI Test Delete By Type", - "schema": {}, - "type": "cli-test-delete-by-type" -} diff --git a/tests/test_catalog_delete_by_type.py b/tests/test_catalog_delete_by_type.py deleted file mode 100644 index 0fe5e796..00000000 --- a/tests/test_catalog_delete_by_type.py +++ /dev/null @@ -1,20 +0,0 @@ -from tests.helpers.utils import * - -#@pytest.mark.skip(reason="Disabled until CET-24425 is resolved.") -def test(): - # Create the entity type - cli(["entity-types", "create", "-f", "data/run-time/entity-type-delete-by-type.json"], ReturnType.RAW) - - # Create an entity of that type - cli(["catalog", "create", "-f", "data/run-time/catalog-delete-by-type-entity.yaml"]) - - # Verify the entity exists - response = cli(["catalog", "list", "-t", "cli-test-delete-by-type"]) - assert response['total'] > 0, "Should find at least 1 entity of type 'cli-test-delete-by-type'" - - # Delete all entities of that type - cli(["catalog", "delete-by-type", "-t", "cli-test-delete-by-type"]) - - # Verify 0 entities remain of that type - response = cli(["catalog", "list", "-t", "cli-test-delete-by-type"]) - assert response['total'] == 0, f"Expected 0 entities of x-cortex-type:cli-test-delete-by-type, but found: {response['total']}"