diff --git a/eng/scripts/clean-up-resources.py b/eng/scripts/clean-up-resources.py new file mode 100644 index 00000000..1476e0f5 --- /dev/null +++ b/eng/scripts/clean-up-resources.py @@ -0,0 +1,8 @@ +from azure.storage.blob import ContainerClient + +# Clean up blobs +container_client = ContainerClient.from_connection_string(conn_str="AzureWebJobsStorage", + container_name="python-worker-tests") +blobs_list = container_client.list_blobs() +for blob in blobs_list: + container_client.delete_blob(blob.name) diff --git a/eng/templates/official/jobs/ci-e2e-tests.yml b/eng/templates/official/jobs/ci-e2e-tests.yml index b69d9090..16aee2d6 100644 --- a/eng/templates/official/jobs/ci-e2e-tests.yml +++ b/eng/templates/official/jobs/ci-e2e-tests.yml @@ -127,3 +127,14 @@ jobs: AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION) USETESTPYTHONSDK: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true)) displayName: "Running $(PYTHON_VERSION) Python E2E Tests" + - bash: | + python eng/scripts/clean-up-resources.py + env: + AzureWebJobsStorage: $(STORAGE_CONNECTION) + AzureWebJobsCosmosDBConnectionString: $(COSMOSDB_CONNECTION) + AzureWebJobsEventHubConnectionString: $(EVENTHUB_CONNECTION) + AzureWebJobsServiceBusConnectionString: $(SERVICEBUS_CONNECTION) + AzureWebJobsSqlConnectionString: $(SQL_CONNECTION) + AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI) + AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION) + displayName: "Clean Up Test Resources" diff --git a/pyproject.toml b/pyproject.toml index d1f91bc0..5e2dda9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ Repository = "https://github.com/Azure/azure-functions-python-worker" dev = [ "azure-eventhub", # Used for EventHub E2E tests "azure-functions-durable", # Used for Durable E2E tests + "azure-storage-blob", # Used for cleaning up test resources "flask", "fastapi~=0.103.2", "pydantic",