Fault simulation test method and device, electronic equipment and storage medium
By configuring and injecting fault simulation scenarios, the problem of difficult to meet the fault simulation test requirements in the prior art is solved, and the precise fault simulation and performance evaluation of the target server is achieved, ensuring the flexibility and scalability of the system.
Patent Information
- Application Number
- CN202411681386.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-18
AI Technical Summary
The prior art is difficult to meet the needs of failure simulation testing, especially on dynamic adjustment of network latency and supporting hardware load balancers with limited flexibility.
By receiving user test instructions, configure test parameters, including test type, fault parameters, and test targets. Use the flow controller to configure network rules, generate fault simulation scenarios, and inject them into the test target for performance testing. Monitor performance metrics and generate test reports.
Accurate failure simulation of the target server is achieved, and the stability and performance of the software or service under poor network conditions can be evaluated, ensuring the flexibility and scalability of the system.
Smart Images

Figure CN119645788A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for fault simulation testing. Background Art
[0002] In recent years, as regulatory agencies have continuously increased their requirements for business continuity, the disaster recovery construction of information systems has developed rapidly. During the disaster recovery testing of application systems, how to simulate the communication delay between production and disaster recovery ends, and how to evaluate the impact of network delay on disaster recovery switching solutions are also issues of concern to system developers.
[0003] In the prior art, some load balancers allow configuration of delay parameters to simulate the network communication environment by artificially increasing the delay, but not all load balancers support dynamic adjustment of network delay, or the flexibility of support is limited, and some hardware load balancers require specific firmware or software versions. Therefore, it is difficult to meet the needs of fault simulation testing. Summary of the invention
[0004] In view of this, the present application provides a method, device, electronic device and storage medium for fault simulation testing to solve the problem that it is difficult to meet the requirements of fault simulation testing in the prior art.
[0005] To achieve the above objectives, this application provides the following technical solutions:
[0006] The first aspect of the present application discloses a method for fault simulation testing, comprising:
[0007] When receiving a test instruction sent by a user, configure test parameters based on the test instruction; wherein the test parameters include a test type, a fault parameter and a test target;
[0008] Based on the test type and the fault parameters, configure network rules through a traffic controller to generate a fault simulation scenario;
[0009] Injecting the fault simulation scenario into the test target to perform performance testing on the test target;
[0010] Monitor the performance indicators of the test target during the test process and generate a test report for the test target.
[0011] Optionally, in the above method, injecting the fault simulation scenario into the test target includes:
[0012] Generate a corresponding fault simulation signal based on the fault simulation scenario;
[0013] Obtaining the network transmission path of the test target;
[0014] The fault simulation signal is injected into the network transmission path.
[0015] Optionally, the above method, after generating the fault simulation scenario based on the test type and the fault parameter, further includes:
[0016] The fault simulation scenario is exported to a database according to a preset file format.
[0017] Optionally, the above method, after monitoring the performance indicators of the test target during the test process and generating a test report of the test target, may further include:
[0018] The test report is analyzed by a log suite tool to generate a data report.
[0019] The second aspect of the present application discloses a device for fault simulation testing, comprising:
[0020] A configuration unit, configured to configure test parameters based on the test instruction when receiving the test instruction sent by the user; wherein the test parameters include a test type, a fault parameter and a test target;
[0021] A generating unit, configured to generate a fault simulation scenario by configuring a network rule through a traffic controller based on the test type and the fault parameter;
[0022] A test unit, used for injecting the fault simulation scenario into the test target and performing a performance test on the test target;
[0023] The monitoring unit is used to monitor the performance indicators of the test target during the test process and generate a test report for the test target.
[0024] Optionally, the above device includes:
[0025] A generating subunit, configured to generate a corresponding fault simulation signal based on the fault simulation scenario;
[0026] An acquisition subunit, used to acquire the network transmission path of the test target;
[0027] The injection subunit is used to inject the fault simulation signal into the network transmission path.
[0028] Optionally, the above device further includes:
[0029] The export unit is used to export the fault simulation scenario to a database according to a preset file format.
[0030] Optionally, the above device further includes:
[0031] The analysis unit is used to analyze the test report through a log suite tool to generate a data report.
[0032] The third aspect of the present application discloses an electronic device, comprising:
[0033] one or more processors;
[0034] a storage device having one or more programs stored thereon;
[0035] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspects of the present application.
[0036] A fourth aspect of the present application discloses a computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method described in any one of the first aspects of the present application is implemented.
[0037] It can be seen from the above technical scheme that in a method for fault simulation testing provided by the present application, when a test instruction sent by a user is received, test parameters are configured based on the test instruction; wherein the test parameters include test type, fault parameters and test target. Based on the test type and the fault parameters, the network rules are configured through the traffic controller to generate a fault simulation scenario. The fault simulation scenario is injected into the test target, and a performance test is performed on the test target. The performance indicators of the test target during the test process are monitored, and a test report for the test target is generated. It can be seen that by using the method of the present application, different types of network delays or faults can be accurately injected into the target server, such as increased delay, packet loss, connection interruption, etc., so as to effectively evaluate the stability and performance of the software or service under poor network conditions, while ensuring the flexibility and scalability of the system. Solve the problem that it is difficult to meet the needs of fault simulation testing in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0039] Figure 1 A flowchart of a fault simulation test method disclosed in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of a network fault management system disclosed in another embodiment of the present application;
[0041] Figure 3 A schematic diagram of an engine jet control device disclosed in another embodiment of the present application;
[0042] Figure 4 A schematic diagram of an electronic device disclosed in another embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0045] Furthermore, in this document, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0046] As can be seen from the background technology, in the prior art, some load balancing configurators allow delay parameters to be configured, simulating the network communication environment by artificially increasing the delay, but not all load balancers support dynamic adjustment of network delay, or the flexibility of support is limited, and some hardware load balancers require specific firmware or software versions. Therefore, it is difficult to meet the needs of fault simulation testing.
[0047] In view of this, the present application provides a method, device, electronic device and storage medium for fault simulation testing to solve the problem that it is difficult to meet the requirements of fault simulation testing in the prior art.
[0048] The present application embodiment provides a method for fault simulation testing, such as Figure 1 As shown, specifically including:
[0049] S101. Upon receiving a test instruction sent by a user, configure test parameters based on the test instruction; wherein the test parameters include a test type, a fault parameter, and a test target.
[0050] It should be noted that the method of this example can be applied to Figure 2 The network fault management system in the system includes a centralized control unit, a fault injection unit, a monitoring and reporting unit, and a DB database. The centralized control unit provides users with an intuitive and easy-to-use graphical interface and command line interface. Users can edit test instructions in the centralized control unit according to actual needs, such as testing the performance of the target server in a scenario with a network delay of 3000ms. After the user completes editing the test instructions, the centralized control unit configures the test parameters based on the test instructions sent by the user, wherein the test parameters include test type, fault parameters, and test target. Test types include delay, packet loss, interruption, and other types. Fault parameters include parameters such as delay time and packet loss rate. The test targets are servers, server clusters, or containerized clusters that need to be tested, and these servers communicate with clients or other servers through configured network paths.
[0051] It should also be noted that after configuring the test parameters, the centralized control unit encapsulates the set test instructions and test parameters into a control message, and sends it to the network injection module through the network or a direct connection.
[0052] S102: Based on the test type and fault parameters, configure network rules through the traffic controller to generate a fault simulation scenario.
[0053] It should be noted that after receiving the test parameters, the fault injection unit uses the TC (TrafficControl, traffic controller) tool of the Linux system to generate TC commands, and configures the network rules corresponding to the test parameters through the HTTP API interface or the gRPC interface, thereby dynamically adjusting the network traffic parameters, such as the adjustment of network delay, bandwidth limitation and other parameters, to simulate the required network delay, packet loss and other fault scenarios. At the same time, because it is implemented based on TC commands, it will not affect other deployed or running applications, thus ensuring the stability and isolation of the test environment. In addition to the above-mentioned TC tools, other network traffic control tools can also be used to adjust network parameters.
[0054] In other embodiments of the present application, the fault injection unit can configure the injection trigger conditions of the fault simulation scenario, which can be a variety of trigger conditions such as time, traffic, request ratio, etc. For example, a specific time period is used as the injection trigger condition, and when the time period is reached, the fault simulation scenario is injected into the test target. The flexibility and comprehensiveness of the test are further enhanced. In addition, the fault injection unit can be deployed in a container, which is easier to integrate into the company's existing DevOps (software engineering culture and practice) process. The fault injection unit supports multi-port and multi-protocol network traffic processing, ensures the comprehensiveness and accuracy of the test, and enhances the system's simulation capabilities for complex network environments.
[0055] Optionally, in another embodiment of the application, after executing step S102, the following may also be included:
[0056] Export the fault simulation scenario to the database according to the preset file format.
[0057] It should be noted that in order to facilitate the reuse or improvement of certain fault simulation scenarios, the fault simulation scenarios can be exported to the database in a preset file format, and the file format can be set according to actual needs, such as YAML format or JSON format. If the tester wants to reuse the fault simulation scenario later, he can directly obtain it. Or if you want to make some changes to the fault simulation scenario, you can also edit the exported fault simulation scenario.
[0058] S103: Inject the fault simulation scenario into the test target and perform performance testing on the test target.
[0059] It should be noted that the fault injection unit injects the generated fault simulation scenario into the test target to be tested, so that the test target runs under the fault simulation scenario and performs performance testing on the test target. For example, if the fault simulation scenario is a network delay scenario with a network delay of 3000ms, the running data of the test target under the scenario with a network delay of 3000ms is recorded to test the stability and performance of the test target under the fault simulation scenario.
[0060] Optionally, in another embodiment of the present application, an implementation of step S102 may include:
[0061] Generate corresponding fault simulation signals based on the fault simulation scenario.
[0062] Get the network transmission path of the test target.
[0063] Inject fault simulation signals into the network transmission path.
[0064] It should be noted that a fault simulation signal corresponding to the fault simulation scenario is generated according to the fault simulation scenario. Then the network transmission path of the test target is obtained, and the test target communicates with the client or other services through these configured network transmission paths. Finally, the fault simulation signal is injected into these network transmission paths, which will directly affect the data transmission between the test target and other objects, and simulate the required fault scenario.
[0065] S104. Monitor the performance indicators of the test target during the test process and generate a test report for the test target.
[0066] It should be noted that during the test, the monitoring and reporting unit monitors the test progress in real time through the monitoring tool, records the performance indicators of the test target during the test, such as response time, packet loss rate, etc., and can display real-time data to the tester. After the test is completed, a detailed test report is generated, which includes information such as test time, fault type, test results and performance data for the tester to analyze and evaluate. The method of this embodiment improves the fault tolerance and stability of the system by simulating network failures, while focusing on security and isolation, ensuring that the fault injection process does not cause actual damage to the production environment, and realizing the isolation of the test environment from the production environment.
[0067] In a method for fault simulation testing provided by an embodiment of the present application, when a test instruction sent by a user is received, test parameters are configured based on the test instruction; wherein the test parameters include a test type, a fault parameter and a test target. Based on the test type and the fault parameter, the network rules are configured through the traffic controller to generate a fault simulation scenario. The fault simulation scenario is injected into the test target, and a performance test is performed on the test target. The performance indicators of the test target during the test process are monitored, and a test report for the test target is generated. It can be seen that by using the method of the present application, different types of network delays or faults can be accurately injected into the target server, such as increased delay, packet loss, connection interruption, etc., so as to effectively evaluate the stability and performance of the software or service under poor network conditions, while ensuring the flexibility and scalability of the system. Solve the problem that it is difficult to meet the needs of fault simulation testing in the prior art.
[0068] Optionally, in another embodiment of the present application, after executing step S104, the following may also be included:
[0069] The test report is analyzed by a log suite tool to generate a data report.
[0070] It should be noted that after the test report is generated, the test report can be analyzed by a log suite tool, such as an ELK suite, to generate data reports related to the test report to assist testers in fault location and performance analysis.
[0071] Another embodiment of the present application also provides a fault simulation test device, such as Figure 3 As shown, specifically including:
[0072] The configuration unit 301 is used to configure test parameters based on the test instruction when receiving the test instruction sent by the user; wherein the test parameters include test type, fault parameters and test target.
[0073] The generating unit 302 is used to generate a fault simulation scenario by configuring a network rule through a traffic controller based on the test type and the fault parameter.
[0074] The testing unit 303 is used to inject the fault simulation scenario into the test target and perform performance testing on the test target;
[0075] The monitoring unit 304 is used to monitor the performance indicators of the test target during the test process and generate a test report for the test target.
[0076] In this embodiment, the specific execution process of the configuration unit 301, the generation unit 302, the test unit 303 and the monitoring unit 304 can be found in the corresponding Figure 1 The content of the method embodiment will not be repeated here.
[0077] In a device for fault simulation testing provided by an embodiment of the present application, when the configuration unit 301 receives a test instruction sent by a user, it configures test parameters based on the test instruction; wherein the test parameters include a test type, a fault parameter and a test target. The generation unit 302 configures network rules through a traffic controller based on the test type and the fault parameter to generate a fault simulation scenario. The test unit 303 injects the fault simulation scenario into the test target and performs a performance test on the test target. The monitoring unit 304 monitors the performance indicators of the test target during the test and generates a test report for the test target. It can be seen that by using the method of the present application, different types of network delays or faults can be accurately injected into the target server, such as increased delay, packet loss, connection interruption, etc., so as to effectively evaluate the stability and performance of the software or service under poor network conditions, while ensuring the flexibility and scalability of the system. Solve the problem that it is difficult to meet the needs of fault simulation testing in the prior art.
[0078] Optionally, in another embodiment of the present application, an implementation of the above-mentioned testing unit 303 may include:
[0079] A generating subunit is used to generate a corresponding fault simulation signal based on the fault simulation scenario.
[0080] The acquisition subunit is used to acquire the network transmission path of the test target.
[0081] The injection subunit is used to inject the fault simulation signal into the network transmission path.
[0082] In this embodiment, the specific execution process of generating a sub-unit, obtaining a sub-unit, and injecting a sub-unit can be found in the corresponding method embodiment described above, and will not be repeated here.
[0083] Optionally, in another embodiment of the present application, the above-mentioned fault simulation test device may further include:
[0084] The export unit is used to export the fault simulation scenario to a database according to a preset file format.
[0085] In this embodiment, the specific execution process of the export unit can be found in the corresponding method embodiment described above, and will not be repeated here.
[0086] Optionally, in another embodiment of the present application, the above-mentioned fault simulation test device may further include:
[0087] The analysis unit is used to analyze the test report through a log suite tool to generate a data report.
[0088] In this embodiment, the specific execution process of the analysis unit can refer to the corresponding method embodiment content above, which will not be repeated here.
[0089] Another embodiment of the application also provides an electronic device, such as Figure 4 As shown, specifically including:
[0090] One or more processors 401 .
[0091] The storage device 402 stores one or more programs.
[0092] When one or more programs are executed by one or more processors 401 , the one or more processors 401 implement any one of the methods in the above embodiments.
[0093] Another embodiment of the present application further provides a computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, any one of the methods in the above embodiments is implemented.
[0094] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0095] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0096] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for fault simulation testing, characterized in that: include: When receiving a test instruction sent by a user, configure test parameters based on the test instruction; wherein the test parameters include a test type, a fault parameter and a test target; Based on the test type and the fault parameters, configure network rules through a traffic controller to generate a fault simulation scenario; Injecting the fault simulation scenario into the test target to perform performance testing on the test target; Monitor the performance indicators of the test target during the test process and generate a test report for the test target.
2. The method according to claim 1, characterized in that: The injecting the fault simulation scenario into the test target comprises: Generate a corresponding fault simulation signal based on the fault simulation scenario; Obtaining the network transmission path of the test target; The fault simulation signal is injected into the network transmission path.
3. The method according to claim 1, characterized in that After generating the fault simulation scenario based on the test type and the fault parameters, the method further includes: The fault simulation scenario is exported to a database according to a preset file format.
4. The method according to claim 1, characterized in that After monitoring the performance indicators of the test target during the test process and generating a test report of the test target, the method further includes: The test report is analyzed by a log suite tool to generate a data report.
5. A device for fault simulation testing, characterized in that: include: A configuration unit, configured to configure test parameters based on the test instruction when receiving the test instruction sent by the user; wherein the test parameters include a test type, a fault parameter and a test target; A generating unit, configured to generate a fault simulation scenario by configuring a network rule through a traffic controller based on the test type and the fault parameter; A test unit, used for injecting the fault simulation scenario into the test target and performing a performance test on the test target; The monitoring unit is used to monitor the performance indicators of the test target during the test process and generate a test report for the test target.
6. The device according to claim 5, characterized in that The testing unit comprises: A generating subunit, configured to generate a corresponding fault simulation signal based on the fault simulation scenario; An acquisition subunit, used to acquire the network transmission path of the test target; The injection subunit is used to inject the fault simulation signal into the network transmission path.
7. The device according to claim 5, characterized in that Also includes: The export unit is used to export the fault simulation scenario to a database according to a preset file format.
8. The device according to claim 5, characterized in that Also includes: The analysis unit is used to analyze the test report through a log suite tool to generate a data report.
9. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 4.
10. A computer storage medium, characterized in that: A computer program is stored thereon, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Cited By
Fault injection method, electronic equipment and computer readable storage medium
CN120238452A
Fault injection method, electronic device, and computer-readable storage medium
CN120238452B
Storage system test method, storage system, equipment, storage medium and computer program product
CN120763022A
Storage system test method, storage system, device, storage medium, and computer program product
CN120763022B