Fault injection method, electronic device, and computer-readable storage medium

By injecting user-defined faults using the target route of the gateway in the microservice architecture, the flexibility and customizability problems of traditional fault injection methods are solved, and convenient fault simulation and testing efficiency improvements are achieved.

CN120238452BActive Publication Date: 2025-08-29ZHEJIANG DAHUA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510708084.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-08-29
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

Traditional fault injection methods lack flexibility and customizability, making it difficult to accurately simulate various complex fault scenarios, and users cannot easily configure and manage fault injection, resulting in inefficient testing.

Method used

Provide a fault injection method, by receiving target configuration information input by the user, inject target failures using target routes in the gateway, including network delay, network interruption, network unresponsiveness, unexpected response and data loss, etc., the target failure plug-in and custom plug-in simulate the failure, and operate through the configuration interface.

Benefits of technology

It realizes flexible and convenient fault injection, simplifies the fault simulation process, improves the robustness testing efficiency of the microservice system, and does not require the introduction of additional fault injection services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120238452B_ABST
    Figure CN120238452B_ABST
Patent Text Reader

Abstract

This application discloses a fault injection method, electronic device, and computer-readable storage medium. The method includes: receiving target configuration information for a target route configured for a gateway; wherein the target route is used to implement data request calls between microservices, the target configuration information is input by a user, and can define a target fault; adding the target configuration information to the target route to inject the target fault into a target object corresponding to the target route; wherein the target object includes at least one of the following: a target microservice, or a data request call process between different target microservices. Through the above method, the application can more conveniently perform fault injection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a fault injection method, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the widespread adoption of microservices architectures, system complexity and distributed nature are increasing. Microservices communicate data requests over the network, which can lead to various failures during operation, such as network delays, network outages, and unexpected responses. Fault injection testing is necessary to ensure the system's robustness and fault tolerance in the face of these failures.

[0003] Traditional fault injection methods often lack flexibility and customizability, making it difficult to accurately simulate various complex failure scenarios. Furthermore, during operation, users may not be able to easily configure and manage fault injection, resulting in low fault injection testing efficiency. Therefore, a more flexible and convenient fault injection method is needed to meet the needs of microservice system fault testing. Summary of the Invention

[0004] The main technical problem solved by this application is to provide a fault injection method, an electronic device and a computer-readable storage medium, which can more conveniently perform fault injection.

[0005] To solve the above technical problems, a technical solution adopted in the present application is: providing a fault injection method, the method comprising: receiving target configuration information for a target route configuration of a gateway; wherein the target route is used to implement data request calls between microservices, the target configuration information is input by a user, and can define a target fault; adding the target configuration information to the target route to inject the target fault into a target object corresponding to the target route; wherein the target object includes at least one of the following: a target microservice, a data request call process between different target microservices.

[0006] Receiving target configuration information for a target route configuration of a gateway includes: displaying a target configuration interface for the target route; and obtaining target configuration information for a target fault input by the user in response to a first fault configuration operation of the user on the target configuration interface.

[0007] Among them, the target configuration interface includes a fault plug-in configuration area; in response to the user's first fault configuration operation in the target configuration interface, the target configuration information of the target fault input by the user is obtained, including: in response to the user's target fault plug-in configuration operation in the fault plug-in configuration area, the target configuration information is obtained; wherein, the target fault plug-in is used to cause the target object to generate a target fault.

[0008] In which, in response to a user's configuration operation on a target fault plug-in in a fault plug-in configuration area, target configuration information is obtained, including: in response to a user's selection operation on a plug-in identifier of a target fault plug-in, displaying plug-in configuration items of the target fault plug-in in the fault plug-in configuration area; in response to a user's configuration operation on a plug-in configuration item, obtaining plug-in configuration parameters, and using the plug-in identifier and plug-in configuration parameters of the target fault plug-in as target configuration information.

[0009] The target fault plug-in includes a custom plug-in; the fault injection method further includes: generating the custom plug-in in response to a fault plug-in generation operation of a user; and adding the custom plug-in to the target gateway.

[0010] The fault injection method further includes: deleting target configuration information from the target route in response to a second fault configuration operation performed by the user on the target configuration interface.

