Chaotic test method and device of system process, computer equipment and storage medium

By building directed graphs and tree graphs in the system process, calculating the keys and performing chaos tests in order, the problem of inefficient process abnormal testing in the existing technology is solved, and rapid testing of important processes and effective discovery of system problems is achieved.

CN119597663AActive Publication Date: 2025-03-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411713754.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-11
Estimated Expiration
2044-11-27

AI Technical Summary

Technical Problem

In the prior art, process abnormal testing relies on empirical judgment and manual execution, which is inefficient and difficult to quickly discover important system problems.

Method used

By determining the directed graph and tree graph of the system process, calculate the keys of each node, and perform chaos testing according to the keys to ensure that important processes are given priority testing.

Benefits of technology

It improves the testing efficiency of important processes and can quickly discover processes that cause important problems in the system, thereby improving the efficiency of chaos testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597663A_ABST
    Figure CN119597663A_ABST
Patent Text Reader

Abstract

The invention relates to a chaos testing method and device for a system process, computer equipment and a storage medium, and relates to the technical field of software testing. The method comprises the following steps: determining a process directed graph according to a dependency relationship between processes in a system; nodes in the process directed graph correspond to processes; determining a tree diagram corresponding to the process directed graph, and for the tree diagram, determining criticality of each node in the tree diagram; the criticality is determined based on the key value of the node and the key value of the child node of the node; the criticality is used for representing the importance degree of the node; and according to a process test sequence corresponding to the criticality, performing a chaos test on a process corresponding to the node. By adopting the method, the test efficiency of the important process can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a chaos testing method, apparatus, computer equipment, storage medium and computer program product for a system process. Background Art

[0002] When the operating system starts, it will start a large number of processes to provide basic services. During the operation of the operating system, each user will install software packages, build services, and create corresponding processes according to their needs. All processes need to use system resources such as CPU, memory, and network, and some processes also have intercommunication and interdependence. Therefore, process abnormalities may cause system services and other processes to be abnormal, or even cause the system to crash. Therefore, the performance of the operating system when the process is abnormal reflects the robustness of the system. During the software development process, you can simulate the test of process abnormalities to avoid the above situation.

[0003] However, the process exception test in the related art mainly relies on experience judgment and manual execution. The tester first selects certain important processes based on experience to construct exceptions, then manually performs exception operations on the selected processes, and finally observes the performance of the system. The above test method only relies on experience to judge the importance of the process, which will miss the core processes that are not transparent to the user, and the processes selected by the tester are random, which cannot quickly discover important system problems, resulting in insufficient efficiency in testing important processes and processes that cause important system problems. Summary of the invention

[0004] Based on this, it is necessary to provide a chaos testing method, device, computer equipment, computer-readable storage medium and computer program product for system processes that can improve the testing efficiency of important processes in response to the above technical problems.

[0005] In a first aspect, the present application provides a chaos testing method for a system process. The method comprises:

[0006] Determine a process directed graph according to processes in the system and dependencies between the processes; the nodes in the process directed graph correspond to the processes;

[0007] Determine a tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0008] According to the process test sequence corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0009] In one embodiment, determining the process directed graph according to the processes in the system and the dependency relationships between the processes includes:

[0010] Obtaining dependency relationships among processes in the system, and determining a vector SVG file for storing the dependency relationships;

[0011] According to the strategy that the directed edge points from the node corresponding to the current process to the node corresponding to the dependent process, the SVG file is converted into a process directed graph; the process directed graph includes at least one of a directed cyclic graph and a directed acyclic graph.

[0012] In one embodiment, after determining the process directed graph according to the processes in the system and the dependency relationships between the processes, the method further includes:

[0013] If the process directed graph includes a directed cyclic graph, determining a loop of the directed cyclic graph;

[0014] Merging the processes in the loop and determining them as loop nodes of the directed cyclic graph; the loop node is a single abstract node, and the abstract node is used to represent the nodes corresponding to the processes in the loop in a higher level;

[0015] The directed cyclic graph is updated according to the loop nodes to obtain an updated process directed graph.

[0016] In one embodiment, determining the criticality of each node in the tree diagram includes:

[0017] For each node in the dendrogram, determining an initial value of the subtree size of the current node as a key value of the current node;

[0018] Determine the subtree scale values ​​corresponding to each child node of the current node, which are key values ​​of the child nodes;

[0019] The key value of the current node is summed with the key values ​​of each of the child nodes to obtain the criticality of the current node.

[0020] In one embodiment, the method further comprises:

[0021] If the current node is a loop node, the criticality of the current node is determined to be the criticality of the nodes corresponding to each process included in the current node.

[0022] In one embodiment, performing a chaos test on the process corresponding to the node according to the process test sequence corresponding to the criticality includes:

