WO2019178957A1 - Distributed system test method and device, computer device and storage medium - Google Patents
Distributed system test method and device, computer device and storage medium Download PDFInfo
- Publication number
- WO2019178957A1 WO2019178957A1 PCT/CN2018/091911 CN2018091911W WO2019178957A1 WO 2019178957 A1 WO2019178957 A1 WO 2019178957A1 CN 2018091911 W CN2018091911 W CN 2018091911W WO 2019178957 A1 WO2019178957 A1 WO 2019178957A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- target test
- target
- module
- test
- communication link
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3495—Performance evaluation by tracing or monitoring for systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/14—Network analysis or design
- H04L41/145—Network analysis or design involving simulating, designing, planning or modelling of a network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
- G06F11/3419—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3409—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
- G06F11/3433—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment for load management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
Definitions
- the present application relates to the field of system testing, and in particular, to a method, device, computer device and storage medium for testing a distributed system.
- a distributed system is a system that distributes hardware and software components on a network computer and communicates and coordinates through messaging. After the completion of the distributed system, the software testing of the system will be involved.
- the current mainstream software testing models (such as V model, W model, H model and X model) are mainly designed for non-distributed systems. Although it has certain applicability in the testing of distributed systems, with the development of distributed system technology and the improvement of testing requirements, these software testing models have not been able to meet the needs of distributed system testing. At the same time, because the distributed system has the characteristics of component networking and high deployment cost, the existing test methods for distributed systems are not convenient and the test efficiency is low.
- the embodiments of the present application provide a testing method, a device, a computer device, and a storage medium of a distributed system, so as to solve the problem that the testing method of the existing distributed system is not convenient and efficient.
- an embodiment of the present application provides a testing method for a distributed system, including the following steps:
- the distributed system test request includes a target test module, a target test type, and a target test time;
- an embodiment of the present application provides a testing apparatus for a distributed system, including:
- a distributed system test request obtaining module configured to obtain a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time;
- a communication link data acquiring module configured to acquire communication link data of the target test module, where the communication link data includes a number of target I/O ports;
- An idle time period obtaining module configured to acquire and display the number of idle I/O ports greater than or equal to the target if the number of target I/O ports is greater than or equal to the number of idle I/O ports during the target test time The idle time period of the number of I/O ports;
- the test module is configured to obtain an adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
- an embodiment of the present application provides a computer device, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
- the distributed system test request includes a target test module, a target test type, and a target test time;
- the embodiment of the present application provides one or more non-volatile readable storage media storing computer readable instructions, when the computer readable instructions are executed by one or more processors, such that the one or Multiple processors perform the following steps:
- the distributed system test request includes a target test module, a target test type, and a target test time;
- FIG. 1 is a flowchart of a testing method of a distributed system in Embodiment 1 of the present application;
- step S40 in FIG. 1 is a flow chart of a specific embodiment of step S40 in FIG. 1;
- FIG. 3 is a flow chart of another embodiment of step S40 of Figure 1;
- step S51 in FIG. 3 is a flow chart of a specific embodiment of step S51 in FIG. 3;
- FIG. 5 is a flow chart of another embodiment of step S51 of Figure 3;
- FIG. 6 is a schematic diagram of a testing apparatus of a distributed system provided in Embodiment 2 of the present application.
- FIG. 7 is a schematic diagram of a computer device provided in Embodiment 4 of the present application.
- FIG. 1 is a flow chart showing a test method of a distributed system in the present embodiment.
- the test method of the distributed system is applied to various terminals or systems to solve the problem that the test method of the existing distributed system is convenient and inefficient.
- the test method of the distributed system includes the following steps (exemplarily, the embodiment uses a test system to perform the following steps):
- S10 Acquire a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time.
- the distributed system test request refers to the initiation request for testing the distributed system.
- a distributed system includes multiple modules that can trigger a distributed system test request when one of the modules needs to be tested.
- the distributed system test request includes the target test module, the target test type, and the target test time.
- the target test module is used to point to or identify the modules in the distributed system that need to be tested.
- the target test type refers to the specific test type of the target test module that needs to be tested in the distributed system.
- the target test type may include: performance test, reliability test, stress test or functional test.
- the target test time refers to a preset time required to test the target test module in the distributed system.
- the target test time includes a start time and an end time, or the target test time includes a start time and a test duration.
- S20 Acquire communication link data of the target test module, where the communication link data includes the number of target I/O ports.
- the physical channel between two nodes in the network is called a communication link.
- Communication link data is used to measure data communicated between a target test module and other modules.
- the number of target I/O ports refers to the number of I/O ports required to test the target test module. Specifically, the number of corresponding target I/O ports can be determined according to the number of communication links of the target test module. In one embodiment, the number of target I/O ports can be equal to the number of communication links of the target test module. Optionally, in order to improve test efficiency, the number of target I/O ports may also be greater than the number of communication links of the target test module.
- the target test time and the number of target I/Os it is judged whether the number of idle I/O ports of the test system within the target test time meets the requirements. If the number of target I/O ports in the target test time is greater than the number of idle I/O ports, it indicates that the test system does not have enough free I/O ports to support the distributed system test request during the target test time. At this time, an idle time period in which the number of idle I/O ports in the test system is greater than or equal to the number of target I/O ports is obtained and displayed, so that the time for testing the distributed system is adjusted according to the idle time period.
- the number of idle I/O ports in the test system in different time periods can be embodied by establishing an I/O port idle schedule.
- the I/O port idle schedule includes a time interval and a corresponding number of idle I/O ports.
- the time interval can be divided according to the number of idle I/O ports. For example, taking 24 hours as an example, assume that the total number of I/O ports in the test system is 20. If there is a test request occupying 15 I/O ports between 8:00 and 10:00, the number of idle I/O ports of the test system is 20 at other times. Then the I/O port idle schedule can divide the time interval into: [00:00, 8:00], [8:00, 10:00], and [10:00, 24:00], thus, corresponding The I/O port idle schedule can be:
- the number of idle I/O ports in different time intervals can be visually understood through the I/O port idle schedule shown in Table 1. For example, if the distributed system test request, the target test module has a target I/O port number of 10 and the target test time is 9:00-11:00. At this point, the test system will get and display the idle time period of the number of idle I/O ports greater than or equal to 10, namely [00:00, 8:00] and [10:00, 24:00].
- S40 Obtain an adjustment test time. If the current system time reaches the adjustment test time, take over the communication link of the target test module, and test the target test module based on the target test type.
- the user can adjust the target test time according to the idle time period, and the number of idle I/O ports is greater than or equal to the target I/.
- a predetermined time interval is selected within the idle time period of the number of O ports as the adjustment test time, and then the test system acquires the adjustment test time.
- the current system time refers to the current time displayed by the system, and the current system time reaches the adjustment test time, which may specifically refer to the start time of the current system time to reach the adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
- the communication link that takes over the target test module refers to the various communication links that take over communication between the target test module and other modules.
- the takeover of the communication link can be implemented in the following manner (taking the communication link between the client and the server as an example): insert a module between the client and the server.
- the module simulates the server to start the same port for monitoring; then, intercepts the connection request from the client and establishes a connection.
- the module is the server side relative to the client, so that the client can be sent.
- the server-side address is configured on the module.
- the connection request is sent to the server, and the connection is established.
- the module is the client with respect to the server.
- the module forwards the packets received from the client to the server. After the server has processed the request, the return packet is sent to the client through the previously established connection.
- the target test module After taking over the communication link of the target test module, the target test module can be tested based on the target test type.
- the test system By taking over the communication link of the target test module, the test system can simulate the distributed system environment, saving time spent on environmental preparation during the test process, and also saving a lot of machine resources.
- the specific process of testing the target test module can be set according to the type of target test.
- the method further includes: generating a corresponding adjustment test task.
- the adjustment test task refers to the test task whose target test time is adjusted, and a distributed system test request corresponds to a test task.
- Tuning test tasks includes adjusting test time and number of target I/O ports.
- the I/O port idle schedule is updated according to the adjustment test task. In this way, the I/O port idle schedule is updated in real time, ensuring the accuracy of the I/O port idle schedule.
- the test method of the distributed system After obtaining the distributed system test request, it is determined whether the target test module has sufficient time in the target test time by the target I/O port number of the target test module and the target test time. More idle I/O ports for the corresponding test tasks. When there is not enough free I/O ports in the target test time to perform the corresponding test tasks, the reminder is displayed by displaying the corresponding idle time period, so that the user can intuitively select the appropriate test time, thereby smoothly Testing of distributed systems improves the convenience of testing.
- the test system can simulate a distributed system environment, saving time spent on environmental preparation during the test process, and also saving a lot of machine resources.
- the target test module is tested based on the target test type, which improves the test efficiency of the distributed system.
- the test method of the distributed system further includes:
- the communication link of the target test module is taken over, and the target test module is tested based on the target test type. .
- the test system has enough free I/O ports to support the distributed system test request during the target test time.
- the communication link of the target test module is taken over when the current system time reaches the target test time, and the target test module is tested based on the target test type.
- the specific process of testing the target test module can be set according to the type of target test.
- a target test task is generated.
- the target test task refers to a test task generated based on a distributed system test request.
- the target test task includes the target test time and the number of target I/O ports. And update the I/O port idle schedule according to the target test task. In this way, the I/O port idle schedule is updated in real time, ensuring the accuracy of the I/O port idle schedule.
- the distributed system is tested according to the corresponding target test time, and the I/O port is tested.
- the idle schedule is updated in real time to ensure the convenience and accuracy of distributed system testing.
- the communication link that takes over the target test module specifically includes the following steps:
- Port listening is a type of information record that is manipulated by a terminal/module.
- the target test module needs to establish a communication connection with each of the corresponding upstream module and downstream module. Therefore, for each of these modules, it is necessary to start the corresponding port for monitoring and establish a mapping relationship between the port and the destination module.
- the destination module refers to a corresponding module of the target test module to establish a communication connection.
- the upstream module and the downstream module are based on the target test module, and the manner in which the associated modules are distinguished according to the flow direction of the communication data.
- the module upstream of the target test module communication data flow is an upstream module
- the module downstream of the target test module communication data flow is a downstream module.
- the number of ports N to be monitored is determined by the communication link data of the target test module.
- the number of ports to be monitored is the same as the number of target I/O ports.
- the number N of ports determined to be listening can be implemented by LISTEN_NUM.
- the configuration information can be: #define LISTEN_NUM 5.
- the data communication between the target test module and the upstream module or the target test module and the downstream module is established by establishing a mapping relationship between the port and the ip and port of the destination module.
- the ip and port of the destination module and the corresponding upstream module or downstream module must be the same when the mapping between the ip and the port of the destination module is established. Otherwise, the target test module and the upstream module or the target test module and downstream cannot be established.
- the port monitoring is started, and the real-time port monitoring task is performed, waiting for the connection service of the upstream module to trigger the corresponding process.
- S42 Establish a communication link between the target test module and the upstream module and between the target test module and the downstream module based on the idle I/O port.
- the establishment of the communication link connection includes two aspects of connection: (1) accepting the connection request of the upstream module and establishing a connection with the upstream module; (2) issuing a connection request to the corresponding downstream module, and corresponding to the downstream module establish connection.
- the target test module When establishing a connection with an upstream module, the target test module is equivalent to the server side, and the upstream module is equivalent to the client. After the target test module establishes a connection with the upstream module, a handle fd1 is generated. When establishing a connection with the downstream module, the target test module module is equivalent to being a client. By performing a mapping relationship established during the system monitoring process, the port finds the ip and port of the destination module according to the port, and initiates a connection to the corresponding downstream module. The handle fd2 is generated after the connection. By establishing these two connections, it is possible to establish a connection between the upstream module and the downstream module, thereby realizing the effect of simulating the upstream and downstream communication links.
- a communication link between the target test module and the upstream module and between the target test module and the downstream module is established through the idle I/O port.
- an idle I/O port is used to establish a corresponding communication link.
- the target test module communicates with an upstream module and a target test module and five downstream modules
- the six idle I/O ports can be used to establish a target test module, an upstream module, and a target test module, respectively. Communication link between 5 downstream modules.
- the number of destination modules that need to be taken over and the corresponding ip and port of each destination module are determined, and the target test module and the upstream module are established based on the idle I/O port and the target test is performed.
- the communication link between the module and the downstream module facilitates the forwarding and recording of subsequent communication data, ensuring the accuracy and efficiency of the communication link takeover.
- the target test module is tested based on the target test type, as shown in FIG. 3, and specifically includes the following steps:
- S51 Record communication data of the target test module based on the target test type.
- the communication data that needs to be recorded is different for different target test types.
- the corresponding communication data is selected for recording based on the target test type. Specifically, according to different target test types, different test data are selected for input to trigger data interaction between different modules, and the corresponding communication data is recorded by the I/O port that takes over the corresponding communication link.
- the data in two directions that is, the request data sent from the upstream module to the test system and the response data returned from the downstream module to the test system, can be performed on data in different directions during data recording. Mark and record separately.
- the process of recording the communication data of the target test module may be: after the test system obtains the request data sent by the upstream module, the test system identifies and saves the request data, and forwards the request data to the corresponding downstream module. After receiving the corresponding request data, the downstream module responds to the request data and performs related processing. After the processing is completed, the downstream module returns corresponding response data. The test system identifies and saves the response data and forwards the response data to the corresponding upstream module.
- the communication data of the recording target test module further includes forwarding of the communication data.
- two handles fd1 and fd2 are generated.
- the idle I/O port A is connected to the upstream module to generate the handle fd1.
- the handle fd2 is generated by the idle I/O port B being connected to the upstream module. Both handles have corresponding read/write events, so these two handles can be used to forward the communication data.
- the specific communication data forwarding steps are as follows:
- Reading the handle fd1 After the idle I/O port A establishes a connection with the upstream module, a read operation is performed on the handle fd1 to read the request data from the upstream module.
- Reading the handle fd2 after receiving the corresponding request data and processing the request, the downstream module returns the corresponding response data to the handle fd2, and at this time, the read operation of the handle fd2 is read from the downstream module. Take response data.
- the target test module according to the target test type and select the corresponding communication data to obtain the test result.
- the test type is performance test
- the communication data sent to the target test module by the pressure test tool and the recorded upstream module can be used to apply pressure to the tested module, and monitor the running state of the target test module and various performance indicators. And analyze it and finally get the test results.
- the pressure measuring tool refers to a tool for performing a pressure test.
- the communication data corresponding to the target test module is recorded according to the target test type, and the target test module is tested according to the recorded communication data to obtain the test result.
- the communication data of the target test module is recorded, as shown in FIG. 4, specifically including the following steps:
- performance testing is to test various performance indicators of the system through automated test tools to simulate a variety of normal, peak and abnormal load conditions. Both load testing and stress testing are performance tests, and the two can be combined. Through the load test, the performance of the system under various workloads is determined, that is, the changes of various performance indicators of the system when the load is gradually increased. Stress testing is done by determining a system bottleneck or an unacceptable performance point to get the maximum service level test that the system can provide.
- Sending test data to the upstream module can use a pressure test tool to apply pressure to the upstream module.
- the pressure measuring tool refers to a tool for performing a pressure test.
- the stress test simulates the software and hardware environment of the actual application and the system load of the user's use process, and runs the test software for a long time or a large load to test the performance, reliability and stability of the system under test.
- a pressure tool such as Webbench, Siege, or Http_load can be used to apply pressure to the upstream module.
- S512 Record the upstream communication data sent by the upstream module to the target test module and the downstream communication data returned by the downstream module to the target test module.
- the upstream module After transmitting the test data to the upstream module, the upstream module sends the corresponding upstream communication data to the target test module based on the test data, and records the upstream communication data. Specifically, the upstream communication data can be saved to a corresponding upstream communication data file.
- the target test module After receiving the upstream communication data, the target test module will respond to the upstream communication data and perform related processing. After the processing is completed, the data will be sent to the corresponding downstream module, and the downstream module will return the downstream communication data accordingly.
- the downstream communication data is recorded. Specifically, the downstream communication data can be saved to a corresponding downstream communication data file.
- the communication data of the recording target test module further includes forwarding of the communication data.
- the specific forwarding step is similar to the forwarding of the communication data in step S51, and details are not described herein again.
- test data is sent to the upstream module, thereby triggering data communication between different modules, and data recording is completed at the same time as data forwarding, which facilitates data acquisition in subsequent testing, and saves a large amount.
- Machine resources improve the convenience and efficiency of distributed system testing.
- the communication data of the target test module is recorded, as shown in FIG. 5, specifically including the following steps:
- S511' If the target test type is a reliability test, the network abnormality test logic is injected into the communication link, and the predetermined link in the communication link is controlled by the control command to perform interaction.
- the reliability test is the ability of the software system to complete the specified functions within the specified time and under the specified environmental conditions.
- the reliability of a software system is measured by testing it.
- the reliability is measured in two ways: (1) under the specified conditions, the probability that the software does not cause the system to fail within the specified time; (2) the required execution under the predetermined conditions within the specified time period The ability to function.
- the network abnormality test logic is injected into the communication link taken over by the test system, and each communication link in the abnormal network condition is tested by controlling the command to control the predetermined link in the communication link to interact.
- the interaction data so as to achieve the purpose of reliability testing.
- the network abnormality test logic refers to test logic that modifies specific network parameters and monitors key nodes. For example, the ability of distributed system load balancing largely determines the reliability of the system. For the system load balancing test, it includes two dimensions of the equalization of node access frequency and the balance of node communication data volume.
- some identification information can be inserted into the source code, and the frequency of accessing each node of the system can be analyzed by sending pressure and counting these identifiers.
- the performance data of each server is recorded when the pressure is sent, and the performance data of the network card is analyzed to test whether the hot data is dispersed evenly.
- the injection of network abnormality test logic can be implemented by using a hook technique. That is, replace the function called in the program under test, and populate the function containing the test logic.
- a hook technique That is, replace the function called in the program under test, and populate the function containing the test logic.
- test logic For the user-defined function, by modifying the symbol table to jump to the API containing the test logic, different test logic is encapsulated in a so file, using tools to control the loading.
- the abnormal test logic is added through the mechanism of the so, the code is highly universal, avoids frequent updates and adjustments, and the communication data can be conveniently recorded while forwarding the communication data packet, which can directly satisfy the reliability. Application requirements for data recording and testing during testing.
- the predetermined link in the communication link is controlled by the control command to interact.
- the control command may be embodied by the control target test module continuously transmitting communication data to each downstream module or sending pressure to the upstream module through the pressure measurement tool, and modifying the network parameters and real-time monitoring of the key nodes through the injected network abnormality test logic.
- S512' recording an interaction data packet exchanged between predetermined links in the communication link and an abnormality test data packet passing through the network abnormality test logic.
- the recording process of the interactive data packet for the interaction between the predetermined links in the communication link is similar to the step S512, and details are not described herein again.
- the reliability test when the data is recorded, the abnormal test data packet passing through the network abnormal test logic needs to be recorded and saved separately for analyzing the reliability of the distributed system.
- these identifiers are counted when interacting between predetermined links in the communication link to analyze the frequency of access by each node of the system.
- the performance of the network card performance data of each server is recorded when the pressure is transmitted, and the performance data of the network card is analyzed to test whether the hotspot data is dispersed uniformly. Further, by recording the interaction data packet between the predetermined links in the communication link, it can be analyzed whether network packet loss, data disorder or data tampering occurs when the network is abnormal.
- the network abnormality test logic is injected into the communication link, and the predetermined link in the communication link is controlled by the control command to interact and record the corresponding data packet, so as to better perform reliability later. Testing improves the convenience of distributed system testing.
- Fig. 6 is a block diagram showing the principle of a test apparatus of a distributed system corresponding to the test method of the distributed system in the first embodiment.
- the test apparatus of the distributed system includes a distributed system test request acquisition module 10, a communication link data acquisition module 20, an idle time period acquisition module 30, and an adjustment test module 40.
- the implementation functions of the distributed system test request acquisition module 10, the communication link data acquisition module 20, the idle time period acquisition module 30, and the adjustment test module 40 correspond to the steps corresponding to the test method of the distributed system in Embodiment 1. In order to avoid redundancy, the present embodiment will not be described in detail.
- the distributed system test request obtaining module 10 is configured to obtain a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time.
- the communication link data acquiring module 20 is configured to acquire communication link data of the target test module, where the communication link data includes the number of target I/O ports.
- the idle time period obtaining module 30 is configured to acquire and display the number of idle I/O ports that are greater than or equal to the number of target I/O ports if the number of target I/O ports is greater than or equal to the number of idle I/O ports in the target test time. Free time period.
- the adjustment test module 40 is configured to obtain an adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
- the test device of the distributed system further includes a target test module 50.
- the target test module 50 is configured to take over the communication link of the target test module when the current system time reaches the target test time, if the number of target I/O ports is less than the number of idle I/O ports in the target test time, based on the target test.
- the type tests the target test module.
- the adjustment test module 40 includes a port listening unit 41 and a communication link establishing unit 42.
- the port monitoring unit 41 is configured to start port monitoring on the target test module.
- the communication link establishing unit 42 is configured to establish a communication link between the target test module and the upstream module and between the target test module and the downstream module based on the idle I/O port.
- the adjustment test module 40 further includes a communication data recording unit 51 and a test result acquisition unit 52.
- the communication data recording unit 51 is configured to record communication data of the target test module based on the target test type.
- the test result obtaining unit 52 is configured to test the target test module based on the communication data, and obtain the test result.
- the communication data recording unit 51 includes a test data transmitting subunit 511 and a performance test data recording subunit 512.
- the test data sending subunit 511 is configured to send the test data to the upstream module if the target test type is a performance test.
- the performance test data recording sub-unit 512 is configured to record upstream communication data sent by the upstream module to the target test module and downstream communication data returned by the downstream module to the target test module.
- the communication data recording unit 51 further includes an interactive data transmitting subunit 511' and a reliability test data recording subunit 512'.
- the interactive data transmitting subunit 511' is configured to inject network abnormality testing logic into the communication link if the target test type is a reliability test, and control the predetermined link in the communication link to perform interaction through the control command.
- the reliability test data recording sub-unit 512' is configured to record an interaction data packet exchanged between predetermined links in the communication link and an abnormality test data packet passing through the network abnormality test logic.
- the communication link of the target test module is taken over, and the specific implementation unit/subunit that is tested on the target test module based on the target test type is consistent with the adjustment test module 40, and details are not described herein again.
- the present embodiment provides one or more non-volatile readable storage media having computer readable instructions that are executed by one or more processors such that the one or more processors perform as implemented
- the test method of the distributed system in Example 1 is not repeated here to avoid repetition.
- the one or more processors implement the functions of the modules/units in the test device of the distributed system of Embodiment 2, to avoid repetition, here is not Let me repeat.
- non-volatile readable storage medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, only Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
- ROM Read-Only Memory
- RAM Random Access Memory
- FIG. 7 is a schematic diagram of a computer device according to an embodiment of the present application.
- computer device 60 of this embodiment includes a processor 61, a memory 62, and computer readable instructions 63 stored in memory 62 and executable on processor 61.
- the processor 61 executes the steps of the test method of the distributed system in the first embodiment, such as steps S10 to S40 shown in FIG. 1, when the computer readable instructions 63 are executed.
- the functions of the modules/units in the testing device of the distributed system in the second embodiment are implemented, for example, the distributed system test request obtaining module 10 and the communication link data shown in FIG.
- the functions of the acquisition module 20, the idle time period acquisition module 30, and the adjustment test module 40 are obtained.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Debugging And Monitoring (AREA)
Abstract
Description
本申请以2018年03月22日提交的申请号为201810239756.X,名称为“分布式系统的测试方法、装置、计算机设备及存储介质”的中国发明专利申请为基础,并要求其优先权。The present application is based on the Chinese Patent Application No. 201 810 239 756.X filed on Mar. 22, 2018, entitled "Testing Methods, Apparatus, Computer Equipment, and Storage Media for Distributed Systems," and claims priority.
本申请涉及系统测试领域,尤其涉及一种分布式系统的测试方法、装置、计算机设备及存储介质。The present application relates to the field of system testing, and in particular, to a method, device, computer device and storage medium for testing a distributed system.
分布式系统是一个将硬件和软件组件分布在网络计算机上,并通过消息传递进行通信和协调的系统。而在分布式系统搭建完成之后会涉及到对该系统的软件测试环节,然而当前主流的软件测试模型(例如V模型、W模型、H模型以及X模型等)主要是针对非分布式系统进行设计的,虽然在分布式系统的测试中具有一定的适用性,但随着分布式系统技术的发展及测试要求的提高,这些软件测试模型己经不能满足分布式系统测试的需求。同时,由于分布式系统具有组件网络化、部署成本高等特点,现有针对分布式系统的测试方法便捷性不高,测试效率也较低。A distributed system is a system that distributes hardware and software components on a network computer and communicates and coordinates through messaging. After the completion of the distributed system, the software testing of the system will be involved. However, the current mainstream software testing models (such as V model, W model, H model and X model) are mainly designed for non-distributed systems. Although it has certain applicability in the testing of distributed systems, with the development of distributed system technology and the improvement of testing requirements, these software testing models have not been able to meet the needs of distributed system testing. At the same time, because the distributed system has the characteristics of component networking and high deployment cost, the existing test methods for distributed systems are not convenient and the test efficiency is low.
发明内容Summary of the invention
本申请实施例提供一种分布式系统的测试方法、装置、计算机设备及存储介质,以解决现有的分布式系统的测试方法便捷性和效率不高的问题。The embodiments of the present application provide a testing method, a device, a computer device, and a storage medium of a distributed system, so as to solve the problem that the testing method of the existing distributed system is not convenient and efficient.
第一方面,本申请实施例提供一种分布式系统的测试方法,包括以下步骤:In a first aspect, an embodiment of the present application provides a testing method for a distributed system, including the following steps:
获取分布式系统测试请求,所述分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间;Obtaining a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time;
获取所述目标测试模块的通信链路数据,所述通信链路数据包括目标I/O口数量;Obtaining communication link data of the target test module, where the communication link data includes a number of target I/O ports;
若在所述目标测试时间内所述目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于所述目标I/O口数量的空闲时间段;If the number of the target I/O ports is greater than or equal to the number of idle I/O ports in the target test time, obtain and display the idle time that the number of idle I/O ports is greater than or equal to the number of the target I/O ports. segment;
获取调整测试时间,若当前系统时间达到调整测试时间,则接管所述目标测试模块的通信链路,基于所述目标测试类型对所述目标测试模块进行测试。Obtaining an adjustment test time, if the current system time reaches the adjustment test time, taking over the communication link of the target test module, and testing the target test module based on the target test type.
第二方面,本申请实施例提供一种分布式系统的测试装置,包括:In a second aspect, an embodiment of the present application provides a testing apparatus for a distributed system, including:
分布式系统测试请求获取模块,用于获取分布式系统测试请求,所述分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间;a distributed system test request obtaining module, configured to obtain a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time;
通信链路数据获取模块,用于获取所述目标测试模块的通信链路数据,所述通信链路数据包括目标I/O口数量;a communication link data acquiring module, configured to acquire communication link data of the target test module, where the communication link data includes a number of target I/O ports;
空闲时间段获取模块,用于若在所述目标测试时间内所述目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于所述目标I/O口数量的空闲时间段;An idle time period obtaining module, configured to acquire and display the number of idle I/O ports greater than or equal to the target if the number of target I/O ports is greater than or equal to the number of idle I/O ports during the target test time The idle time period of the number of I/O ports;
调整测试模块,用于获取调整测试时间,若当前系统时间达到调整测试时间,则接管所述目标测试模块的通信链路,基于所述目标测试类型对所述目标测试模块进行测试。The test module is configured to obtain an adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
第三方面,本申请实施例提供一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现如下步骤:In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, where the processor executes the computer The following steps are implemented when reading the instruction:
获取分布式系统测试请求,所述分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间;Obtaining a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time;
获取所述目标测试模块的通信链路数据,所述通信链路数据包括目标I/O口数量;Obtaining communication link data of the target test module, where the communication link data includes a number of target I/O ports;
若在所述目标测试时间内所述目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于所述目标I/O口数量的空闲时间段;If the number of the target I/O ports is greater than or equal to the number of idle I/O ports in the target test time, obtain and display the idle time that the number of idle I/O ports is greater than or equal to the number of the target I/O ports. segment;
获取调整测试时间,若当前系统时间达到调整测试时间,则接管所述目标测试模块的通信链路,基于所述目标测试类型对所述目标测试模块进行测试。Obtaining an adjustment test time, if the current system time reaches the adjustment test time, taking over the communication link of the target test module, and testing the target test module based on the target test type.
第四方面,本申请实施例提供一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:In a fourth aspect, the embodiment of the present application provides one or more non-volatile readable storage media storing computer readable instructions, when the computer readable instructions are executed by one or more processors, such that the one or Multiple processors perform the following steps:
获取分布式系统测试请求,所述分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间;Obtaining a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time;
获取所述目标测试模块的通信链路数据,所述通信链路数据包括目标I/O口数量;Obtaining communication link data of the target test module, where the communication link data includes a number of target I/O ports;
若在所述目标测试时间内所述目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于所述目标I/O口数量的空闲时间段;If the number of the target I/O ports is greater than or equal to the number of idle I/O ports in the target test time, obtain and display the idle time that the number of idle I/O ports is greater than or equal to the number of the target I/O ports. segment;
获取调整测试时间,若当前系统时间达到调整测试时间,则接管所述目标测试模块的通信链路,基于所述目标测试类型对所述目标测试模块进行测试。Obtaining an adjustment test time, if the current system time reaches the adjustment test time, taking over the communication link of the target test module, and testing the target test module based on the target test type.
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其他特征和优点将从说明书、附图以及权利要求变得明显。The details of one or more embodiments of the present invention are set forth in the accompanying drawings and the description of the claims.
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present application. Other drawings may also be obtained from those of ordinary skill in the art based on these drawings without the inventive labor.
图1是本申请实施例1中的分布式系统的测试方法的一流程图;1 is a flowchart of a testing method of a distributed system in Embodiment 1 of the present application;
图2是图1中步骤S40的一具体实施方式的一流程图;2 is a flow chart of a specific embodiment of step S40 in FIG. 1;
图3是图1中步骤S40的另一具体实施方式的一流程图;Figure 3 is a flow chart of another embodiment of step S40 of Figure 1;
图4是图3中步骤S51的一具体实施方式的一流程图;4 is a flow chart of a specific embodiment of step S51 in FIG. 3;
图5是图3中步骤S51的另一具体实施方式的一流程图;Figure 5 is a flow chart of another embodiment of step S51 of Figure 3;
图6是本申请实施例2中提供的分布式系统的测试装置的一示意图;6 is a schematic diagram of a testing apparatus of a distributed system provided in Embodiment 2 of the present application;
图7是本申请实施例4中提供的计算机设备的一示意图。FIG. 7 is a schematic diagram of a computer device provided in Embodiment 4 of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the drawings in the embodiments of the present application. It is obvious that the described embodiments are a part of the embodiments of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
实施例1Example 1
图1示出本实施例中分布式系统的测试方法的流程图。该分布式系统的测试方法应用在各种终端或者系统之中,以解决现有的分布式系统的测试方法便捷性和效率不高的问题。如图1所示,该分布式系统的测试方法包括如下步骤(示例性地,该实施例采用一测试系统来执行如下步骤):FIG. 1 is a flow chart showing a test method of a distributed system in the present embodiment. The test method of the distributed system is applied to various terminals or systems to solve the problem that the test method of the existing distributed system is convenient and inefficient. As shown in FIG. 1, the test method of the distributed system includes the following steps (exemplarily, the embodiment uses a test system to perform the following steps):
S10:获取分布式系统测试请求,分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间。S10: Acquire a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time.
其中,分布式系统测试请求是指对分布式系统进行测试的发起请求。分布式系统中包括多个模块,当需要对其中的某个模块进行测试时,可以触发一分布式系统测试请求。分 布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间。其中,目标测试模块用于指向或标识分布式系统中需要进行测试的模块。而目标测试类型是指针对分布式系统中需要进行测试的目标测试模块的具体测试类型,目标测试类型可以包括:性能测试、可靠性测试、压力测试或功能测试等。而目标测试时间是指预先设定的需要对分布式系统中的目标测试模块进行测试的时间。可选地,目标测试时间包括起始时间和结束时间,或者,目标测试时间包括起始时间和测试持续时间。Among them, the distributed system test request refers to the initiation request for testing the distributed system. A distributed system includes multiple modules that can trigger a distributed system test request when one of the modules needs to be tested. The distributed system test request includes the target test module, the target test type, and the target test time. The target test module is used to point to or identify the modules in the distributed system that need to be tested. The target test type refers to the specific test type of the target test module that needs to be tested in the distributed system. The target test type may include: performance test, reliability test, stress test or functional test. The target test time refers to a preset time required to test the target test module in the distributed system. Optionally, the target test time includes a start time and an end time, or the target test time includes a start time and a test duration.
S20:获取目标测试模块的通信链路数据,通信链路数据包括目标I/O口数量。S20: Acquire communication link data of the target test module, where the communication link data includes the number of target I/O ports.
其中,网络中两个节点之间的物理通道称为通信链路。通信链路数据是用于衡量目标测试模块和其他模块之间进行通信的数据。目标I/O口数量是指用于对该目标测试模块进行测试所需要的I/O口数量。具体地,可以根据目标测试模块的通信链路的数量来确定对应的目标I/O口数量。在一个具体实施方式中,目标I/O口数量可以等于目标测试模块的通信链路的数量。可选地,为了提高测试效率,目标I/O口数量也可以大于目标测试模块的通信链路的数量。The physical channel between two nodes in the network is called a communication link. Communication link data is used to measure data communicated between a target test module and other modules. The number of target I/O ports refers to the number of I/O ports required to test the target test module. Specifically, the number of corresponding target I/O ports can be determined according to the number of communication links of the target test module. In one embodiment, the number of target I/O ports can be equal to the number of communication links of the target test module. Optionally, in order to improve test efficiency, the number of target I/O ports may also be greater than the number of communication links of the target test module.
S30:若在目标测试时间内目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于目标I/O口数量的空闲时间段。S30: If the number of target I/O ports is greater than or equal to the number of idle I/O ports in the target test time, obtain and display an idle time period in which the number of idle I/O ports is greater than or equal to the number of target I/O ports.
根据目标测试时间和目标I/O数量来判断测试系统在目标测试时间内的空闲I/O口数量是否符合要求。若在目标测试时间内目标I/O口数量大于空闲I/O口数量,则说明在目标测试时间内,该测试系统没有足够的空闲I/O口来支持该分布式系统测试请求。此时,获取并显示测试系统中空闲I/O口数量大于或等于目标I/O口数量的空闲时间段,以根据该空闲时间段来调整对该分布式系统进行测试的时间。According to the target test time and the number of target I/Os, it is judged whether the number of idle I/O ports of the test system within the target test time meets the requirements. If the number of target I/O ports in the target test time is greater than the number of idle I/O ports, it indicates that the test system does not have enough free I/O ports to support the distributed system test request during the target test time. At this time, an idle time period in which the number of idle I/O ports in the test system is greater than or equal to the number of target I/O ports is obtained and displayed, so that the time for testing the distributed system is adjusted according to the idle time period.
优选地,可以通过建立I/O口空闲时间表来体现测试系统中在不同时间段内的空闲I/O口数量。具体地,该I/O口空闲时间表包括时间区间和对应的空闲I/O口数量。其中,时间区间可以根据空闲I/O口数量的不同来划分。例如,以24小时为例,假设测试系统中总I/O口数量为20。若在8:00-10:00之间,有一个测试请求占据了15个I/O口,而其他时间内该测试系统的空闲I/O口数量均为20。则该I/O口空闲时间表可以将时间区间划分为:[00:00,8:00]、[8:00,10:00]和[10:00,24:00],如此,对应的I/O口空闲时间表可以为:Preferably, the number of idle I/O ports in the test system in different time periods can be embodied by establishing an I/O port idle schedule. Specifically, the I/O port idle schedule includes a time interval and a corresponding number of idle I/O ports. The time interval can be divided according to the number of idle I/O ports. For example, taking 24 hours as an example, assume that the total number of I/O ports in the test system is 20. If there is a test request occupying 15 I/O ports between 8:00 and 10:00, the number of idle I/O ports of the test system is 20 at other times. Then the I/O port idle schedule can divide the time interval into: [00:00, 8:00], [8:00, 10:00], and [10:00, 24:00], thus, corresponding The I/O port idle schedule can be:
表一I/O口空闲时间表Table 1 I/O port idle timetable
通过表一所示的I/O口空闲时间表可以直观地了解在不同时间区间内对应的空闲I/O口数量。例如,若分布式系统测试请求中,目标测试模块的目标I/O口数量为10,而目标测试时间为9:00-11:00。此时,测试系统会获取并显示空闲I/O口数量大于或等于10个的空闲时间段,即[00:00,8:00]和[10:00,24:00]。The number of idle I/O ports in different time intervals can be visually understood through the I/O port idle schedule shown in Table 1. For example, if the distributed system test request, the target test module has a target I/O port number of 10 and the target test time is 9:00-11:00. At this point, the test system will get and display the idle time period of the number of idle I/O ports greater than or equal to 10, namely [00:00, 8:00] and [10:00, 24:00].
S40:获取调整测试时间,若当前系统时间达到调整测试时间,则接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试。S40: Obtain an adjustment test time. If the current system time reaches the adjustment test time, take over the communication link of the target test module, and test the target test module based on the target test type.
在显示了空闲I/O口数量大于或等于目标I/O口数量的空闲时间段之后,用户可以根据该空闲时间段来调整目标测试时间,在空闲I/O口数量大于或等于目标I/O口数量的空闲时间段之内选择一预定的时间区间作为调整测试时间,随即测试系统获取该调整测试时间。After the idle time period in which the number of idle I/O ports is greater than or equal to the number of target I/O ports is displayed, the user can adjust the target test time according to the idle time period, and the number of idle I/O ports is greater than or equal to the target I/. A predetermined time interval is selected within the idle time period of the number of O ports as the adjustment test time, and then the test system acquires the adjustment test time.
当前系统时间是指系统当前显示的时间,而当前系统时间达到调整测试时间具体可以是指当前系统时间达到调整测试时间的起始时间。若当前系统时间达到调整测试时间,则接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试。The current system time refers to the current time displayed by the system, and the current system time reaches the adjustment test time, which may specifically refer to the start time of the current system time to reach the adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
接管目标测试模块的通信链路是指接管目标测试模块和其他模块之间进行通信的各条通信链路。具体地,可以通过如下方式来实现通信链路的接管(以接管客户端与服务器端的通信链路为例):在客户端与服务器端之间插入一个模块。首先,该模块模拟服务器端启动相同的端口进行监听;然后,截获客户端发出的连接请求,并建立连接,这时该模块相对于客户端而言是服务器端,如此就可以获取客户端发送过来的数据包;同时,在模块上配置服务器端的地址,当接收了客户端发送过来的数据包时,向服务器端发送连接请求,并建立连接,此时该模块相对于服务器端而言就是客户端;最后,该模块把从客户端接收到的数据包转发到服务器端。在服务器端处理完请求后,通过前面建立的连接,将返回数据包发送给客户端。通过上述步骤就完成了一条通信链路的接管工作,同时也可以实现对链路中通信数据的控制。The communication link that takes over the target test module refers to the various communication links that take over communication between the target test module and other modules. Specifically, the takeover of the communication link can be implemented in the following manner (taking the communication link between the client and the server as an example): insert a module between the client and the server. First, the module simulates the server to start the same port for monitoring; then, intercepts the connection request from the client and establishes a connection. At this time, the module is the server side relative to the client, so that the client can be sent. At the same time, the server-side address is configured on the module. When receiving the data packet sent by the client, the connection request is sent to the server, and the connection is established. At this time, the module is the client with respect to the server. Finally, the module forwards the packets received from the client to the server. After the server has processed the request, the return packet is sent to the client through the previously established connection. Through the above steps, the takeover of a communication link is completed, and the control of the communication data in the link can also be realized.
在接管了目标测试模块的通信链路之后,就可以基于目标测试类型对目标测试模块进行测试。通过对目标测试模块的通信链路的接管,测试系统可以模拟该分布式系统环境,节省了测试过程中花费在环境准备上的时间,同时也节省了大量的机器资源。对目标测试模块进行测试的具体过程可以根据目标测试类型的不同而进行设定。After taking over the communication link of the target test module, the target test module can be tested based on the target test type. By taking over the communication link of the target test module, the test system can simulate the distributed system environment, saving time spent on environmental preparation during the test process, and also saving a lot of machine resources. The specific process of testing the target test module can be set according to the type of target test.
优选地,在获取调整测试时间之后,还包括:生成对应的调整测试任务。其中,调整测试任务是指目标测试时间经过调整的测试任务,一个分布式系统测试请求就对应一个测 试任务。调整测试任务包括调整测试时间和目标I/O口数量。在生成调整测试任务之后,根据调整测试任务更新I/O口空闲时间表。通过这个方式实时对I/O口空闲时间表进行更新,保证了I/O口空闲时间表的准确性。Preferably, after obtaining the adjustment test time, the method further includes: generating a corresponding adjustment test task. Among them, the adjustment test task refers to the test task whose target test time is adjusted, and a distributed system test request corresponds to a test task. Tuning test tasks includes adjusting test time and number of target I/O ports. After the adjustment test task is generated, the I/O port idle schedule is updated according to the adjustment test task. In this way, the I/O port idle schedule is updated in real time, ensuring the accuracy of the I/O port idle schedule.
本实施例提供的分布式系统的测试方法中,在获取分布式系统测试请求之后,通过目标测试模块的目标I/O口数量和目标测试时间来判断目标测试模块在目标测试时间内是否有足够多的空闲I/O口来进行相应的测试任务。在目标测试时间内不具备足够多的空闲I/O口来进行相应的测试任务时,通过显示对应的空闲时间段的方式来进行提醒,以便用户可以直观地选择合适的测试时间,从而顺利地进行分布式系统的测试,提高了测试的便捷性。通过接管目标测试模块的通信链路的方式,测试系统可以模拟分布式系统环境,节省了测试过程中花费在环境准备上的时间,同时也节省了大量的机器资源。再基于目标测试类型对目标测试模块进行测试,提高了分布式系统的测试效率。In the test method of the distributed system provided in this embodiment, after obtaining the distributed system test request, it is determined whether the target test module has sufficient time in the target test time by the target I/O port number of the target test module and the target test time. More idle I/O ports for the corresponding test tasks. When there is not enough free I/O ports in the target test time to perform the corresponding test tasks, the reminder is displayed by displaying the corresponding idle time period, so that the user can intuitively select the appropriate test time, thereby smoothly Testing of distributed systems improves the convenience of testing. By taking over the communication link of the target test module, the test system can simulate a distributed system environment, saving time spent on environmental preparation during the test process, and also saving a lot of machine resources. The target test module is tested based on the target test type, which improves the test efficiency of the distributed system.
在一个具体实施方式中,在获取目标测试模块的通信链路数据,通信链路数据包括目标I/O口数量的步骤之后,分布式系统的测试方法还包括:In a specific implementation, after the step of acquiring communication link data of the target test module and the communication link data includes the number of target I/O ports, the test method of the distributed system further includes:
若在目标测试时间内目标I/O口数量小于空闲I/O口数量,则在当前系统时间达到目标测试时间时,接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试。If the number of target I/O ports is less than the number of idle I/O ports during the target test time, when the current system time reaches the target test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type. .
若在目标测试时间内目标I/O口数量小于空闲I/O口数量,则说明在目标测试时间内测试系统是有足够的空闲I/O口来支持该分布式系统测试请求的,故可以在当前系统时间达到目标测试时间时对目标测试模块的通信链路进行接管,并基于目标测试类型对目标测试模块进行测试。对目标测试模块进行测试的具体过程可以根据目标测试类型的不同而进行设定。If the number of target I/O ports in the target test time is less than the number of idle I/O ports, it means that the test system has enough free I/O ports to support the distributed system test request during the target test time. The communication link of the target test module is taken over when the current system time reaches the target test time, and the target test module is tested based on the target test type. The specific process of testing the target test module can be set according to the type of target test.
优选地,若在目标测试时间内目标I/O口数量小于空闲I/O口数量,则生成目标测试任务。其中,目标测试任务是指基于分布式系统测试请求而生成的测试任务。目标测试任务包括目标测试时间和目标I/O口数量。并根据目标测试任务更新I/O口空闲时间表。通过这个方式实时对I/O口空闲时间表进行更新,保证了I/O口空闲时间表的准确性。Preferably, if the number of target I/O ports is less than the number of idle I/O ports during the target test time, a target test task is generated. The target test task refers to a test task generated based on a distributed system test request. The target test task includes the target test time and the number of target I/O ports. And update the I/O port idle schedule according to the target test task. In this way, the I/O port idle schedule is updated in real time, ensuring the accuracy of the I/O port idle schedule.
在这个实施方式中,在获取目标测试时间内目标I/O口数量不大于当前空闲I/O口数量的结果之后,根据对应的目标测试时间对分布式系统进行测试,并且对I/O口空闲时间表进行实时更新,保证了分布式系统测试的便捷性和准确性。In this implementation manner, after obtaining the result that the number of target I/O ports in the target test time is not greater than the current number of idle I/O ports, the distributed system is tested according to the corresponding target test time, and the I/O port is tested. The idle schedule is updated in real time to ensure the convenience and accuracy of distributed system testing.
在一个具体实施方式中,接管目标测试模块的通信链路,如图2所示,具体包括以下步骤:In a specific implementation manner, the communication link that takes over the target test module, as shown in FIG. 2, specifically includes the following steps:
S41:对目标测试模块启动端口监听。S41: Start port monitoring for the target test module.
端口监听是指对终端/模块所操作的一种信息记录。在分布式系统中,目标测试模块需要与对应的上游模块以及下游模块中的每一个模块建立通信连接。因此对于其中的每一个模块都需要启动相应的端口进行监听,并建立端口与目的模块之间的映射关系。其中,目的模块是指目标测试模块要建立通信连接的对应模块。上游模块和下游模块是以目标测试模块为基准,根据通信数据的流向来区分其关联模块的方式。处于目标测试模块通信数据流向的上游的模块为上游模块,处于目标测试模块通信数据流向的下游的模块为下游模块。步骤S41的具体过程如下:Port listening is a type of information record that is manipulated by a terminal/module. In a distributed system, the target test module needs to establish a communication connection with each of the corresponding upstream module and downstream module. Therefore, for each of these modules, it is necessary to start the corresponding port for monitoring and establish a mapping relationship between the port and the destination module. The destination module refers to a corresponding module of the target test module to establish a communication connection. The upstream module and the downstream module are based on the target test module, and the manner in which the associated modules are distinguished according to the flow direction of the communication data. The module upstream of the target test module communication data flow is an upstream module, and the module downstream of the target test module communication data flow is a downstream module. The specific process of step S41 is as follows:
(1)确定需要监听的端口数N。(1) Determine the number of ports N to be monitored.
通过目标测试模块的通信链路数据来确定需要监听的端口数N,可选地,需要监听的端口数N和目标I/O口数量相同。优选地,在确定需要监听的端口数N可以通过LISTEN_NUM来实现。例如,若需要监听的端口数为5,则配置信息可以为:#define LISTEN_NUM 5。The number of ports N to be monitored is determined by the communication link data of the target test module. Optionally, the number of ports to be monitored is the same as the number of target I/O ports. Preferably, the number N of ports determined to be listening can be implemented by LISTEN_NUM. For example, if the number of ports to be monitored is 5, the configuration information can be: #define LISTEN_NUM 5.
(2)建立端口与目的模块的ip和port的映射关系。(2) Establish a mapping relationship between the port and the destination module's ip and port.
通过建立端口与目的模块的ip和port的映射关系,来建立目标测试模块和上游模块或目标测试模块和下游模块之间的数据通信。其中,在建立端口与目的模块的ip和port的映射关系时,目的模块与对应的上游模块或下游模块的ip和port必须一致,否则,无法建立目标测试模块和上游模块或目标测试模块和下游模块之间的联系。具体地,为每个端口配置对应的目的模块的ip和port信息,而每个端口的目的模块的ip和port信息和该端口对应的上游模块或下游模块的ip和port信息是相同的。The data communication between the target test module and the upstream module or the target test module and the downstream module is established by establishing a mapping relationship between the port and the ip and port of the destination module. The ip and port of the destination module and the corresponding upstream module or downstream module must be the same when the mapping between the ip and the port of the destination module is established. Otherwise, the target test module and the upstream module or the target test module and downstream cannot be established. The link between modules. Specifically, the ip and port information of the corresponding destination module is configured for each port, and the ip and port information of the destination module of each port is the same as the ip and port information of the upstream module or the downstream module corresponding to the port.
(3)启动端口监听,等待上游模块的连接服务。(3) Start port monitoring and wait for the connection service of the upstream module.
在端口与目的模块的ip和port的映射关系建立完毕之后,就启动端口监听,进行实时地端口监听任务,等待上游模块的连接服务进而触发对应的进程。After the mapping between the port and the destination module's ip and port is established, the port monitoring is started, and the real-time port monitoring task is performed, waiting for the connection service of the upstream module to trigger the corresponding process.
S42:基于空闲I/O口建立目标测试模块和上游模块之间以及目标测试模块和下游模块之间的通信链路。S42: Establish a communication link between the target test module and the upstream module and between the target test module and the downstream module based on the idle I/O port.
其中,通信链路连接的建立,包括两方面的连接:(1)接受上游模块的连接请求,并与上游模块建立连接;(2)向对应的下游模块发出连接请求,并与对应的下游模块建立连接。The establishment of the communication link connection includes two aspects of connection: (1) accepting the connection request of the upstream module and establishing a connection with the upstream module; (2) issuing a connection request to the corresponding downstream module, and corresponding to the downstream module establish connection.
在与上游模块建立连接时,目标测试模块相当于服务器端,上游模块相当于客户端。目标测试模块与上游模块建立连接后,会产生一个句柄fd1。在与下游模块建立连接时, 目标测试模块模块相当于是客户端,通过在线进行系统监听过程中建立的映射关系,根据端口查找到目的模块的ip和port,向对应的下游模块发起连接,在建立连接后产生句柄fd2。通过建立这两方面的连接,就能在上游模块和下游模块之间建立联系,进而实现了模拟上下游通信链路的效果。When establishing a connection with an upstream module, the target test module is equivalent to the server side, and the upstream module is equivalent to the client. After the target test module establishes a connection with the upstream module, a handle fd1 is generated. When establishing a connection with the downstream module, the target test module module is equivalent to being a client. By performing a mapping relationship established during the system monitoring process, the port finds the ip and port of the destination module according to the port, and initiates a connection to the corresponding downstream module. The handle fd2 is generated after the connection. By establishing these two connections, it is possible to establish a connection between the upstream module and the downstream module, thereby realizing the effect of simulating the upstream and downstream communication links.
具体地,通过空闲I/O口来建立目标测试模块和上游模块之间以及目标测试模块和下游模块之间的通信链路。可选地,采用一个空闲I/O口建立一条对应的通信链路。例如,若目标测试模块和1个上游模块以及目标测试模块和5个下游模块之间进行通信,则可以采用6个空闲I/O口分别建立目标测试模块和1个上游模块以及目标测试模块和5个下游模块之间的通信链路。Specifically, a communication link between the target test module and the upstream module and between the target test module and the downstream module is established through the idle I/O port. Optionally, an idle I/O port is used to establish a corresponding communication link. For example, if the target test module communicates with an upstream module and a target test module and five downstream modules, the six idle I/O ports can be used to establish a target test module, an upstream module, and a target test module, respectively. Communication link between 5 downstream modules.
在这个实施方式中,通过启动端口监听,确定需要接管的目的模块的数量以及对应的每一目的模块的ip和port之后,基于空闲I/O口建立目标测试模块和上游模块之间以及目标测试模块和下游模块之间的通信链路,方便后续的通信数据的转发和录制,保证了通信链路接管的准确性和效率。In this embodiment, after the port monitoring is started, the number of destination modules that need to be taken over and the corresponding ip and port of each destination module are determined, and the target test module and the upstream module are established based on the idle I/O port and the target test is performed. The communication link between the module and the downstream module facilitates the forwarding and recording of subsequent communication data, ensuring the accuracy and efficiency of the communication link takeover.
在一个具体实施方式中,基于目标测试类型对目标测试模块进行测试,如图3所示,具体包括以下步骤:In a specific implementation, the target test module is tested based on the target test type, as shown in FIG. 3, and specifically includes the following steps:
S51:基于目标测试类型,录制目标测试模块的通信数据。S51: Record communication data of the target test module based on the target test type.
对于不同的目标测试类型,所需要录制的通信数据是不同的。在已经对目标测试模块的通信链路进行接管的前提下,基于目标测试类型,选择对应的通信数据进行录制。具体地,根据不同的目标测试类型,选择不同的测试数据进行输入,以触发不同的模块之间的数据交互,并利用接管了对应通信链路的I/O口录制对应的通信数据。The communication data that needs to be recorded is different for different target test types. On the premise that the communication link of the target test module has been taken over, the corresponding communication data is selected for recording based on the target test type. Specifically, according to different target test types, different test data are selected for input to trigger data interaction between different modules, and the corresponding communication data is recorded by the I/O port that takes over the corresponding communication link.
在需要录制的通信数据中,包含两个方向的数据,即从上游模块发送给测试系统的请求数据和从下游模块返回给测试系统的响应数据,所以在数据录制时可以对不同方向的数据进行标识,并分别进行录制。In the communication data that needs to be recorded, the data in two directions, that is, the request data sent from the upstream module to the test system and the response data returned from the downstream module to the test system, can be performed on data in different directions during data recording. Mark and record separately.
具体地,录制目标测试模块的通信数据的过程可以为:测试系统在获取到上游模块发送的请求数据之后,标识并保存该请求数据,并将该请求数据转发到对应的下游模块中。下游模块在接收到对应的请求数据之后,会响应该请求数据,并进行相关的处理,在处理完成之后,下游模块会返回相对应的响应数据。测试系统标识并保存该响应数据,并将该响应数据转发到对应的上游模块中。通过上述步骤,即实现对上游模块发送给下游模块的请求数据以及下游模块返回到上游模块的响应数据的分别录制。Specifically, the process of recording the communication data of the target test module may be: after the test system obtains the request data sent by the upstream module, the test system identifies and saves the request data, and forwards the request data to the corresponding downstream module. After receiving the corresponding request data, the downstream module responds to the request data and performs related processing. After the processing is completed, the downstream module returns corresponding response data. The test system identifies and saves the response data and forwards the response data to the corresponding upstream module. Through the above steps, the request data sent to the downstream module by the upstream module and the response data of the response data returned by the downstream module to the upstream module are realized.
在一个具体实施方式中,录制目标测试模块的通信数据还包括对通信数据的转发。在 相应的通信链路建立连接时,会产生两个句柄fd1和fd2。例如:通过空闲I/O口A和上游模块连接,产生句柄fd1。通过空闲I/O口B和上游模块连接,产生句柄fd2。这两个句柄都存在对应的读/写事件,所以可以使用这两个句柄来实现通信数据的转发。具体的通信数据的转发步骤如下:In a specific embodiment, the communication data of the recording target test module further includes forwarding of the communication data. When the connection is established on the corresponding communication link, two handles fd1 and fd2 are generated. For example, the idle I/O port A is connected to the upstream module to generate the handle fd1. The handle fd2 is generated by the idle I/O port B being connected to the upstream module. Both handles have corresponding read/write events, so these two handles can be used to forward the communication data. The specific communication data forwarding steps are as follows:
(1)对句柄fd1进行读取:空闲I/O口A与上游模块建立连接后,对句柄fd1进行读取操作,以从上游模块读取请求数据。(1) Reading the handle fd1: After the idle I/O port A establishes a connection with the upstream module, a read operation is performed on the handle fd1 to read the request data from the upstream module.
(2)对句柄fd2进行写入:对于从上游模块读取到的请求数据,通过空闲I/O口B的句柄fd2写到下游模块中。(2) Writing to the handle fd2: The request data read from the upstream module is written to the downstream module through the handle fd2 of the idle I/O port B.
(3)对句柄fd2进行读取:下游模块在接收到对应的请求数据并处理完请求后,返回相应的响应数据到句柄fd2上,此时对句柄fd2进行读取操作,已从下游模块读取响应数据。(3) Reading the handle fd2: after receiving the corresponding request data and processing the request, the downstream module returns the corresponding response data to the handle fd2, and at this time, the read operation of the handle fd2 is read from the downstream module. Take response data.
(4)对句柄fd1进行写入:通过对句柄fd1进行写入操作以将下游模块返回的响应数据转发到上游模块。(4) Writing to the handle fd1: The response data returned by the downstream module is forwarded to the upstream module by writing to the handle fd1.
S52:基于通信数据对目标测试模块进行测试,获取测试结果。S52: Test the target test module based on the communication data, and obtain the test result.
根据目标测试类型并选择对应的通信数据对目标测试模块进行测试,获取测试结果。例如,若测试类型为性能测试,则可以使用压测工具和录制下来的上游模块发给目标测试模块的通信数据,向被测模块施加压力,并监控目标测试模块的运行状态和各项性能指标,并进行分析,最后得到测试结果。其中,压测工具是指用于进行压力测试的工具。Test the target test module according to the target test type and select the corresponding communication data to obtain the test result. For example, if the test type is performance test, the communication data sent to the target test module by the pressure test tool and the recorded upstream module can be used to apply pressure to the tested module, and monitor the running state of the target test module and various performance indicators. And analyze it and finally get the test results. Among them, the pressure measuring tool refers to a tool for performing a pressure test.
在这个实施方式中,根据目标测试类型来录制目标测试模块对应的通信数据,并根据录制的通信数据来对目标测试模块进行测试,获取测试结果。在保证分布式系统测试的便捷性的同时,不需要模拟分布式系统环境,节省了测试过程中花费在环境准备上的时间,同时也节省了大量的机器资源,提高了分布式系统的测试效率。In this embodiment, the communication data corresponding to the target test module is recorded according to the target test type, and the target test module is tested according to the recorded communication data to obtain the test result. While ensuring the convenience of distributed system testing, there is no need to simulate a distributed system environment, which saves time spent on environmental preparation during the test process, and also saves a lot of machine resources and improves the test efficiency of the distributed system. .
在一个具体实施方式中,基于目标测试类型,录制目标测试模块的通信数据,如图4所示,具体包括以下步骤:In a specific implementation manner, based on the target test type, the communication data of the target test module is recorded, as shown in FIG. 4, specifically including the following steps:
S511:若目标测试类型为性能测试,则发送测试数据到上游模块中。S511: If the target test type is a performance test, send the test data to the upstream module.
其中,性能测试是通过自动化的测试工具模拟多种正常、峰值以及异常负载条件来对系统的各项性能指标进行测试。负载测试和压力测试都属于性能测试,两者可以结合进行。通过负载测试,确定在各种工作负载下系统的性能,即测试当负载逐渐增加时,系统各项性能指标的变化情况。压力测试是通过确定一个系统的瓶颈或者不能接受的性能点,来获得系统能提供的最大服务级别的测试。Among them, performance testing is to test various performance indicators of the system through automated test tools to simulate a variety of normal, peak and abnormal load conditions. Both load testing and stress testing are performance tests, and the two can be combined. Through the load test, the performance of the system under various workloads is determined, that is, the changes of various performance indicators of the system when the load is gradually increased. Stress testing is done by determining a system bottleneck or an unacceptable performance point to get the maximum service level test that the system can provide.
发送测试数据到上游模块中可以采用压测工具向上游模块施加压力。其中,压测工具是指用于进行压力测试的工具。而压力测试是模拟实际应用的软硬件环境及用户使用过程的系统负荷,长时间或超大负荷地运行测试软件,来测试被测系统的性能、可靠性和稳定性等。具体地,可以采用Webbench、Siege或Http_load等压测工具向上游模块施加压力。Sending test data to the upstream module can use a pressure test tool to apply pressure to the upstream module. Among them, the pressure measuring tool refers to a tool for performing a pressure test. The stress test simulates the software and hardware environment of the actual application and the system load of the user's use process, and runs the test software for a long time or a large load to test the performance, reliability and stability of the system under test. Specifically, a pressure tool such as Webbench, Siege, or Http_load can be used to apply pressure to the upstream module.
S512:录制上游模块发送给目标测试模块的上游通信数据和下游模块返回到目标测试模块的下游通信数据。S512: Record the upstream communication data sent by the upstream module to the target test module and the downstream communication data returned by the downstream module to the target test module.
在发送测试数据到上游模块之后,上游模块基于测试数据发送对应的上游通信数据到目标测试模块中,对该上游通信数据进行录制。具体地,可以将该上游通信数据保存到对应的上游通信数据文件中。目标测试模块在接收到上游通信数据之后,会对该上游通信数据进行响应,并进行相关的处理,处理完成之后,会发送数据到对应的下游模块中,下游模块相应地会返回下游通信数据到目标测试模块中,对该下游通信数据进行录制。具体地,可以将该下游通信数据保存到对应的下游通信数据文件中。After transmitting the test data to the upstream module, the upstream module sends the corresponding upstream communication data to the target test module based on the test data, and records the upstream communication data. Specifically, the upstream communication data can be saved to a corresponding upstream communication data file. After receiving the upstream communication data, the target test module will respond to the upstream communication data and perform related processing. After the processing is completed, the data will be sent to the corresponding downstream module, and the downstream module will return the downstream communication data accordingly. In the target test module, the downstream communication data is recorded. Specifically, the downstream communication data can be saved to a corresponding downstream communication data file.
在一个具体实施方式中,录制目标测试模块的通信数据还包括对通信数据的转发。具体的转发步骤和步骤S51中的通信数据的转发相似,在此不再赘述。In a specific embodiment, the communication data of the recording target test module further includes forwarding of the communication data. The specific forwarding step is similar to the forwarding of the communication data in step S51, and details are not described herein again.
在这个实施方式中,通过发送测试数据到上游模块,从而触发不同模块之间的进行数据地通信,在实现数据转发的同时完成了数据的录制,方便后续测试过程中的数据获取,节省了大量的机器资源,提高了分布式系统测试的便捷性和效率。In this embodiment, the test data is sent to the upstream module, thereby triggering data communication between different modules, and data recording is completed at the same time as data forwarding, which facilitates data acquisition in subsequent testing, and saves a large amount. Machine resources improve the convenience and efficiency of distributed system testing.
在一个具体实施方式中,基于目标测试类型,录制目标测试模块的通信数据,如图5所示,具体包括以下步骤:In a specific implementation manner, based on the target test type, the communication data of the target test module is recorded, as shown in FIG. 5, specifically including the following steps:
S511’:若目标测试类型为可靠性测试,则向通信链路中注入网络异常测试逻辑,并通过控制命令控制通信链路中预定的链路进行交互。S511': If the target test type is a reliability test, the network abnormality test logic is injected into the communication link, and the predetermined link in the communication link is controlled by the control command to perform interaction.
其中,可靠性测试是软件系统在规定的时间内以及规定的环境条件下,完成规定功能的能力。一般情况下,通过对软件系统进行测试来度量其可靠性。一般地,通过以下两种方式来度量其可靠性:(1)在规定条件下,规定时间内,软件不引起系统失效的概率;(2)在规定时间周期内,在预定条件下执行所要求的功能的能力。Among them, the reliability test is the ability of the software system to complete the specified functions within the specified time and under the specified environmental conditions. In general, the reliability of a software system is measured by testing it. Generally, the reliability is measured in two ways: (1) under the specified conditions, the probability that the software does not cause the system to fail within the specified time; (2) the required execution under the predetermined conditions within the specified time period The ability to function.
在可靠性测试中,将网络异常测试逻辑注入到测试系统接管的通信链路中,并通过控制命令控制通信链路中预定的链路进行交互的方式去测试在网络异常情况下各通信链路的交互数据,从而达到实现可靠性测试的目的。其中,网络异常测试逻辑是指对特定的网络参数进行修改并对关键节点进行监控的测试逻辑。例如,分布式系统负载均衡的能力很大程度上决定了系统的可靠性,针对系统负载均衡的测试,包含节点访问频次的均衡和节 点通信数据量的均衡两个维度的测试。在访问频次均衡的测试中,可以在源代码中插桩植入一些标识信息,通过发送压力并统计这些标识来分析系统各个节点访问的频次。在节点通信数据量均衡的测试中,通过在发送压力时记录各服务器网卡性能数据,分析网卡性能数据来测试热点数据分散是否均匀。In the reliability test, the network abnormality test logic is injected into the communication link taken over by the test system, and each communication link in the abnormal network condition is tested by controlling the command to control the predetermined link in the communication link to interact. The interaction data, so as to achieve the purpose of reliability testing. The network abnormality test logic refers to test logic that modifies specific network parameters and monitors key nodes. For example, the ability of distributed system load balancing largely determines the reliability of the system. For the system load balancing test, it includes two dimensions of the equalization of node access frequency and the balance of node communication data volume. In the test of access frequency equalization, some identification information can be inserted into the source code, and the frequency of accessing each node of the system can be analyzed by sending pressure and counting these identifiers. In the test of node communication data balance, the performance data of each server is recorded when the pressure is sent, and the performance data of the network card is analyzed to test whether the hot data is dispersed evenly.
具体地,可以通过使用hook技术来实现网络异常测试逻辑的注入。即替换被测程序中调用的函数,植入包含测试逻辑的函数。其中被替换的函数主要有两种类型:Specifically, the injection of network abnormality test logic can be implemented by using a hook technique. That is, replace the function called in the program under test, and populate the function containing the test logic. There are two main types of functions that are replaced:
(1)针对GNU C标准库中的strcmp、fopen等函数,编写相应的API,并编译成一个so动态库,通过设置LD_PRELOAD环境变量指定该so动态库的载入优先级,以达到覆盖原来标准库API的目的。(1) For the functions such as strcmp and fopen in the GNU C standard library, write the corresponding API and compile it into a so dynamic library. Specify the loading priority of the so dynamic library by setting the LD_PRELOAD environment variable to reach the original standard. The purpose of the library API.
(2)针对用户自定义的函数,通过修改符号表跳转到包含测试逻辑的API处运行,不同的测试逻辑被封装在一个so文件里,使用工具来控制载入。(2) For the user-defined function, by modifying the symbol table to jump to the API containing the test logic, different test logic is encapsulated in a so file, using tools to control the loading.
在这个实施方式中,通过so的机制新增异常测试逻辑,代码通用度高,避免频繁的更新和调整,而且在转发通信数据包的同时,可以很方便地录制通信数据,能直接满足可靠性测试过程中数据录制和测试的应用需求。In this embodiment, the abnormal test logic is added through the mechanism of the so, the code is highly universal, avoids frequent updates and adjustments, and the communication data can be conveniently recorded while forwarding the communication data packet, which can directly satisfy the reliability. Application requirements for data recording and testing during testing.
在接管的通信链路中注入网络异常测试逻辑之后,通过控制命令控制通信链路中预定的链路进行交互。例如,控制命令可以体现为控制目标测试模块持续向各个下游模块发送通信数据或者通过压测工具向上游模块发送压力,并通过注入的网络异常测试逻辑来修改网络参数并对关键节点进行实时监控。After injecting the network anomaly test logic in the takeover communication link, the predetermined link in the communication link is controlled by the control command to interact. For example, the control command may be embodied by the control target test module continuously transmitting communication data to each downstream module or sending pressure to the upstream module through the pressure measurement tool, and modifying the network parameters and real-time monitoring of the key nodes through the injected network abnormality test logic.
S512’:录制通信链路中预定的链路之间交互的交互数据包和经过网络异常测试逻辑的异常测试数据包。S512': recording an interaction data packet exchanged between predetermined links in the communication link and an abnormality test data packet passing through the network abnormality test logic.
在这个步骤中,对通信链路中预定的链路之间交互的交互数据包的录制过程和步骤S512相似,在此不再赘述。而可靠性测试中在进行数据录制的时候,还需要对经过网络异常测试逻辑的异常测试数据包进行录制并单独保存,用于对分布式系统的可靠性进行分析。In this step, the recording process of the interactive data packet for the interaction between the predetermined links in the communication link is similar to the step S512, and details are not described herein again. In the reliability test, when the data is recorded, the abnormal test data packet passing through the network abnormal test logic needs to be recorded and saved separately for analyzing the reliability of the distributed system.
例如,若在源代码中插桩植入一些标识信息,会在通信链路中预定的链路之间交互时统计这些标识进而来分析系统各个节点访问的频次。在数据量均衡的测试中,通过在发送压力时记录各服务器网卡性能数据传输情况,分析网卡性能数据来测试热点数据分散是否均匀。进一步地,通过录制通信链路中预定的链路之间交互的交互数据包可以分析在网络异常时是否会出现网络掉包、数据乱序或数据篡改等情况。For example, if some identification information is implanted in the source code, these identifiers are counted when interacting between predetermined links in the communication link to analyze the frequency of access by each node of the system. In the data volume balancing test, the performance of the network card performance data of each server is recorded when the pressure is transmitted, and the performance data of the network card is analyzed to test whether the hotspot data is dispersed uniformly. Further, by recording the interaction data packet between the predetermined links in the communication link, it can be analyzed whether network packet loss, data disorder or data tampering occurs when the network is abnormal.
在这个实施方式中,通过向通信链路中注入网络异常测试逻辑,并通过控制命令控制 通信链路中预定的链路进行交互,并录制对应的数据包,以便于后续更好地进行可靠性测试,提高了分布式系统测试的便捷性。In this embodiment, the network abnormality test logic is injected into the communication link, and the predetermined link in the communication link is controlled by the control command to interact and record the corresponding data packet, so as to better perform reliability later. Testing improves the convenience of distributed system testing.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence of the steps in the above embodiments does not mean that the order of execution is performed. The order of execution of each process should be determined by its function and internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
实施例2Example 2
图6示出与实施例1中分布式系统的测试方法一一对应的分布式系统的测试装置的原理框图。如图6所示,该分布式系统的测试装置包括分布式系统测试请求获取模块10、通信链路数据获取模块20、空闲时间段获取模块30和调整测试模块40。其中,分布式系统测试请求获取模块10、通信链路数据获取模块20、空闲时间段获取模块30和调整测试模块40的实现功能与实施例1中分布式系统的测试方法对应的步骤一一对应,为避免赘述,本实施例不一一详述。Fig. 6 is a block diagram showing the principle of a test apparatus of a distributed system corresponding to the test method of the distributed system in the first embodiment. As shown in FIG. 6, the test apparatus of the distributed system includes a distributed system test request acquisition module 10, a communication link data acquisition module 20, an idle time period acquisition module 30, and an adjustment test module 40. The implementation functions of the distributed system test request acquisition module 10, the communication link data acquisition module 20, the idle time period acquisition module 30, and the adjustment test module 40 correspond to the steps corresponding to the test method of the distributed system in Embodiment 1. In order to avoid redundancy, the present embodiment will not be described in detail.
分布式系统测试请求获取模块10,用于获取分布式系统测试请求,分布式系统测试请求包括目标测试模块、目标测试类型和目标测试时间。The distributed system test request obtaining module 10 is configured to obtain a distributed system test request, where the distributed system test request includes a target test module, a target test type, and a target test time.
通信链路数据获取模块20,用于获取目标测试模块的通信链路数据,通信链路数据包括目标I/O口数量。The communication link data acquiring module 20 is configured to acquire communication link data of the target test module, where the communication link data includes the number of target I/O ports.
空闲时间段获取模块30,用于若在目标测试时间内目标I/O口数量大于或等于空闲I/O口数量,则获取并显示空闲I/O口数量大于或等于目标I/O口数量的空闲时间段。The idle time period obtaining module 30 is configured to acquire and display the number of idle I/O ports that are greater than or equal to the number of target I/O ports if the number of target I/O ports is greater than or equal to the number of idle I/O ports in the target test time. Free time period.
调整测试模块40,用于获取调整测试时间,若当前系统时间达到调整测试时间,则接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试。The adjustment test module 40 is configured to obtain an adjustment test time. If the current system time reaches the adjustment test time, the communication link of the target test module is taken over, and the target test module is tested based on the target test type.
优选地,该分布式系统的测试装置还包括目标测试模块50。Preferably, the test device of the distributed system further includes a target test module 50.
目标测试模块50,用于若在目标测试时间内目标I/O口数量小于空闲I/O口数量,则在当前系统时间达到目标测试时间时,接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试。The target test module 50 is configured to take over the communication link of the target test module when the current system time reaches the target test time, if the number of target I/O ports is less than the number of idle I/O ports in the target test time, based on the target test. The type tests the target test module.
优选地,调整测试模块40包括端口监听单元41和通信链路建立单元42。Preferably, the adjustment test module 40 includes a port listening unit 41 and a communication link establishing unit 42.
端口监听单元41,用于对目标测试模块启动端口监听。The port monitoring unit 41 is configured to start port monitoring on the target test module.
通信链路建立单元42,用于基于空闲I/O口建立目标测试模块和上游模块之间以及目标测试模块和下游模块之间的通信链路。The communication link establishing unit 42 is configured to establish a communication link between the target test module and the upstream module and between the target test module and the downstream module based on the idle I/O port.
优选地,调整测试模块40还包括通信数据录制单元51和测试结果获取单元52。Preferably, the adjustment test module 40 further includes a communication data recording unit 51 and a test result acquisition unit 52.
通信数据录制单元51,用于基于目标测试类型,录制目标测试模块的通信数据。The communication data recording unit 51 is configured to record communication data of the target test module based on the target test type.
测试结果获取单元52,用于基于通信数据对目标测试模块进行测试,获取测试结果。The test result obtaining unit 52 is configured to test the target test module based on the communication data, and obtain the test result.
优选地,通信数据录制单元51包括:测试数据发送子单元511和性能测试数据录制子单元512。Preferably, the communication data recording unit 51 includes a test data transmitting subunit 511 and a performance test data recording subunit 512.
测试数据发送子单元511,用于若目标测试类型为性能测试,则发送测试数据到上游模块中。The test data sending subunit 511 is configured to send the test data to the upstream module if the target test type is a performance test.
性能测试数据录制子单元512,用于录制上游模块发送给目标测试模块的上游通信数据和下游模块返回到目标测试模块的下游通信数据。The performance test data recording sub-unit 512 is configured to record upstream communication data sent by the upstream module to the target test module and downstream communication data returned by the downstream module to the target test module.
优选地,通信数据录制单元51还包括:交互数据发送子单元511’和可靠性测试数据录制子单元512’。Preferably, the communication data recording unit 51 further includes an interactive data transmitting subunit 511' and a reliability test data recording subunit 512'.
交互数据发送子单元511’,用于若目标测试类型为可靠性测试,则向通信链路中注入网络异常测试逻辑,并通过控制命令控制通信链路中预定的链路进行交互。The interactive data transmitting subunit 511' is configured to inject network abnormality testing logic into the communication link if the target test type is a reliability test, and control the predetermined link in the communication link to perform interaction through the control command.
可靠性测试数据录制子单元512’,用于录制通信链路中预定的链路之间交互的交互数据包和经过网络异常测试逻辑的异常测试数据包。The reliability test data recording sub-unit 512' is configured to record an interaction data packet exchanged between predetermined links in the communication link and an abnormality test data packet passing through the network abnormality test logic.
优选地,目标测试模块50中,接管目标测试模块的通信链路,基于目标测试类型对目标测试模块进行测试的具体实现单元/子单元和调整测试模块40一致,在此不再赘述。Preferably, in the target test module 50, the communication link of the target test module is taken over, and the specific implementation unit/subunit that is tested on the target test module based on the target test type is consistent with the adjustment test module 40, and details are not described herein again.
实施例3Example 3
本实施例提供一个或多个存储有计算机可读指令的非易失性可读存储介质,该计算机可读指令被一个或多个处理器执行时,使得该一个或多个处理器执行如实施例1中分布式系统的测试方法,为避免重复,这里不再赘述。或者,该计算机可读指令被一个或多个处理器执行时,使得该一个或多个处理器实现实施例2中分布式系统的测试装置中各模块/单元的功能,为避免重复,这里不再赘述。The present embodiment provides one or more non-volatile readable storage media having computer readable instructions that are executed by one or more processors such that the one or more processors perform as implemented The test method of the distributed system in Example 1 is not repeated here to avoid repetition. Alternatively, when the computer readable instructions are executed by one or more processors, the one or more processors implement the functions of the modules/units in the test device of the distributed system of Embodiment 2, to avoid repetition, here is not Let me repeat.
可以理解地,所述非易失性可读存储介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号和电信信号等。It is to be understood that the non-volatile readable storage medium may include any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, only Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier signals, and telecommunications signals.
实施例4Example 4
图7是本申请一实施例提供的计算机设备的示意图。如图7所示,该实施例的计算机设备60包括:处理器61、存储器62以及存储在存储器62中并可在处理器61上运行的计算机可读指令63。处理器61执行计算机可读指令63时实现上述实施例1中分布式系统的测试方法的步骤,例如图1所示的步骤S10至S40。或者,处理器61执行计算机可读指令63时实现上述实施例2中分布式系统的测试装置中各模块/单元的功能,例如图6所示分 布式系统测试请求获取模块10、通信链路数据获取模块20、空闲时间段获取模块30和调整测试模块40的功能。FIG. 7 is a schematic diagram of a computer device according to an embodiment of the present application. As shown in FIG. 7,
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。It will be apparent to those skilled in the art that, for convenience and brevity of description, only the division of each functional unit and module described above is exemplified. In practical applications, the above functions may be assigned to different functional units as needed. The module is completed by dividing the internal structure of the device into different functional units or modules to perform all or part of the functions described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still implement the foregoing embodiments. The technical solutions described in the examples are modified or equivalently replaced with some of the technical features; and the modifications or substitutions do not deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in Within the scope of protection of this application.
Claims (20)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810239756.XA CN108563562A (en) | 2018-03-22 | 2018-03-22 | Test method, device, computer equipment and the storage medium of distributed system |
| CN201810239756.X | 2018-03-22 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019178957A1 true WO2019178957A1 (en) | 2019-09-26 |
Family
ID=63532062
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/091911 Ceased WO2019178957A1 (en) | 2018-03-22 | 2018-06-20 | Distributed system test method and device, computer device and storage medium |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN108563562A (en) |
| WO (1) | WO2019178957A1 (en) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111382056B (en) * | 2018-12-29 | 2024-02-02 | 北京字节跳动网络技术有限公司 | Service testing method and device, server and storage medium |
| CN109829014B (en) * | 2019-01-03 | 2024-01-23 | 平安科技(深圳)有限公司 | Method and device for acquiring test data |
| CN111694724B (en) * | 2019-03-15 | 2023-05-05 | 百度在线网络技术(北京)有限公司 | Test method and device of distributed form system, electronic equipment and storage medium |
| CN111159030B (en) * | 2019-12-24 | 2022-02-18 | 联想(北京)有限公司 | Program testing method, device, equipment and storage medium |
| CN113254328B (en) * | 2021-04-29 | 2022-08-09 | 厦门国际银行股份有限公司 | White box testing method, system, mobile terminal and storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP2348418A1 (en) * | 2009-12-18 | 2011-07-27 | Siemens Aktiengesellschaft | Multi trace parser |
| CN104781682A (en) * | 2012-10-20 | 2015-07-15 | 爱德万测试公司 | Pseudo tester-per-site functionality on natively tester-per-pin automatic test equipment for semiconductor test |
| CN105511936A (en) * | 2014-09-22 | 2016-04-20 | 北京奇虎科技有限公司 | Test system, method and device |
| CN107577602A (en) * | 2017-08-25 | 2018-01-12 | 上海斐讯数据通信技术有限公司 | A kind of method of testing of APP interfaces, apparatus and system |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20090199047A1 (en) * | 2008-01-31 | 2009-08-06 | Yahoo! Inc. | Executing software performance test jobs in a clustered system |
| CN102214139B (en) * | 2011-06-01 | 2013-11-27 | 北京航空航天大学 | An Execution Control and Scheduling Method for Distributed System-Oriented Automated Testing |
-
2018
- 2018-03-22 CN CN201810239756.XA patent/CN108563562A/en active Pending
- 2018-06-20 WO PCT/CN2018/091911 patent/WO2019178957A1/en not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| EP2348418A1 (en) * | 2009-12-18 | 2011-07-27 | Siemens Aktiengesellschaft | Multi trace parser |
| CN104781682A (en) * | 2012-10-20 | 2015-07-15 | 爱德万测试公司 | Pseudo tester-per-site functionality on natively tester-per-pin automatic test equipment for semiconductor test |
| CN105511936A (en) * | 2014-09-22 | 2016-04-20 | 北京奇虎科技有限公司 | Test system, method and device |
| CN107577602A (en) * | 2017-08-25 | 2018-01-12 | 上海斐讯数据通信技术有限公司 | A kind of method of testing of APP interfaces, apparatus and system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN108563562A (en) | 2018-09-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2019178957A1 (en) | Distributed system test method and device, computer device and storage medium | |
| US12028210B2 (en) | Production software application performance and resiliency testing | |
| US10341215B2 (en) | Methods, systems, and computer readable media for emulating network traffic patterns on a virtual machine | |
| WO2018184420A1 (en) | Software testing method, apparatus, electronic device, and medium | |
| WO2019057089A1 (en) | Network card image packet capture method, terminal, and readable storage medium | |
| WO2019227641A1 (en) | Application testing method, apparatus, terminal device and medium | |
| CN107659455B (en) | Method, storage medium, device and system for Mock data of iOS (internet operating system) end | |
| CN108459850B (en) | Method, device and system for generating test script | |
| CN104915297B (en) | A kind of automated testing method of the APP power consumption of android equipment | |
| CN108733545B (en) | Pressure testing method and device | |
| WO2020211360A1 (en) | Mock test method and system, electronic device, and computer non-volatile readable storage medium | |
| CN111597099A (en) | Non-invasive simulation method for monitoring application running quality deployed on cloud platform | |
| US8874966B1 (en) | Storage device error simulator tool | |
| CN109815119A (en) | A kind of test method and device of APP link channel | |
| CN116097226A (en) | Apparatus and method for injecting faults into a distributed system | |
| CN105472015A (en) | Method and device for accessing cloud platform to third-party application | |
| CN111464383A (en) | System capacity testing method and device based on production environment | |
| CN111159033A (en) | Software testing method and device | |
| CN112416734A (en) | Test method, device and storage medium | |
| CN113760672A (en) | Performance testing method, equipment and storage medium for multi-cloud platform resources | |
| WO2016188101A1 (en) | Service system test method and device | |
| CN108427635A (en) | Quickly method, server and the computer readable storage medium of test web page | |
| CN115996179B (en) | Service node testing method, device, readable medium and electronic device | |
| CN103378989B (en) | A kind of method and apparatus obtaining performance test data | |
| CN120508499A (en) | Database simulation test method, device and equipment |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18910570 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.01.2021) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 18910570 Country of ref document: EP Kind code of ref document: A1 |