[0011] Deleting the target configuration information from the target route in response to the user's second fault configuration operation in the target configuration interface includes: deleting the target configuration information from the target route in response to the user's target fault plug-in deletion operation in the fault plug-in configuration area.

[0012] Among them, the target configuration information includes the plug-in identifier and plug-in configuration parameters of the target fault plug-in, the target fault plug-in is used to cause the target object to generate a target fault, the plug-in configuration parameters include plug-in parameters and position parameters, and the position parameters are used to indicate the addition position in the target route; adding the target configuration information to the target route includes: adding the plug-in parameters and plug-in identifier to the target route according to the position parameters.

[0013] The fault injection method further includes: in response to the adding location indicated by the location parameter being a non-preset location in the target route, displaying the fault injection failure and / or the reason for the fault injection failure; wherein the preset location in the target route is the location of the target route for adding configuration information of the fault.

[0014] The fault injection method further includes: generating a target fault on a target object in response to triggering a target route of the gateway; and / or the target fault includes at least one of the following: network delay, network interruption, network unresponsiveness, unexpected response, and data loss.

[0015] To solve the above technical problems, another technical solution adopted in the present application is: to provide an electronic device, which includes a memory and a processor, wherein the memory stores program instructions, and the program instructions can be executed to implement the above fault injection method.

[0016] To solve the above technical problem, another technical solution adopted in the present application is: providing a computer-readable storage medium, wherein the computer-readable storage medium is used to store program instructions, and the program instructions can be executed to implement the above fault injection method.

[0017] In the above technical solution, in a microservice architecture, data call requests between microservices rely on routing in the gateway for scheduling and forwarding. Routing is like a transportation hub, clarifying the specific path of data call requests from one microservice to another. When user-entered configuration information that can define faults is added to the routing, it is like setting up a special checkpoint in this transportation hub. Data call requests will be affected when passing through this checkpoint, thereby simulating faults.

[0018] Therefore, by adding the target configuration information (defined by the user) to the target route, the target fault can be injected into the target object corresponding to the target route, effectively simulating the occurrence of the target fault on the target object. Subsequent testers can observe the impact of the target fault on the overall business system or service itself, providing a basis for improving program robustness. Furthermore, by adding the target configuration information (defined by the user) to the target route, the target fault can be injected into the target object. This simple fault injection method does not require the use of an additional fault injection service. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 This is a flowchart of an embodiment of a fault injection method provided by this application;

[0020] Figure 2 yes Figure 1 The flowchart of step S11 is shown as an embodiment;

[0021] Figure 3 This is a structural diagram of an embodiment of a fault injection device provided by the present application;

[0022] Figure 4 This is a structural diagram of an embodiment of an electronic device provided by the present application;

[0023] Figure 5 It is a structural diagram of an embodiment of a computer-readable storage medium provided by this application. DETAILED DESCRIPTION

[0024] The following describes the embodiments of the present application in detail with reference to the accompanying drawings.

[0025] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0026] The term "and / or" in this article is simply a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0027] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the fault injection method provided by this application. It should be noted that if there are substantially the same results, this embodiment does not Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment includes:

[0028] Step S11: Receive target configuration information for target routing configuration of the gateway.

[0029] In this embodiment, target configuration information for a target route configuration of a gateway is received, wherein the target route is used to implement data request calls between microservices. The target configuration information is input by a user and can define a target fault.

[0030] In one embodiment, the execution subject of the fault injection method provided by the present application is a gateway. The gateway receives the target configuration information configured by the user for the target route of the gateway. The gateway then adds the target configuration information to the target route to inject the target fault into the target object corresponding to the target route. Of course, in other embodiments, the execution subject of the fault injection method provided by the present application can also be a terminal device independent of the gateway and the route. The terminal device receives the target configuration information configured by the user for the target route of the gateway and sends the received target configuration information configured by the user for the target route of the gateway to the gateway. The gateway will add the target configuration information to the target route to inject the target fault into the target object corresponding to the target route.

[0031] It's important to note that in a microservices architecture, gateways and routers are two key components. The gateway serves as a unified entry point for data requests between microservices. Routers facilitate data requests between microservices. Specifically, routers and gateways typically work together. The gateway processes requests from microservice A and, based on the request type and the intended microservice B, routes the request to the appropriate routing component in the internal network. The routing component then forwards the request to the specific intended microservice B based on service discovery information. This division of labor makes the microservices architecture more flexible, scalable, and secure.