[0023] Determine the criticality ranking sequence of the processes corresponding to the nodes according to the order of the criticality of the nodes in the dendrogram;

[0024] If there are processes with the same criticality in the criticality sorting sequence, reorder the criticality sorting sequence according to the process IDs of the processes from small to large to obtain a reordered criticality sorting sequence;

[0025] Through the chaos testing tool, each process in the reordered criticality sorting sequence is subjected to abnormal simulation, and the simulation result of each process abnormal simulation is determined; the simulation result includes the process recovery time, the system recovery time, and the number and name of other affected processes.

[0026] In a second aspect, the present application also provides a chaos testing device for a system process. The device comprises:

[0027] A directed graph determination module, used to determine a process directed graph according to processes in the system and dependencies between the processes; nodes in the process directed graph correspond to processes;

[0028] A criticality determination module, used to determine a tree diagram corresponding to the process directed graph, and for the tree diagram, determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0029] The process testing module is used to perform a chaos test on the process corresponding to the node according to the process testing sequence corresponding to the criticality.

[0030] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the following steps are implemented:

[0031] Determine a process directed graph according to processes in the system and dependencies between the processes; the nodes in the process directed graph correspond to the processes;

[0032] Determine a tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0033] According to the process test sequence corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0035] Determine a process directed graph according to processes in the system and dependencies between the processes; the nodes in the process directed graph correspond to the processes;

[0036] Determine a tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0037] According to the process test sequence corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0038] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0039] Determine a process directed graph according to processes in the system and dependencies between the processes; the nodes in the process directed graph correspond to the processes;

[0040] Determine a tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0041] According to the process test sequence corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

[0042] The chaos testing method, device, computer equipment, storage medium and computer program product of the above-mentioned system process determine a process directed graph composed of processes through the dependency relationship between each process and process in the system, and each node in the process directed graph corresponds to a process. By converting the process directed graph, a corresponding tree diagram is obtained, and the dependency relationship between processes can be represented according to the parent-child relationship of each node in the tree diagram. By determining the criticality of each node in the tree diagram, the importance of each process can be determined, and each process is sorted based on the criticality to obtain the process test order of each process. The process is subjected to chaos testing according to the process test order to ensure that important processes are subjected to chaos testing first, so that important processes and processes that cause important problems in the system can be quickly tested, thereby improving the efficiency of chaos testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 An application environment diagram of a chaos testing method for a system process in one embodiment;

[0045] Figure 2 A schematic diagram of a chaotic testing method for a system process in one embodiment;

[0046] Figure 3 is a schematic diagram of a directed cyclic graph in one embodiment;

[0047] Figure 4 is a schematic diagram of a directed acyclic graph in one embodiment;

[0048] Figure 5 is a schematic diagram of a tree diagram in one embodiment;

[0049] Figure 6 It is a structural block diagram of a chaos testing device for a system process in one embodiment;

[0050] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0052] The chaos testing method for the system process provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network, and the terminal 102 can send the processes in the system and the dependencies between the processes to the server 104. The server 104 can determine the processes as nodes, and the dependencies between the processes as edges, to obtain a process directed graph, so that the nodes in the process directed graph correspond to the processes. The server 104 can convert the process directed graph, and represent the edges in the process directed graph with the parent-child relationship between the nodes, so as to obtain a dendrogram corresponding to the process directed graph. The server 104 can determine the criticality of each node according to the key values ​​of each node in the dendrogram and the key values ​​of the child nodes corresponding to each node, and determine the process test order of each node according to the criticality, and finally the server 104 performs chaos testing according to the process test order.

[0053] The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The server 104 can be implemented as an independent server or a server cluster consisting of multiple servers.

[0054] In an exemplary embodiment, Figure 2 As shown in the figure, a chaos testing method for a system process is provided. Figure 1 The server 104 in the example is used as an example to illustrate the method, which includes the following steps S202 to S206. Among them:

[0055] Step S202: determining a process directed graph according to the processes in the system and the dependencies between the processes.

[0056] The nodes in the process directed graph correspond to the processes; the nodes in the process directed graph are used to represent at least one process; the edges in the process directed graph are used to represent the dependency relationship between two processes; the dependency relationship is used to represent the execution sequence between two processes. The server needs to test the dependent process first before continuing to execute other processes based on the dependency relationship. The process directed graph uses a graph data structure to represent each process and the dependency relationship between processes.

[0057] Specifically, the server can traverse all processes on the system and the dependencies between processes. After obtaining the processes and dependencies, the processes can be regarded as nodes, the dependencies can be regarded as directed edges, and multiple nodes and multiple directed edges can be combined to obtain a process directed graph. In an example, there are processes A, B, C, and D, where the dependency relationship is that processes B and D depend on process A, process A depends on process C, and process C depends on process B. Only when process A is executed can processes B and D be executed, and only when process C is executed can process A be executed.

