[Python] Is it possible to test concurrent HTTP calls and Firestore side effects in Firebase...

Discussão em 'Python' iniciado por Stack, Setembro 3, 2025.

  1. Stack

    Stack Membro Participativo

    My goal is to write tests that:

    1. Simulate multiple concurrent HTTP POST requests to a cloud function endpoint (e.g., 2-3 identical webhooks arriving almost simultaneously).
    2. Verify database side effects in Firestore (e.g., database write and updates).

    What I have tried so far


    1. I have found testing documentation for js : https://firebase.google.com/docs/functions/unit-testing


    2. Tried testing on firebase emulator with little success since concurrency behaviour greatly differs from production:https://cloud.google.com/firestore/native/docs/emulator#transactions


    3. Unit test samples only involve js : https://github.com/firebase/functions-samples/tree/main?tab=readme-ov-file

    Current Roadblock

    Most documentation and examples are JavaScript-only, while my functions are in Python. I’m convinced that to properly test concurrency, I’ll need to:

    1. Use a real GCP project (not just the emulator) to run integration tests that fire multiple simultaneous requests.

    What I’m looking for

    A Python testing approach or library that can help for generation 2 functions firebase:

    • Mock/simulate multiple concurrent POST requests.
    • Assert Firestore database state after execution.

    Continue reading...

Compartilhe esta Página