[0032] In one embodiment, the target failure includes at least one of the following: network delay, network interruption, network no response, unexpected response, and data loss. Network delay: simulates the delay phenomenon that occurs during the transmission of data call requests. By setting the delay time, delay probability, etc., the degree and frequency of the delay can be accurately controlled, and the response capability of the microservice system in a delayed environment can be tested. Network interruption: simulates the situation where the network connection is suddenly disconnected, and the fault tolerance and recovery mechanism of the microservice system in the event of a network interruption can be checked. Network no response: prevents the microservice from making any response to the data call request, and the processing logic and stability of the microservice system in the case of long-term no response can be tested. Unexpected response: returns a response result that does not meet expectations, such as an incorrect status code, an incorrect data format, etc., and the microservice system's ability to handle abnormal responses can be tested. Data loss: part or all of the data is lost during the data transmission process, and the error handling and data recovery capabilities of the microservice system in the event of data loss can be tested.

[0033] Step S12: Add the target configuration information to the target route to inject the target fault into the target object corresponding to the target route.

[0034] In this embodiment, target configuration information is added to the target route to inject a target fault into the target object corresponding to the target route; wherein the target object includes at least one of the following: a target microservice, or a data request calling process between different target microservices.

[0035] In a microservices architecture, data call requests between microservices rely on routing in the gateway for scheduling and forwarding. Routing acts like a transportation hub, defining the path data call requests take from one microservice to another. Adding user-entered configuration information that defines faults to a route acts like a checkpoint within this transportation hub, impacting data call requests as they pass through it, thereby simulating faults. Therefore, adding user-entered target configuration information that defines a target fault to a target route allows the target fault to be injected into the target object corresponding to the target route, effectively simulating the occurrence of the target fault on the target object. Subsequent testers can observe the impact of the target fault on the overall business system or service itself, providing a basis for improving program robustness. Furthermore, by adding user-entered target configuration information that defines a target fault to a target route, the target fault can be injected into the target object. This simple fault injection method does not require the use of an additional fault injection service. Furthermore, different target objects rely on different routes in the gateway. Therefore, adding user-entered target configuration information that can define the target failure to the target route corresponding to the target object will only effectively simulate the occurrence of the target failure on the target object without affecting other network communications.

[0036] It should be noted that when the target object is the data request call process between different target microservices, there are three situations: the first situation is that when the simulation is about the failure that may occur in the data request call process of the target microservice α to the target microservice β, at this time, the target route is route a that clarifies the specific path of the data call request of the target microservice α to the target microservice β; the second situation is that when the simulation is about the failure that may occur in the data request call process of the target microservice β to the target microservice α, at this time, the target route is route b that clarifies the specific path of the data call request of the target microservice β to the target microservice α; the third situation is that when the simulation is about the failure that may occur in the data request call process between the target microservice α and the target microservice β, at this time, the target route is route c that clarifies the specific path of the data call request of the target microservice α to the target microservice β and route d that clarifies the specific path of the data call request of the target microservice β to the target microservice α. In addition, when the target object is the target microservice, it is to simulate the failure of the target microservice. When the target microservice fails, all data call requests for the target microservice will be affected. Therefore, when the target object is the target microservice, the target route is the route for forwarding all clear data call requests to the target microservice.

[0037] In one embodiment, the target configuration information includes a plug-in identifier and plug-in configuration parameters of a target fault plug-in. The target fault plug-in is used to cause a target fault in a target object. The plug-in configuration parameters include plug-in parameters and position parameters. The position parameters are used to indicate the addition position in the target route. Adding the target configuration information to the target route is specifically as follows: according to the position parameters, the plug-in parameters and plug-in identifier are added to the target route.