[0058] Step S204, determining a tree diagram corresponding to the process directed graph, and determining the criticality of each node in the tree diagram.

[0059] Among them, the criticality is determined based on the critical value of the node and the critical value of the node's child nodes; the criticality is used to indicate the importance of the node. Each process corresponding to each node corresponds to a criticality. The nodes in the tree diagram are used to represent at least one process. The edges in the tree diagram are undirected edges. Each node in the tree diagram may include a root node and a leaf node.

[0060] Specifically, the server can use the node pointed to by the directed edge in the process directed graph as the parent node of the dendrogram, thereby determining the child nodes and parent nodes in the dendrogram, and connecting the child nodes and parent nodes through undirected edges to obtain the dendrogram corresponding to the process directed graph. For each node in the dendrogram, the server can determine the key value of the current node, and traverse the child nodes of the current node to obtain the key value corresponding to the child nodes of the current node. The server merges the key value of the current node with the key value corresponding to the child nodes of the current node to obtain the criticality of the current node. In an example, the current node is process A, and the child nodes of the current node are process B and process D. The key value of process A is 1, the key value of process B is 2, and the key value of process D is 1. Then the key values ​​of process A, process B and process D can be merged to obtain the criticality of process A as 4.

[0061] Step S206: Perform a chaos test on the process corresponding to the node according to the process test sequence corresponding to the criticality.

[0062] The process test sequence is used to indicate the order in which the processes in the system are arranged, and the process test sequence is used to determine the order in which the processes are subjected to chaos testing. Chaos testing is a software testing method used to improve the reliability and resilience of a system in the face of uncertainty and failures. The server can discover problems with the process by actively introducing failures or abnormalities to observe how the system responds.

[0063] Specifically, the server can sort the nodes according to their criticality. For example, the server obtains the process test order of each process according to the order of the criticality of the nodes. For each process, the server can perform chaos testing on the current process separately to determine the performance and feedback of the current process in the face of failures and abnormalities.

[0064] In the above-mentioned chaotic testing method for system processes, a process directed graph composed of processes is determined through the dependency relationship between each process and process in the system, and each node in the process directed graph corresponds to a process. By converting the process directed graph, a corresponding tree diagram is obtained, and the dependency relationship between processes can be represented according to the parent-child relationship of each node in the tree diagram. By determining the criticality of each node in the tree diagram, the importance of each process can be determined, and each process is sorted based on the criticality to obtain the process test order of each process. The processes are subjected to chaotic testing in the process test order to ensure that important processes are subjected to chaotic testing first, so that important processes and processes that cause important problems in the system can be quickly tested, thereby improving the efficiency of chaotic testing.

[0065] In an exemplary embodiment, the specific implementation process of the step of "determining a process directed graph according to the dependencies between processes in the system" includes:

[0066] Obtain the dependency relationship of each process in the system, determine a vector SVG file for storing the dependency relationship; according to the strategy that the directed edge points from the node corresponding to the current process to the node corresponding to the dependent process, convert the SVG file into a process directed graph.

[0067] The process directed graph includes at least one of a directed cyclic graph and a directed acyclic graph. The vector SVG file is an XML-based vector graphics file format used to describe two-dimensional graphics.

[0068] Specifically, the server can traverse all processes in the system and the dependencies recorded inside each process. The server generates an SVG file using the process as an element and the dependency as a path. The server parses the SVG file, determines the processes in the SVG file as nodes, and determines the edges in the SVG file as directed edges. The server can represent the dependency between nodes according to the direction of the directed edges. In the process of generating directed edges, the server can use the directed edges as a node corresponding to the current process pointing to the node corresponding to the dependent process, so that a directed edge can represent the dependency between two nodes. Based on this, the server can represent the dependency between nodes through directed edges, and generate a directed graph of processes consisting of nodes and directed edges.

[0069] In one example, each process in the system does not necessarily have a dependency relationship, so multiple process directed graphs can exist in the same system, and the type of each process directed graph is different. The type of process directed graph can include directed cyclic graphs, directed acyclic graphs, and individual nodes. For individual nodes, since individual nodes do not have dependencies, the processing of determining the tree diagram corresponding to the individual nodes is not performed in the embodiment of the present application. However, it is still necessary to test the process corresponding to the individual node.

[0070] In this embodiment, by using directed edges as dependencies of processes and abstracting processes as nodes to represent elements in an SVG graph, an SVG file can be accurately converted into a process directed graph, thereby improving the accuracy of generating the process directed graph.

[0071] In an exemplary embodiment, after the step of “determining a process directed graph according to the processes in the system and the dependencies between the processes”, the method further includes:

[0072] If the process directed graph contains a directed cyclic graph, the loop of the directed cyclic graph is determined, each process in the loop is merged and determined as a loop node of the directed cyclic graph, and the directed cyclic graph is updated according to the loop node to obtain an updated process directed graph.

[0073] Among them, the loop node is a single abstract node, which is used to represent the nodes corresponding to each process in the loop. A directed cyclic graph contains directed edges and loops. A loop is used to represent the directed edges between multiple nodes forming a closed loop. The loop node is used to represent all nodes in the loop through one node.

[0074] Specifically, the server can determine the type of the process directed graph. If it is determined that the type of the process directed graph is a directed cyclic graph, a topological sorting method can be used to detect the loop in the process directed graph and determine the processes contained in the loop. For example, if it is detected that there is a loop consisting of process A->process B->process C->process A, it can be determined that the loop contains process A, process B, and process C. The server can represent the nodes corresponding to process A, process B, and process C respectively with a loop node. The server uses the loop node to replace the original nodes of each process in the loop, thereby updating the process directed graph, eliminating the loop of the process directed graph, and changing the type of the process directed graph from a directed cyclic graph to a directed acyclic graph.

[0075] Since the loop node can represent the original process in the loop, the loop node can replace the dependency relationship contained in the original process. For example, the loop node P can replace the nodes corresponding to the original processes A, B, and C. The original dependency relationship between process A and process D can be converted to the dependency relationship between loop node P and process D. The original dependency relationship between process B and process F can be converted to the dependency relationship between loop node P and process F.

[0076] In this embodiment, by identifying the loop in the process directed graph and replacing each node of the loop in the process directed graph with the loop node, the type of the process directed graph can be converted from a directed cyclic graph to a directed acyclic graph, thereby reducing the complexity of the process directed graph.

[0077] In an exemplary embodiment, the specific implementation process of the step of "determining the criticality of each node in the tree diagram" includes:

[0078] For each node in the dendrogram, determine the initial value of the subtree scale of the current node as the key value of the current node; determine the subtree scale values ​​corresponding to each child node of the current node as the key values ​​of the child nodes; sum the key value of the current node with the key values ​​of each child node to obtain the criticality of the current node.

[0079] Specifically, the subtree scale initial value is a key value pre-set for each node itself. For example, the subtree scale initial value can be set as the first key value and the second key value for node A and node B, respectively. The subtree scale value of a child node is the sum of the subtree scale initial values ​​of all nodes in the subtree corresponding to the child node. For example, child node C is a child node of node A, and child node C also has a subtree that depends on child node C. The server can determine the subtree scale initial value of child node C, the subtree scale value of each node in the subtree of child node C, and sum the subtree scale initial value of child node C and the subtree scale value of each node in the subtree of child node C to obtain the subtree scale value of child node C. The server can sum the subtree scale initial value of the current node and the subtree scale values ​​corresponding to each child node of the current node to obtain the criticality of the current node. Based on this, the server can obtain the criticality of each node in the tree diagram.

[0080] In this embodiment, the subtree scale value of the subtree corresponding to each node is gradually obtained through the initial value of the subtree scale of each node in the tree diagram, and the criticality of the node is obtained through the subtree scale value and the initial value of the subtree scale, which can improve the accuracy and efficiency of determining the criticality.

[0081] In an exemplary embodiment, the method further includes: if the current node is a loop node, determining the criticality of the current node as the criticality of the nodes corresponding to each process included in the current node.

[0082] Specifically, if the node in the tree diagram is a loop node, the loop node contains multiple processes. At this time, the criticality corresponding to the loop node can be shared as the criticality of the nodes corresponding to the multiple processes. For example, loop node P contains process A, process B and process C, and the criticality corresponding to loop node P is 10, then the criticality of process A, process B and process C is also 10.

[0083] Optionally, the server can re-determine the initial value of the subtree scale of each node based on the initial value of the subtree scale of each node represented by the loop node, and the sum of the initial value of the subtree scale of each node and the key value of the child node of the loop node is the criticality corresponding to the node. For example, the key value of the child node of the loop node P is 9. At this time, the initial values ​​of the subtree scale of process A, process B, and process C are 1, 2, and 3 respectively, so it can be determined that the criticality of process A, process B, and process C is 10, 11, and 12 respectively.

[0084] Optionally, the criticality of each individual node may be an initial value of the subtree size of the node.

[0085] In this embodiment, by sharing the criticality of the loop node with different processes corresponding to the loop node, the criticality of the node corresponding to each process can be quickly determined.

[0086] In an exemplary embodiment, the specific implementation process of the step of "performing a chaos test on the process corresponding to the node according to the process test sequence corresponding to the criticality" includes:

[0087] According to the order of the criticality of each node in the dendrogram, the criticality sorting sequence of the process corresponding to the node is determined; if there are processes with the same criticality in the criticality sorting sequence, the criticality sorting sequence is reordered in the order of the process ID from small to large to obtain the reordered criticality sorting sequence; through the chaos testing tool, the abnormal simulation of each process in the reordered criticality sorting sequence is performed, and the simulation result of the abnormal simulation of each process is determined.

[0088] The simulation results include process recovery time, system recovery time, and the number and names of other affected processes.

[0089] Specifically, the server can sort the criticality of the nodes corresponding to each process, and sort them from large to small according to the order of size to obtain a criticality sorting sequence. For multiple processes with the same criticality in the criticality sorting sequence, the multiple processes with the same criticality can be re-sorted according to the process IDs of the processes, in the order of process IDs from small to large, or from large to small, so as to complete the update of the criticality sorting sequence and obtain the re-sorted criticality sorting sequence.

[0090] After obtaining the reordered criticality sorting sequence, the server can use the pre-built chaos testing tool to perform abnormal simulation on each process in the criticality sorting sequence until all processes have undergone at least one abnormal simulation. For each process, the performance of the operating system can be monitored during the abnormal simulation, and the simulation results can be fed back. For example, the process recovery time, system recovery time, and the number and names of other affected processes that have abnormalities can be recorded. At the same time, determine whether the process has system crashes, restarts, etc. during the abnormal simulation, and record them in the simulation results.

[0091] Optionally, for all process directed graphs corresponding to each process of the system and all individual nodes corresponding to each process of the system, the server may determine the criticality of each node in the tree diagram corresponding to the process directed graph and the criticality of each individual node. The server may determine the criticality sorting sequence of the process corresponding to the node according to the order of the criticality of all nodes.

[0092] In this embodiment, the processes are sorted by the criticality of the nodes and the size of the process ID to obtain a criticality sorting sequence, and chaos testing is performed on each process based on the criticality sorting sequence to obtain the simulation results of each chaos test. This allows priority testing of processes with high importance and identification of problems with important processes, thereby avoiding system crashes and improving the testing efficiency of important processes.

[0093] The following is a detailed description of the specific execution process of the chaos testing method for the above-mentioned system process in combination with a specific embodiment. It mainly includes the following steps: retrieving process dependencies, converting dependencies into a directed graph, detecting loops in directed graphs and taking loops, converting acyclic directed graphs into tree graphs, calculating the criticality of each node, formulating a process exception sequence, using chaos testing tools or generating scripts to simulate process exceptions in sequence, and monitoring the performance of the operating system to evaluate the robustness of the system. This embodiment is mainly used to improve test coverage, improve test efficiency, quickly expose system problems, and enrich test methods.

[0094] Specifically, the first step is to retrieve the dependencies of all processes on the system and generate a dependency SVG file. The second step is to convert the above SGV file into a directed graph according to preset rules. Each node represents a process. According to the dependencies between processes in the SVG file, the directed edges of the directed graph point from the node corresponding to the current process to the node corresponding to the process on which it depends. The third step is to perform loop detection and ring extraction on the above directed graph. A topological sorting algorithm is used to detect the loop in the directed graph, and the processes corresponding to the nodes in the loop are recorded.

[0095]

[0096] in Represents a process. Each ring is then abstracted into a large node. ,but . Regenerate to node The directed edges of the directed graph are finally converted into a directed acyclic graph. Step 4: Convert the directed acyclic graph into a tree graph. Each node corresponds to a node in the directed graph one by one, and the node pointed to by the directed edge of the directed graph is the parent node in the tree graph.

[0097] Step 5: Calculate the subtree size of each node in the above tree diagram , that is, the criticality of each node corresponding to the process. Set the initial value of the subtree size of each node to 1 (representing the node itself), that is For each child node of each parent node, use the depth-first search (DFS) algorithm to calculate its subtree size value , then the subtree scale value of the parent node is the sum of the subtree scale initial value plus the subtree scale values ​​of all its child nodes, that is When there is a ring that is removed in the third step, calculate the node representing the ring The subtree size is ,Since the processes in the ring are interdependent, their criticality is defined to be the same, that is, .

[0098] Step 6: Establish the critical process exception sequence. Sort from large to small. If there are processes with the same criticality, sort them from small to large according to the process ID. Step 7: According to the above sorting, use chaos testing tools or generate shell scripts to simulate process anomalies in turn. Step 8: Monitor the performance of the operating system and provide feedback, such as the number and name of process anomalies, system recovery time, etc. If the system crashes, restarts, and other unavailable situations occur, you need to troubleshoot and fix the problem.

