dependabot security alerts + delete containers after each migration e2e test (#2384)

* dependabot security alerts + delete containers after each migration e2e test

* catch error

---------

Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
asier-isayas
2026-02-12 11:24:30 -08:00
committed by GitHub
parent 81ad13508b
commit 68ba19d406
5 changed files with 66 additions and 220 deletions

View File

@@ -1,5 +1,13 @@
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
import { BulkOperationType, Container, CosmosClient, CosmosClientOptions, Database, JSONObject } from "@azure/cosmos";
import {
BulkOperationType,
Container,
CosmosClient,
CosmosClientOptions,
Database,
ErrorResponse,
JSONObject,
} from "@azure/cosmos";
import { Buffer } from "node:buffer";
import { webcrypto } from "node:crypto";
import {
@@ -78,7 +86,14 @@ export class TestContainerContext {
) {}
async dispose() {
await this.database.delete();
try {
await this.database.delete();
} catch (error) {
if (error instanceof ErrorResponse && error.code === 404) {
return; // Resource already deleted, ignore
}
throw error; // Re-throw other errors
}
}
}