[0038] The position parameter in the plug-in configuration parameters is the key to ensuring that the plug-in parameters and plug-in identifiers are accurately added to the specified location of the target route; wherein, the position parameter can be expressed in a variety of forms, such as node name, node number, relative position relationship, etc. After receiving the plug-in configuration parameters, the position parameter can be parsed first, and then searched in the topology structure of the target route according to the information indicated by the position parameter; for example, the position parameter indicates that the "network delay plug-in" is added to the location named "data processing node 3" in the target route, and the "data processing node 3" will be searched in the node list of the target route. After finding the node, the plug-in parameters and plug-in identifier are accurately added to the configuration information of the node. In addition, during the addition process, the configuration file of the target route can be modified and updated accordingly. At the same time, the log of the addition operation can be recorded, including the time of addition, the plug-in information added, the location of addition, etc., for subsequent query and audit.

[0039] In one embodiment, in response to the adding location indicated by the location parameter being a non-preset location in the target route, the failure of fault injection and / or the reason for the failure of fault injection is displayed; wherein, the preset location in the target route is the location of the target route for adding fault configuration information. That is, in the target route of the gateway, some preset locations for adding fault configuration information are predefined; when the adding location indicated by the location parameter is a non-preset location in the target route, it will cause the failure to add the target configuration parameters in the target route, thereby causing the failure to inject the target fault into the target object corresponding to the target route. By predefining some preset locations for adding fault configuration information in the target route of the gateway, the scope of fault injection impact can be made safe and controllable, thereby ensuring the stability and security of the gateway.

[0040] Specifically, the location indicated by the location parameter is compared with a list of preset locations. If it is found to be outside the preset range, a prompt box will pop up on the display interface, indicating that the fault injection failed and detailing the reason for the failure, such as "The added location does not comply with the regulations. This location is not the preset fault injection location." In addition, the abnormality can be recorded in the error log to facilitate subsequent investigation and resolution by operation and maintenance personnel.

[0041] In one embodiment, a target fault is generated on the target object in response to triggering the gateway's target route. Specifically, when a data call request between microservices passes through the gateway's target route, the target route is triggered. At this point, a target fault is generated on the target object based on the target configuration information previously added to the target route. Testers can observe the impact of a target fault on the overall business system or service itself, providing a basis for improving program robustness.

[0042] See also Figure 2 , Figure 2 yes Figure 1 It should be noted that if there is substantially the same result, this embodiment does not use Figure 2 The process sequence shown is limited. Figure 2 As shown, this embodiment includes:

[0043] Step S21: Displaying the target configuration interface of the target route.

[0044] In this embodiment, a target configuration interface for a target route is displayed. Specifically, when a user (operation and maintenance personnel or tester) needs to perform a fault injection on a target object, they first select the target route corresponding to the target object. Upon receiving the user's selection instruction, the corresponding interface generation module is quickly invoked to display the target configuration interface for the target route, allowing the user to perform fault configuration operations.

[0045] Step S22: In response to the first fault configuration operation of the user on the target configuration interface, target configuration information of the target fault input by the user is obtained.

[0046] In this embodiment, in response to the first fault configuration operation of the user on the target configuration interface, target configuration information of the target fault input by the user is acquired.

[0047] In one embodiment, a target configuration interface includes a fault plug-in configuration area; in response to a user's first fault configuration operation in the target configuration interface, target configuration information for a target fault input by the user is obtained. Specifically, in response to a user's target fault plug-in configuration operation in the fault plug-in configuration area, target configuration information is obtained; wherein the target fault plug-in is used to cause a target fault to be generated on a target object. Specifically, the target configuration information is obtained by configuring the target fault plug-in on a target route in the gateway. The target configuration information obtained by configuring the target fault plug-in is subsequently added to the target route to inject the target fault into the target object corresponding to the target route. In other words, fault injection is performed on the gateway side through plug-in configuration, which is simple and flexible, and does not require the introduction of additional fault injection services.

