danielwardega7777 opened a new pull request, #77696: URL: https://github.com/apache/airflow/pull/77696
**DRAFT because https://github.com/apache/airflow/pull/77690 needs to be merged first.** The Cloud SQL delete handler in the Google system test resource cleanup CLI (`providers/google/tests/system/google/resources_cleanup`) failed silently on backups and numeric Cloud Asset Inventory project numbers: `BackupRun` relied on a legacy `curl` call, instance-scoped `Backup` passed the full resource path without `--instance`, numeric project numbers were passed directly to `--project` / project-level backup paths, and failed commands still printed `Resource deleted!`. This PR fixes `CloudSQLDeleteHandler` *(depends on the shared cleanup helpers PR)*: - **Cloud SQL (`handlers/sqladmin.py`):** - Extract short IDs and `--instance` for `Instance`, `BackupRun`, and instance-scoped `Backup` deletions. - Replace the legacy `curl` call for `BackupRun` with `gcloud sql backups delete`. - Accept `*, project_id: str | None = None` across all deleters, resolve `--project` via `build_project_flag` (and project-level `Backup` paths via `resolve_resource_path`), and call `run_command_async(..., check=True, ignore_not_found=True)`. - **Unit tests (`test_sqladmin_handler.py`):** Cover instance, instance-scoped backup, project-level backup, and backup run deletion, numeric project fallback to configured `project_id`, and deletion order. ### Verification - `uv run --project providers/google pytest providers/google/tests/unit/google/resources_cleanup/`: 91 passed. - `breeze run mypy providers/google/tests/system/google/resources_cleanup providers/google/tests/unit/google/resources_cleanup`: passed (`Success: no issues found in 44 source files`). - `ruff format --check` and `ruff check`: passed. - **Manual side-by-side verification on a test GCP project (`main` vs. this branch):** - Created temporary Cloud SQL instances with two on-demand backups each and ran `CloudSQLDeleteHandler` with reversed input order (`Instance`, instance-scoped `Backup`, `BackupRun`). - **On `main`:** `BackupRun` failed with HTTP 401 via legacy `curl` (exit `0`, still printed `Resource deleted!`), and instance-scoped `Backup` failed with an HTTP 404 HTML error (missing `--instance`, exit `1`, still printed `Resource deleted!`). - **On this branch:** Resolved numeric project numbers to the configured `project_id` and deleted `BackupRun` → instance-scoped `Backup` → `Instance` cleanly in dependency order (`exit 0` for all three). Also verified project-level `Backup` path resolution (`projects/<project_id>/backups/<uuid>`), `Resource no longer exists.` logging on missing backups, and `CalledProcessError` surfacing on an invalid project ID. - Verified zero temporary Cloud SQL instances remained afterward. *(No newsfragment added—changes are limited to Google provider system-test cleanup tooling under `providers/google/tests/`.)* --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Jetski (Gemini) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
