feat(functions): Enable Cloud Task Queue Emulator support#920
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for the Cloud Task Queue Emulator, which is a valuable addition for local development and testing. The implementation correctly detects the emulator environment and adapts the API requests. The refactoring to use _to_api_dict for payload creation is a nice improvement for clarity and correctness. I have identified a couple of issues: a potential runtime error when parsing the emulator's response, and a missing input validation in the delete method which appears to be a regression. I've also suggested a small performance optimization to cache the environment variable lookup. Overall, this is a solid contribution with comprehensive tests for the new functionality.

Allows the admin SDK to enqueue and delete tasks within the locally running cloud tasks emulator to provide for easier testing.
RELEASE NOTES: Enabled support for interacting with the Cloud Task emulator when the
CLOUD_TASKS_EMULATOR_HOSTenvironment variable is set.