[0048] In one specific embodiment, in response to a user's configuration operation on a target fault plug-in in the fault plug-in configuration area, target configuration information is obtained. Specifically, in response to the user's selection of the plug-in identifier of the target fault plug-in, the plug-in configuration items of the target fault plug-in are displayed in the fault plug-in configuration area. In response to the user's configuration operation on the plug-in configuration items, plug-in configuration parameters are obtained, and the plug-in identifier and plug-in configuration parameters of the target fault plug-in are used as the target configuration information. Specifically, the fault plug-in configuration area in the target configuration interface is the core area for users to configure fault plug-ins. This area lists the plug-in identifiers of various pre-defined fault plug-ins in the gateway. These plug-in identifiers are displayed in a list or icon format to facilitate user selection. A brief description of the fault type that the fault plug-in can simulate may also be provided next to each plug-in identifier. When a user selects the plug-in identifier of the target fault plug-in in the fault plug-in configuration area, detailed configuration information of the target fault plug-in is immediately obtained in response to the user's selection of the plug-in identifier, and the plug-in configuration items of the target fault plug-in are dynamically displayed in the fault plug-in configuration area. Users configure the displayed plug-in configuration items according to actual test requirements. When entering plug-in configuration parameters, the input content can be verified in real time. For example, for "delay time", the input will be checked to see if it is a valid value. If non-numeric characters are entered, a prompt box will pop up immediately to remind the user to enter the correct value.

[0049] It should be noted that the gateway has pre-built fault plug-ins for various types of faults, such as network delay fault plug-ins, network interruption fault plug-ins, network unresponsiveness fault plug-ins, and unexpected response fault plug-ins. Furthermore, the gateway can also include custom plug-ins. Generally, when the pre-built fault plug-ins in the gateway are insufficient for the fault injection scenario, users will generate custom plug-ins in real time and upload them to the gateway.

[0050] In one embodiment, the target fault plug-in includes a custom plug-in; a custom plug-in is also generated in response to a user's fault plug-in generation operation; and the custom plug-in is added to the target gateway. In other words, if the pre-built fault plug-in in the gateway does not meet the user's specific testing needs, the user can choose to generate a custom plug-in. This makes adding new fault plug-ins to the gateway simple and flexible, and can cover a wide range of fault scenarios.

[0051] Specifically, when generating a custom plug-in, users first need to define the fault type and rules. For example, if a user wants to simulate a specific network packet loss fault, where the pattern of packet loss is related to the request time and data volume, the user can set parameters such as the packet loss time (e.g., within a certain time period each day) and data volume (e.g., when the request data exceeds a certain size), as well as the probability of packet loss. The custom plug-in generation tool automatically generates the corresponding code logic based on the user's parameters and encapsulates it into a custom plug-in. During the generation process, the code is syntax-checked and logic-validated to ensure proper functioning. After the custom plug-in is generated, the user can add it to the gateway. A "Add Plugin" action button is provided. Clicking this button will prompt a file selection dialog for the user to select the newly generated custom plug-in file.

[0052] In one embodiment, upon receiving a custom plug-in file, the gateway performs a security check to prevent malicious plug-ins from being injected. If the check passes, the gateway adds the custom plug-in's relevant information (such as the plug-in's identifier and function description) to the plug-in list and updates the configuration file to enable the custom plug-in to function properly within the gateway.

[0053] In one embodiment, in response to a user's second fault configuration operation in the target configuration interface, the target configuration information is deleted from the target route. In a microservice architecture, data call requests between microservices rely on the routing in the gateway for scheduling and forwarding. The routing is like a transportation hub, which clarifies the specific path of the data call request from one microservice to another. When the configuration information that can define the fault entered by the user is added to the route, it is like setting a special checkpoint in this transportation hub. The data call request will be affected when passing through this checkpoint, thereby simulating the fault. When the user deletes the configuration information from the route, it is like canceling the special checkpoint in this transportation hub. The data call request will not be affected when passing through this checkpoint, thereby closing the fault injection. Therefore, deleting the target configuration information from the target route can delete the target fault on the target object corresponding to the target route and restore the target object. In addition, by deleting the target configuration information that can define the target fault entered by the user from the target route, the target fault can be deleted from the target object and the target object can be restored. This method of closing the fault injection is simple and does not require the introduction of an additional fault injection service.

[0054] In a specific embodiment, in response to the user's second fault configuration operation in the target configuration interface, the target configuration information is deleted from the target route, specifically: in response to the user's target fault plug-in deletion operation in the fault plug-in configuration area, the target configuration information is deleted from the target route. Specifically, when the user performs the second fault configuration operation in the target configuration interface, such as when it is necessary to stop the fault injection test of the target object corresponding to the target route, the target fault plug-in deletion operation can be performed in the fault plug-in configuration area. For example, the user can click the "Delete" button next to the plug-in logo of the target fault plug-in, and it will immediately respond to the user's operation, search for relevant records of the target fault plug-in from the configuration information of the target route, and delete it after confirmation; at the same time, the configuration file of the target route will be updated to ensure that the deletion operation takes effect; in addition, in order to ensure the traceability of the operation, a log of the deletion operation can be recorded, including the time of deletion, deleted plug-in information, etc.

