danielwardega7777 opened a new pull request, #77693: URL: https://github.com/apache/airflow/pull/77693
**DRAFT because https://github.com/apache/airflow/pull/77690 needs to be merged first.** The Dataproc Metastore delete handler in the Google system test resource cleanup CLI (`providers/google/tests/system/google/resources_cleanup`) failed silently on Cloud Asset Inventory entries: backup deletion invoked a nonexistent `gcloud metastore backups delete` subcommand, missing `location` fields produced `--location=None`, service deletion omitted `--project` and passed full resource paths, and failed commands still logged `Resource deleted!`. This PR fixes `DataprocMetastoreDeleteHandler` *(depends on the shared cleanup helpers PR)*: - **Dataproc Metastore (`handlers/dataproc_metastore.py`):** - Use `gcloud metastore services backups delete` instead of the invalid `gcloud metastore backups delete` subcommand. - Extract short service and backup IDs and fall back to extracting `--location` from the resource path when `resource["location"]` is absent. - Accept `*, project_id: str | None = None`, pass `--project` via `build_project_flag`, and call `run_command_async(..., check=True, ignore_not_found=True)`. - **Unit tests (`test_dataproc_metastore_handler.py`):** Cover service and backup deletion commands, path location fallback, numeric project fallback to configured `project_id`, deletion order, and failure logging. ### Verification - `uv run --project providers/google pytest providers/google/tests/unit/google/resources_cleanup/`: 90 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 against a test GCP project (`main` vs. this branch):** - **Backup deletion (numeric project number, missing `location`):** On `main`, ran `gcloud metastore backups delete ... --location=None` which exited `2` (`Invalid choice: 'backups'`) yet still printed `Resource deleted!`. On this branch, ran `gcloud metastore services backups delete` with the path-extracted `--location` and resolved `--project`, reached the Metastore API (`NOT_FOUND`), and logged `Resource no longer exists.`. - **Service deletion (numeric and string project paths, with and without `location`):** On `main`, passed the full resource path with `--location=None` (when omitted) and no `--project`, and printed `Resource deleted!` despite exit code `1`. On this branch, passed the short service ID, extracted `--location`, and resolved `--project`, logging `Resource no longer exists.` on `NOT_FOUND`. - **Deletion order:** Verified `Backup` deletions run before `Service` deletions regardless of input order. - **Real non-NOT_FOUND error (invalid project ID):** On `main`, exited `1` (`Permission denied`) and silently printed `Resource deleted!`. On this branch, raised `CalledProcessError` and logged `Found an error in the handle deletion results:` without printing `Resource deleted!`. *(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]