[0099] The embodiment of the present application converts the process dependency into a directed graph, further processes the directed graph and converts it into a tree graph, and then calculates the subtree size of each leaf node, non-leaf node, and root node. According to the subtree size of each node, a process criticality ranking can be obtained, thereby performing a planned and sequential chaos test of process failures, which can effectively avoid the problem of missing core processes, and at the same time can improve test efficiency and speed up problem discovery, and the method is also inheritable.

[0100] In another exemplary embodiment, the first step is to use the operating system process No. 1 to retrieve the dependencies of all processes on the system, such as using the process No. 1 of the Linux system, and the systemd process command to generate an SVG file of all process dependencies.

[0101] Step 2: Convert the above SVG file into a directed graph according to certain rules. For example, the dependency relationship of processes A, B, C, D, E, and F described in the SVG file is that process A depends on process B and process D, process B depends on process C, process C depends on process A, process E depends on process A, and process F depends on process B. According to the rule that each node represents a process and the directed edge points from the node corresponding to the current process to the node corresponding to the process it depends on, the dependency relationship in the above example can be converted into the following: Figure 3 A directed graph with a cycle: According to the dependency description of the entire SVG file, multiple independent directed graphs will be generated, including directed cyclic graphs, directed acyclic graphs, single nodes, etc.

[0102] Step 3: Use the topological sorting method to detect the rings in each directed graph and record the process name in each ring, such as Figure 3 Ring in , and record the process as , and then Figure 3 The ring in is abstracted into a large node ,but . Finally, regenerate the node The directed edges of Figure 4 As shown, there are directed edges Convert to , directed edge Convert to , directed edge Convert to , so far, The ring is removed, there is a directed ring Figure 3 Convert to a directed acyclic Figure 4 According to this method, the loops of each directed graph are detected and removed in turn until all graphs are converted into directed acyclic graphs.

[0103] Step 4: Convert each of the above directed acyclic graphs into a tree graph. For example Figure 4 Nodes in are the root node and leaf node of the tree graph respectively. The node pointed by the directed edge is the parent node of the tree graph. The converted tree graph is as follows Figure 5 As shown, node D is the root node, node It is the leaf node of node D. Node E and node F are both nodes In the same way, all directed acyclic graphs are converted into tree graphs.

[0104] Step 5: Calculate the subtree size value of each node in the above tree diagram, that is, the criticality of the process corresponding to each node. Assume Figure 5The initial value of the subtree size of each node in is 1 (representing the node itself), that is, .

[0105] For each parent node, a depth-first search algorithm is used to calculate the subtree size value , then the subtree size of the parent node is the sum of the initial value and the subtree sizes of all its child nodes. Figure 5 In the node The subtrees of are node E and its subtree, and node F and its subtree. Then node The subtree scale value of is the initial value plus the subtree scale value of node E and the subtree scale value of node F, that is .

[0106] The subtree of node D is node and Node The subtree of node D is the initial value plus the subtree size of the node, that is, .

[0107] Leaf nodes E and F have no subtrees, so their subtree sizes are the initial values, that is, Since the ring was removed in the third step , and there is , so the criticality of the three processes A, B, and C is equal to the node The subtree size value is So far, the criticality of processes A, B, C, D, E, and F has been calculated using the above method. Similarly, the criticality of all processes in the system can be calculated.

[0108] Step 6: Sort the criticality of each process from large to small. If there are processes with the same criticality, sort them from small to large according to the process ID, where the criticality has a higher priority than the process ID. In step 5, the criticality of processes A, B, and C is the same, and the criticality of processes E and F is also the same. Use the ps command of the operating system to view their process IDs respectively. Each process ID is unique and can be sorted from small to large according to the process ID. Assume that the order of the IDs of processes A, B, and C from small to large is [ N A , N B , N C ] , the order of process E and F's ID from small to large is [ N F , N E ] ,So Figure 3The criticality of all processes in the system is sorted from large to small. [ λ D , λ A , λ B , λ C , λ F , λ E ] .

[0109] Similarly, according to the criticality and process ID of each process in the system, by inserting it into the correct position in the sorting sequence during sorting, the criticality ranking of all processes in a system can be obtained. The criticality ranking reflects the ranking of the degree of impact of process abnormalities on the system.

[0110] Step 7: Use chaos testing tools or generate shell scripts to simulate the corresponding process exceptions in the order of the criticality sorting sequence of all processes in the system from left to right, until all processes are simulated to have an exception.

[0111] Step 8: In step 7, each time a process exception is simulated, the operating system performance must be monitored and feedback must be provided. For example, the process recovery time, system recovery time, the number and names of other processes that are affected and have exceptions, etc. At the same time, attention must be paid to whether the system will crash, restart, etc. If the system crashes, restarts, or is otherwise unavailable, the problem must be troubleshooted and fixed.