[0055] See also Figure 3 , Figure 3 This is a schematic diagram of the structure of an embodiment of a fault injection device provided by the present application. The fault injection device 30 includes a receiving module 31 and an adding module 32. The receiving module 31 is configured to receive target configuration information for a target route configured for a gateway. The target route is used to implement data request calls between microservices. The target configuration information is user-entered and can define target faults. The adding module 32 is configured to add the target configuration information to the target route to inject the target fault into the target object corresponding to the target route. The target object includes at least one of the following: a target microservice or a data request call process between different target microservices.

[0056] The receiving module 31 is used to receive target configuration information for the target route configuration of the gateway, including: displaying the target configuration interface of the target route; and obtaining the target configuration information of the target fault input by the user in response to the user's first fault configuration operation on the target configuration interface.

[0057] Among them, the above-mentioned target configuration interface includes a fault plug-in configuration area; the receiving module 31 is used to respond to the user's first fault configuration operation in the target configuration interface, and obtain the target configuration information of the target fault input by the user, including: responding to the user's target fault plug-in configuration operation in the fault plug-in configuration area, and obtaining the target configuration information; wherein, the target fault plug-in is used to cause the target object to generate a target fault.

[0058] Among them, the receiving module 31 is used to obtain target configuration information in response to the user's target fault plug-in configuration operation in the fault plug-in configuration area, including: in response to the user's selection operation of the plug-in identifier of the target fault plug-in, displaying the plug-in configuration items of the target fault plug-in in the fault plug-in configuration area; in response to the user's configuration operation on the plug-in configuration items, obtaining plug-in configuration parameters, and using the plug-in identifier and plug-in configuration parameters of the target fault plug-in as target configuration information.

[0059] The target fault plug-in includes a custom plug-in; the fault injection device 30 further includes a custom module 33, which is configured to generate a custom plug-in in response to a user's fault plug-in generation operation; and add the custom plug-in to the target gateway.

[0060] The receiving module 31 is configured to delete the target configuration information from the target route in response to a second fault configuration operation performed by the user on the target configuration interface.

[0061] The receiving module 31 is used to delete the target configuration information from the target route in response to the user's second fault configuration operation in the target configuration interface, including: deleting the target configuration information from the target route in response to the user's target fault plug-in deletion operation in the fault plug-in configuration area.

[0062] Among them, the above-mentioned target configuration information includes the plug-in identifier and plug-in configuration parameters of the target fault plug-in. The target fault plug-in is used to cause the target object to generate a target fault. The plug-in configuration parameters include plug-in parameters and position parameters. The position parameters are used to indicate the addition position in the target route; the adding module 32 is used to add the target configuration information to the target route, including: adding the plug-in parameters and plug-in identifier to the target route according to the position parameters.

[0063] Among them, the fault injection device 30 also includes a display module 34, which is used to display the fault injection failure and / or the reason for the fault injection failure in response to the addition location indicated by the location parameter being a non-preset location in the target route; wherein the preset location in the target route is the location of the target route for adding configuration information of the fault.

[0064] The fault injection device 30 further includes a fault module 35, which is configured to generate a target fault on a target object in response to triggering a target route of the gateway; and / or, the target fault includes at least one of the following: network delay, network interruption, network unresponsiveness, unexpected response, and data loss.

[0065] See also Figure 4 , Figure 4is a schematic diagram of the structure of an embodiment of an electronic device provided herein. Electronic device 40 includes a memory 41 and a processor 42 coupled to each other. Processor 42 is configured to execute program instructions stored in memory 41 to implement the steps of any of the aforementioned fault injection method embodiments. In a specific implementation scenario, electronic device 40 may include, but is not limited to, a microcomputer and a server. Furthermore, electronic device 40 may also include mobile devices such as laptops and tablet computers, without limitation herein.

