Debugging Functions Online
This section describes how to manage test events on the FunctionGraph console and debug functions online using test events.
Scenarios
After the function configuration is complete, you can customize test events on the Code tab page of the function details page to verify whether the function can be executed successfully.
Notes and Constraints
Each function can have a maximum of 10 test events.
Creating a Test Event
After a test event is configured and saved, it can be used for testing again.
- Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
- Click the name of the desired function.
- On the function details page, select a version, and click Test. The Configure Test Event dialog box is displayed.
- In the displayed dialog box, enter the test event information by referring to Table 1.
Table 1 Test event information Parameter
Description
Configure Test Event
Mandatory.
You can create a test event or edit a saved test event. Select Create new test event.
Event Templates
Mandatory.
- If you select Blank Template, you can create a test event from scratch.
- If you select other common or cloud event templates, the corresponding test events are automatically loaded. Table 2 describes the event templates.
Event Name
Mandatory.
The event name can contain 1 to 25 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. For example, event-123test.
Event data
Mandatory.
Edit the test event code in the code editing area.
Table 2 Event template description Template Name
Description
API Gateway (Dedicated Gateway)
Simulates a dedicated APIG event to trigger your function.
Cloud Trace Service (CTS)
Simulates a CTS event to trigger your function.
Document Database Service (DDS)
Simulates a DDS event to trigger your function.
GeminiDB Mongo
Simulates a GeminiDB Mongo event to trigger your function.
Data Ingestion Service (DIS)
Simulates a DIS event to trigger your function.
Log Tank Service (LTS)
Simulates an LTS event to trigger your function.
Simple Message Notification (SMN)
Simulates an SMN event to trigger your function.
Timer
Simulates a timer event to trigger your function.
DMS (for Kafka)
Simulates a Kafka event to trigger your function.
Kafka (Open-Source)
Simulates an open-source Kafka event to trigger your function.
DMS (for RabbitMQ)
Simulates a RabbitMQ event to trigger your function.
Blank Template
The event is {"key": "value"}, which can be changed based on requirements.
Login Security Analysis
Serves as an input for the loginSecurity-realtime-analysis-python function template.
Image Classification
Serves as an input for the image classification.
Pornographic Image Analysis
Serves as an input for the pornographic image analysis.
Speech Recognition
Serves as an input for the voice analysis.
- Click Create.
Testing a Function
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of the desired function.
- On the displayed function details page, select a version and test event, and click Test as shown in Figure 1.
- Click Test. The Execution Result window is displayed on the Code tab page.
You can view function logs in Execution Result. A maximum of 2 KB logs can be displayed. For details about how to view complete logs, see Configuring Log Groups and Log Streams, and Viewing Function Logs.
Modifying a Test Event
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of the desired function.
- On the displayed function details page, click Configure Test Event. The Configure Test Event dialog box is displayed.
- In the Configure Test Event dialog box, modify the test event information according to Table 3.
- Click Save.
Deleting a Test Event
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of the desired function.
- On the Code tab page, click Configure Test Event. The editing page is displayed, as shown in Figure 2.
- On the Configure Test Event page, select Edit saved test event. In the Saved Test Events list on the left, select the event to be deleted and click Delete as shown in Figure 3.
Helpful Links
Manage test events through APIs. For details, see Function Test Event APIs.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot