Pub/Sub integration tests
Stay organized with collections
Save and categorize content based on your preferences.
Demonstrates how to integration test a function triggered by Pub/Sub.
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis document provides instructions and code examples for integration testing functions triggered by Pub/Sub events in Java, Node.js, PHP, and Python.\u003c/p\u003e\n"],["\u003cp\u003eThe examples utilize the Functions Framework to run and test functions locally, ensuring they behave as expected when deployed.\u003c/p\u003e\n"],["\u003cp\u003eEach code sample showcases how to simulate a Pub/Sub message via an HTTP request to the locally running function, and verifies that the function correctly processes the message.\u003c/p\u003e\n"],["\u003cp\u003eThe code uses methods to set up and tear down the local testing environment, and utilize libraries such as \u003ccode\u003eresilience4j\u003c/code\u003e for Java, \u003ccode\u003ewait-port\u003c/code\u003e for Node.js, \u003ccode\u003eSymfony\u003c/code\u003e for PHP, and \u003ccode\u003erequests\u003c/code\u003e for Python, to handle retries, server processes and other tasks.\u003c/p\u003e\n"],["\u003cp\u003eInstructions on setting up Application Default Credentials for authenticating to Cloud Run functions are provided, along with links to further documentation.\u003c/p\u003e\n"]]],[],null,[]]