xlsongc opened a new pull request, #72846:
URL: https://github.com/apache/airflow/pull/72846

   `google.cloud.links.cloud_tasks` had no unit tests and was suppressed by the
   `OVERLOOKED_TESTS` allowlist in 
`airflow-core/tests/unit/always/test_project_structure.py`.
   
   `CloudTasksQueueLink` is attached to eleven operators in 
`google.cloud.operators.tasks`,
   and its `extract_parts()` helper parses the
   `projects/<project>/locations/<location>/queues/<queue>` resource name that 
every one of
   those links is built from — none of which was exercised by a test.
   
   This adds 
`providers/google/tests/unit/google/cloud/links/test_cloud_tasks.py` and removes
   the allowlist entry. The tests follow the existing shape of the link tests 
in that
   directory (`test_cloud_run.py`, `test_dataplex.py`).
   
   Covered:
   
   * class attributes (`name` / `key` / `format_str`) for `CloudTasksQueueLink` 
and `CloudTasksLink`
   * `CloudTasksQueueLink.extract_parts()` — full resource name, `None`, and 
empty string
   * `CloudTasksQueueLink.persist()` with and without a `queue_name`, asserting 
what is pushed to XCom
   * `get_link()` end to end for both links, asserting the rendered console URL
   
   No production code is changed.
   
   One thing I noticed but deliberately left alone: `extract_parts()` guards 
against a falsy
   `queue_name` but indexes `parts[1]`, `parts[3]`, `parts[5]` unconditionally 
otherwise, so a
   name that is not a full queue resource path raises `IndexError`. In practice 
the value comes
   straight from the Cloud Tasks API, so I did not want to bake current 
behaviour into a test or
   change it in a test-only PR. Happy to follow up separately if maintainers 
think it is worth
   hardening.
   
   Verified locally:
   
   ```
   pytest providers/google/tests/unit/google/cloud/links/            # 84 passed
   pytest airflow-core/tests/unit/always/test_project_structure.py   # 10 
passed, 1 xfailed
   ruff check / ruff format                                          # clean
   ```
   
   related: #35442
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to