[0112] Optionally, the embodiment of the present application can be simplified in specific implementation, without performing tree diagram conversion, and directly using the depth-first search (DFS) algorithm to calculate the process criticality of each node in the directed acyclic graph. When calculating the subtree scale value, the embodiment of the present application involves the setting of an initial value, and this setting can be modified according to actual conditions to adapt to the different requirements of different systems. When a process is abnormal, the embodiment of the present application records the number and names of other processes that are affected and abnormal when a process is abnormal. By comparing with the current process relationship dependency graph, the process relationship dependency graph can be iteratively updated in a timely manner, and a recalculation of the criticality is triggered at the same time, so that the dependency relationship in the graph is updated in real time, thereby ensuring that the calculated process criticality has a higher accuracy.

[0113] In this embodiment, the directed graph is subjected to a ring extraction process by a topological sorting method, and finally the system process dependency is visualized as the parent-child relationship of the nodes in the tree diagram, making the dependency more intuitive. At the same time, the process forming the ring is redefined, the structure of the tree diagram is simplified, and the dependency is clearer. In this embodiment, the criticality of each process is obtained by calculating the subtree scale of each node. First, an initial value is assigned to each node, and then the subtree scale of each node is iteratively calculated using a depth-first search algorithm, so as to obtain the criticality of each process, effectively quantify the impact of each process on the system robustness, and provide a reliable data basis for formulating the order of process exceptions. In this embodiment, the process exception order is formulated by the process criticality and the process ID. In the embodiment, the first priority is the process criticality, and the second priority is the process ID, which solves the problem of process exception sorting, and there will be no situation where a certain process cannot be sorted. The sorting result can help testers effectively avoid the omission of core processes, and at the same time, starting from the process with high criticality, simulating the exceptions in sequence can find system problems more quickly. In addition, after the method is automated, the test method can produce good inheritability, and the test methods of testers are diverse. Moreover, through continuous iterative updates, this method can adapt to changes in new versions, so that it can be used as a reliable testing method.

[0114] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0115] Based on the same inventive concept, the embodiment of the present application also provides a chaos testing device for a system process for implementing the chaos testing method for the system process involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of the chaos testing device for one or more system processes provided below can refer to the limitations of the chaos testing method for the system process above, and will not be repeated here.

[0116] In an exemplary embodiment, Figure 6As shown, a chaos testing device 600 for a system process is provided, comprising: a directed graph determination module 601, a criticality determination module 602 and a process testing module 603, wherein:

[0117] A directed graph determination module 601 is used to determine a process directed graph according to the dependencies between processes in the system; the nodes in the process directed graph correspond to the processes;

[0118] The criticality determination module 602 is used to determine the tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node;

[0119] The process testing module 603 is used to perform a chaos test on the process corresponding to the node according to the process testing sequence corresponding to the criticality.

[0120] Furthermore, the directed graph determination module 601 is specifically used to: obtain the dependency relationship of each process in the system, and determine a vector graph SVG file used to store the dependency relationship; according to the strategy that the directed edge points from the node corresponding to the current process to the node corresponding to the dependent process, convert the SVG file into a process directed graph; the process directed graph includes at least one of a directed cyclic graph and a directed acyclic graph.

[0121] Furthermore, the device also includes a directed graph update module, which is used to determine the loop of the directed cyclic graph if the process directed graph contains a directed cyclic graph; merge the processes in the loop and determine them as loop nodes of the directed cyclic graph; the loop node is a single abstract node, and the abstract node is used to represent the node corresponding to each process in the loop at a higher level; update the directed cyclic graph according to the loop node to obtain an updated process directed graph.

[0122] Furthermore, the criticality determination module 602 is specifically used to: for each node in the tree diagram, determine the initial value of the subtree scale of the current node as the critical value of the current node; determine the subtree scale values ​​corresponding to each child node of the current node as the critical value of the child node; sum the critical value of the current node with the critical value of each child node to obtain the criticality of the current node.

[0123] Furthermore, the criticality determination module 602 is further specifically configured to: if the current node is a loop node, determine the criticality of the current node as the criticality of the nodes corresponding to each process included in the current node.

[0124] Furthermore, the process testing module 603 is specifically used to: determine the criticality sorting sequence of the process corresponding to the node according to the order of the criticality of each node in the tree diagram; if there are processes with the same criticality in the criticality sorting sequence, reorder the criticality sorting sequence in order of the process ID from small to large to obtain the reordered criticality sorting sequence; use the chaos testing tool to perform abnormal simulation on each process in the reordered criticality sorting sequence, and determine the simulation results of the abnormal simulation of each process; the simulation results include process recovery time, system recovery time, and the number and names of other affected processes.