[0066] Specifically, processor 42 is used to control itself and memory 41 to implement the steps of any of the above-mentioned fault injection method embodiments. Processor 42 may also be referred to as a CPU (Central Processing Unit). Processor 42 may be an integrated circuit chip with signal processing capabilities. Processor 42 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor. In addition, processor 42 may be implemented by an integrated circuit chip.

[0067] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of a computer-readable storage medium provided by the present application. The computer-readable storage medium 50 of this embodiment of the present application stores program instructions 51. When executed, these program instructions 51 implement the method provided by any embodiment of the fault injection method of the present application, as well as any non-conflicting combination thereof. The program instructions 51 can be stored in the computer-readable storage medium 50 as a program file in the form of a software product, enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present application. The aforementioned computer-readable storage medium 50 includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or terminal devices such as a computer, server, mobile phone, or tablet.

[0068] If the technical solution of this application involves personal information, the product that applies the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing personal information. If the technical solution of this application involves sensitive personal information, the product that applies the technical solution of this application has obtained the individual's separate consent before processing sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, a clear and prominent sign is set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that they agree to the collection of their personal information; or on the personal information processing device, when the personal information processing rules are notified by obvious signs / information, the individual's authorization is obtained through pop-up information or by asking the individual to upload their personal information; among which, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.

[0069] The above description is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the description and drawings of this application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A fault injection method, characterized in that: The method comprises: Receive target configuration information for a target route configuration of the gateway; wherein the target configuration information is input by a user and can define a target failure, the target route is used to determine a specific path for data requests between microservices, and forward the data requests based on the specific path to implement data request calls between microservices; The target configuration information is added to the target route to inject the target fault into the target object corresponding to the target route; wherein the target object includes at least one of the following: a target microservice, or a data request calling process between different target microservices.

2. The method according to claim 1, characterized in that The receiving target configuration information of the target routing configuration of the gateway includes: Display the target configuration interface of the target route; In response to a first fault configuration operation of the user on the target configuration interface, target configuration information of the target fault input by the user is obtained.

3. The method according to claim 2, characterized in that The target configuration interface includes a fault plug-in configuration area; The step of obtaining target configuration information of a target fault input by the user in response to the first fault configuration operation of the user on the target configuration interface includes: In response to a target fault plug-in configuration operation performed by a user in the fault plug-in configuration area, the target configuration information is acquired; wherein the target fault plug-in is used to cause the target object to generate the target fault.

4. The method according to claim 3, characterized in that The acquiring the target configuration information in response to the user's target fault plug-in configuration operation in the fault plug-in configuration area includes: In response to a user selecting the plug-in identifier of the target fault plug-in, displaying the plug-in configuration items of the target fault plug-in in the fault plug-in configuration area; In response to a user's configuration operation on the plug-in configuration item, plug-in configuration parameters are acquired, and the plug-in identifier of the target fault plug-in and the plug-in configuration parameters are used as the target configuration information.

5. The method according to claim 3, characterized in that The target fault plug-in includes a custom plug-in; and the method further includes: In response to a fault plug-in generation operation by a user, generating a custom plug-in; Add the custom plug-in to the gateway.

6. The method according to claim 2, characterized in that The method further comprises: In response to a second fault configuration operation by the user on the target configuration interface, the target configuration information is deleted from the target route.

7. The method according to claim 6, characterized in that The target configuration interface includes a fault plug-in configuration area; The deleting the target configuration information from the target route in response to the second fault configuration operation of the user on the target configuration interface includes: In response to a target fault plug-in deletion operation in the fault plug-in configuration area by a user, the target configuration information is deleted from the target route.

8. The method according to claim 1, characterized in that The target configuration information includes a plug-in identifier and plug-in configuration parameters of a target fault plug-in, wherein the target fault plug-in is used to cause the target object to generate the target fault, and the plug-in configuration parameters include plug-in parameters and position parameters, wherein the position parameters are used to indicate the adding position in the target route; Adding the target configuration information to the target route includes: According to the position parameter, the plug-in parameter and the plug-in identifier are added to the target route.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores program instructions, and the program instructions can be executed to implement the fault injection method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store program instructions, and the program instructions can be executed to implement the fault injection method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Fault simulation test method and device, electronic equipment and storage medium

    CN119645788A