always delete resources
This commit is contained in:
Родитель
5e2417df22
Коммит
5703acaf1b
|
@ -1,8 +1,19 @@
|
||||||
from azure.storage.blob import ContainerClient
|
from azure.storage.blob import ContainerClient
|
||||||
|
from azure.cosmos import CosmosClient
|
||||||
|
|
||||||
# Clean up blobs
|
# Clean up Blob storage account
|
||||||
container_client = ContainerClient.from_connection_string(conn_str="AzureWebJobsStorage",
|
container_client = ContainerClient.from_connection_string(
|
||||||
container_name="python-worker-tests")
|
conn_str="AzureWebJobsStorage",
|
||||||
blobs_list = container_client.list_blobs()
|
container_name="python-worker-tests")
|
||||||
for blob in blobs_list:
|
for blob in container_client.list_blobs():
|
||||||
container_client.delete_blob(blob.name)
|
container_client.delete_blob(blob.name)
|
||||||
|
|
||||||
|
# Clean up CosmosDB
|
||||||
|
cosmos_client = CosmosClient.from_connection_string(
|
||||||
|
conn_str="AzureWebJobsCosmosDBConnectionString")
|
||||||
|
database = cosmos_client.get_database_client("test")
|
||||||
|
container = database.get_container_client("items")
|
||||||
|
for item in container.query_items(
|
||||||
|
query='SELECT * FROM items',
|
||||||
|
enable_cross_partition_query=True):
|
||||||
|
container.delete_item(item, partition_key='Widget')
|
||||||
|
|
|
@ -138,3 +138,4 @@ jobs:
|
||||||
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
|
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
|
||||||
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
|
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
|
||||||
displayName: "Clean Up Test Resources"
|
displayName: "Clean Up Test Resources"
|
||||||
|
condition: always()
|
||||||
|
|
|
@ -43,6 +43,7 @@ Repository = "https://github.com/Azure/azure-functions-python-worker"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev = [
|
dev = [
|
||||||
|
"azure-cosmos", # Used for cleaning up test resources
|
||||||
"azure-eventhub", # Used for EventHub E2E tests
|
"azure-eventhub", # Used for EventHub E2E tests
|
||||||
"azure-functions-durable", # Used for Durable E2E tests
|
"azure-functions-durable", # Used for Durable E2E tests
|
||||||
"azure-storage-blob", # Used for cleaning up test resources
|
"azure-storage-blob", # Used for cleaning up test resources
|
||||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 1.9 KiB |
Загрузка…
Ссылка в новой задаче