[0125] Each module in the chaos test device of the above system process can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0126] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as a process directed graph and a tree diagram constituted by each process. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a chaos testing method for a system process is implemented.

[0127] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0128] In an exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the following steps are implemented: a process directed graph is determined according to the dependency relationship between processes in the system; the nodes in the process directed graph correspond to the processes; a tree diagram corresponding to the process directed graph is determined, and for the tree diagram, the criticality of each node in the tree diagram is determined; the criticality is determined based on the critical value of the node and the critical value of the node's child nodes; the criticality is used to indicate the importance of the node; and a chaos test is performed on the process corresponding to the node according to the process test order corresponding to the criticality.

[0129] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: determining a process directed graph based on the dependency relationship between processes in the system; the nodes in the process directed graph correspond to the processes; determining a tree diagram corresponding to the process directed graph, and determining the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child nodes of the node; the criticality is used to indicate the importance of the node; and performing a chaos test on the process corresponding to the node according to the process test order corresponding to the criticality.

[0130] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: determining a process directed graph based on the dependencies between processes in the system; the nodes in the process directed graph correspond to the processes; determining a tree diagram corresponding to the process directed graph, and determining the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child nodes of the node; the criticality is used to indicate the importance of the node; and performing a chaos test on the process corresponding to the node according to the process test order corresponding to the criticality.

[0131] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0132] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0133] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A chaos testing method for a system process, characterized in that: The method comprises: Determine a process directed graph according to processes in the system and dependencies between the processes; the nodes in the process directed graph correspond to the processes; Determine a tree diagram corresponding to the process directed graph, and determine the criticality of each node in the tree diagram for the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node; According to the process test sequence corresponding to the criticality, a chaos test is performed on the process corresponding to the node.

2. The method according to claim 1, characterized in that Determining a process directed graph according to processes in the system and dependencies between the processes includes: Obtaining dependency relationships among processes in the system, and determining a vector SVG file for storing the dependency relationships; According to the strategy that the directed edge points from the node corresponding to the current process to the node corresponding to the dependent process, the SVG file is converted into a process directed graph; the process directed graph includes at least one of a directed cyclic graph and a directed acyclic graph.

3. The method according to claim 2, characterized in that After determining the process directed graph according to the processes in the system and the dependency relationships between the processes, the method further includes: If the process directed graph includes a directed cyclic graph, determining a loop of the directed cyclic graph; Merging the processes in the loop and determining them as loop nodes of the directed cyclic graph; the loop node is a single abstract node, and the abstract node is used to represent the nodes corresponding to the processes in the loop in a higher level; The directed cyclic graph is updated according to the loop nodes to obtain an updated process directed graph.

4. The method according to claim 3, characterized in that Determining the criticality of each node in the dendrogram includes: For each node in the dendrogram, determining an initial value of the subtree size of the current node as a key value of the current node; Determine the subtree scale values ​​corresponding to each child node of the current node, which are key values ​​of the child nodes; The key value of the current node is summed with the key values ​​of each of the child nodes to obtain the criticality of the current node.

5. The method according to claim 4, characterized in that The method further comprises: If the current node is a loop node, the criticality of the current node is determined to be the criticality of the nodes corresponding to each process included in the current node.

6. The method according to claim 1, characterized in that The step of performing a chaos test on the process corresponding to the node according to the process test sequence corresponding to the criticality includes: Determine the criticality ranking sequence of the processes corresponding to the nodes according to the order of the criticality of the nodes in the dendrogram; If there are processes with the same criticality in the criticality sorting sequence, reorder the criticality sorting sequence according to the process IDs of the processes from small to large to obtain a reordered criticality sorting sequence; Through the chaos testing tool, each process in the reordered criticality sorting sequence is subjected to abnormal simulation, and the simulation result of each process abnormal simulation is determined; the simulation result includes the process recovery time, the system recovery time, and the number and name of other affected processes.

7. A chaos testing device for a system process, characterized in that: The device comprises: A directed graph determination module, used to determine a process directed graph according to processes in the system and dependencies between the processes; nodes in the process directed graph correspond to processes; A criticality determination module, used to determine a tree diagram corresponding to the process directed graph, and for the tree diagram, determine the criticality of each node in the tree diagram; the criticality is determined based on the critical value of the node and the critical value of the child node of the node; the criticality is used to indicate the importance of the node; The process testing module is used to perform a chaos test on the process corresponding to the node according to the process testing sequence corresponding to the criticality.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Chaos test method and system, electronic equipment and storage medium

    CN113515449A

  • Test task processing method and device, equipment and storage medium

    CN114185656A

  • Abnormal process detection method and device, equipment and medium

    CN115827379A

  • Automatic testing method and device, equipment and storage medium

    CN116107892A

  • Multi-process parallel test method, device, equipment, program product and medium

    CN117667652A