Distributed test control method and device based on load balancing
By receiving test task requests from remote warehouse branches, locking the compilation node and obtaining test case classification, dynamically adjusting the task execution node, the problem of insufficient resource allocation in the existing technology is solved, and efficient concurrent processing of multiple test tasks and dynamic allocation of resources is achieved.
Patent Information
- Application Number
- CN202210969550.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-12
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-08-12
AI Technical Summary
In the prior art, testing resources cannot be dynamically allocated, and concurrent processing during multiple test tasks cannot be achieved, resulting in an inefficient overall testing.
By receiving test task requests from remote warehouse branches, locking the compilation node and obtaining the actual classification of test cases, requesting the resource scheduling node to occupy the task distribution node, dynamically adjusting the task execution node, and realizing dynamic allocation of resources and concurrent processing of tasks.
It improves the overall testing efficiency, realizes dynamic allocation of resources and dynamic adjustment of different hardware performance equipment, and improves the reliability and real-timeness of testing tasks.
Smart Images

Figure CN115481017B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network testing technology, and in particular to a distributed testing control method and device based on load balancing. Background Art
[0002] In the related technology, N test request data are sent to M distributed cache devices for testing through a preset load balancing device. After the test request data is executed, the distributed cache device returns the test business traffic and calculates the performance indicators of the distributed cache device, so that the test request data can be flexibly distributed.
[0003] However, in related technologies, since the hardware performance is basically the same, additional overhead is added, thereby reducing the overall performance. In addition, the test resources cannot be dynamically allocated, and concurrent processing of multiple test tasks cannot be achieved, which reduces the overall test efficiency and cannot meet the test requirements, which needs to be solved urgently. Summary of the Invention
[0004] The present application provides a distributed test control method and device based on load balancing to solve the technical problems in related technologies that test resources cannot be dynamically allocated, concurrent processing of multiple test tasks cannot be achieved, the overall test efficiency is reduced, and the test requirements cannot be met.
[0005] The first aspect of the present application provides a distributed test control method based on load balancing, comprising the following steps: receiving a test task request triggered by a remote warehouse branch based on a test code; locking a compilation node based on the test task request, and obtaining the actual classification of the test case while the compilation node compiles according to the test case code; requesting the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node; receiving notification information generated by the task distribution node based on the test case data obtained from the compilation node; requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained and executed from the task distribution node, and the execution result is returned to the task distribution node.
[0006] According to the above-mentioned technical means, the embodiment of the present application can enable the task execution node to continue to execute the tasks of other task nodes after completing the test task of the current task distribution node, and can use the dynamic scheduling mechanism of the task distribution node, so that the task distribution node can continue to execute other test tasks from the task management node after completing the test task of the current task management node, thereby realizing dynamic resource allocation, and at the same time, the occupied resources can be dynamically adjusted for devices with different hardware performance to improve overall testing efficiency.
[0007] Optionally, in one embodiment of the present application, the method of the embodiment of the present application further includes: receiving the execution results of all test cases sent by the task distribution node; and generating test case information according to the execution results of all test cases.
[0008] According to the above technical means, the embodiment of the present application can balance the task load of each task distribution node. At the same time, by counting the average overhead of the same type of use cases in the recent period, the test case task classification can be used more reasonably, thereby realizing dynamic allocation of resources.
[0009] Optionally, in one embodiment of the present application, obtaining the actual classification of the test case includes: obtaining one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number; obtaining the actual classification based on preset classification rules according to one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number.
[0010] According to the above technical means, the embodiment of the present application can dynamically adjust the number of task distribution nodes, thereby realizing dynamic resource allocation and improving overall testing efficiency.
[0011] Optionally, in one embodiment of the present application, the request to the resource scheduling node to occupy the task distribution node includes: obtaining the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number; requesting the resource scheduling node to occupy the task distribution node based on the preset rules for locking the task distribution node according to the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number.
[0012] According to the above technical means, the embodiment of the present application can request the task distribution node to occupy the task through the resource scheduling node, and then dynamically adjust the occupied resources, thereby improving the reliability of the test task.
[0013] The second aspect of the present application provides a distributed test control device based on load balancing, including: a first receiving module for receiving a test task request triggered by a remote warehouse branch based on a test code; a compilation module for locking a compilation node based on the test task request, and obtaining the actual classification of the test case while the compilation node compiles according to the test case code; a request module for requesting the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node; a second receiving module for receiving notification information generated by the task distribution node based on the test case data obtained from the compilation node; a control module for requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained and executed from the task distribution node, and the execution result is returned to the task distribution node.
[0014] Optionally, in one embodiment of the present application, the device of the embodiment of the present application also includes: a third receiving module for receiving the execution results of all test cases sent by the task distribution node; and a generation module for generating test case information based on the execution results of all test cases.
[0015] Optionally, in one embodiment of the present application, obtaining the actual classification of the test case includes obtaining one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number, and the actual classification is obtained based on a preset classification rule according to one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number.
[0016] Optionally, in one embodiment of the present application, the request module includes: an acquisition unit for acquiring the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number; a request unit for requesting the resource scheduling node to occupy the task distribution node based on the preset rules for locking the task distribution node according to the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number.
[0017] The third aspect of the present application provides a vehicle, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the distributed test control method based on load balancing as described in the above embodiment.
[0018] The fourth aspect of the present application provides a computer-readable storage medium, which stores a computer program. When the program is executed by a processor, it implements the above-mentioned distributed test control method based on load balancing.
[0019] Beneficial effects of this application:
[0020] (1) In the embodiment of the present application, the resource scheduling node can request the task distribution node to occupy the task, and then dynamically adjust the occupied resources, thereby improving the reliability of the test task.
[0021] (2) The embodiment of the present application enables the task execution node to continue to execute the tasks of other task nodes after completing the test task of the current task distribution node, and can use the dynamic scheduling mechanism of the task distribution node, so that the task distribution node can continue to execute other test tasks from the task management node after completing the test task of the current task management node, thereby realizing dynamic resource allocation. At the same time, the occupied resources can be dynamically adjusted for devices with different hardware performance, thereby improving the overall test efficiency.
[0022] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0024] Figure 1 A flow chart of a distributed test control method based on load balancing provided according to an embodiment of the present application;
[0025] Figure 2 A schematic diagram of the relationship between nodes of a distributed test control method based on load balancing according to a specific embodiment of the present application;
[0026] Figure 3 A flowchart of test case compilation for a specific embodiment of this application;
[0027] Figure 4 This is a flow chart of test case classification rules for a specific embodiment of the present application;
[0028] Figure 5This is a test case task distribution flow chart for a specific embodiment of the present application;
[0029] Figure 6 This is a test case task execution flow chart for a specific embodiment of the present application;
[0030] Figure 7 This is a flowchart of test case task execution result processing for a specific embodiment of the present application;
[0031] Figure 8 Schematic diagram of the structure of a distributed test control device based on load balancing according to an embodiment of the present application;
[0032] Figure 9 A schematic structural diagram of a vehicle provided according to an embodiment of the present application.
[0033] Among them, 10-distributed test control device based on load balancing; 100-first receiving module, 200-compilation module, 300-request module, 400-second receiving module and 500-control module; 901-memory, 902-processor and 903-communication interface. DETAILED DESCRIPTION
[0034] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0035] The following describes a distributed test control method and device based on load balancing according to an embodiment of the present application with reference to the accompanying drawings. In view of the problem that the related technologies mentioned in the background technology center cannot dynamically allocate test resources and cannot realize concurrent processing of multiple test tasks, which reduces the efficiency of the overall test and cannot meet the test requirements, the present application provides a distributed test control method based on load balancing, in which a test task request triggered by a remote warehouse branch based on the test code can be received, thereby locking the compilation node, and while the compilation node compiles according to the test case code, obtaining the actual classification of the test case, then requesting the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node, and receiving the notification information generated by the task distribution node based on the test case data obtained from the compilation node, thereby requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained and executed from the task distribution node, and the result is returned to the task distribution node, so that task management and resource scheduling can be separated, so that resources can be dynamically allocated, and the overall test efficiency is improved. This solves the technical problems in related technologies of being unable to dynamically allocate test resources, being unable to implement concurrent processing of multiple test tasks, reducing overall test efficiency, and being unable to meet test requirements.
[0036] To facilitate understanding, some of the terms used in the embodiments of this application are explained below.
[0037] (1) Test task: refers to the entire test task initiated by the test task initiator, including multiple test case tasks.
[0038] (2) Test case task: refers to a task based on a single test case. The information includes the number of CPU (Central Processing Unit) cores occupied, average running time, etc.
[0039] (3) Test case task group: refers to a group of test case tasks classified by the task management node according to certain rules.
[0040] (4) Test case data: The data required to execute the test case task is compiled and generated by the compilation node.
[0041] Specifically, Figure 1 A flow chart of a distributed test control method based on load balancing provided in an embodiment of the present application.
[0042] like Figure 1 As shown, the distributed test control method based on load balancing includes the following steps:
[0043] In step S101 , a test task request triggered by a remote warehouse branch based on test code is received.
[0044] It can be understood that the embodiment of the present application can receive test task requests triggered by remote warehouse branches based on test codes. For example, developers can push test codes to remote warehouse branches and trigger test task requests, thereby ensuring that developers can request to initiate test tasks to the task management node in the following steps, thereby improving the feasibility of the test.
[0045] In step S102 , a compile node is locked based on a test task request, and while the compile node is compiling according to the test case code, an actual classification of the test case is obtained.
[0046] During the actual execution process, the embodiment of the present application can lock the compilation node based on the test task request. For example, the developer can push the test code to the remote warehouse branch, trigger the test task request, and inform the task management node of the remote warehouse address, so that the task management node can receive the test task request and determine whether there is an available compilation node. When there is an available compilation node, the task management node will randomly select and lock a compilation node and inform it of the remote warehouse branch. Otherwise, the test task of the embodiment of the present application is in a waiting state until there is an available compilation node.
[0047] In addition, while the compilation node is compiling according to the test case code, the actual classification of the test cases in the following steps can be obtained. For example, the compilation node can obtain the test case code from the remote branch for compilation, and there are multiple compilation nodes. At the same time, the number of compilation nodes determines the parallelism of the overall test, and after the compilation is completed, the task management node is notified to perform the test case task classification in the following steps, thereby improving the overall test efficiency and improving the executability of the test system.
[0048] Among them, in one embodiment of the present application, obtaining the actual classification of the test case includes: obtaining one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number; obtaining the actual classification based on preset classification rules according to one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number.
[0049] For example, in the embodiments of the present application, the task management node can classify the test case tasks according to the overhead of the test case tasks (the result obtained after weighted processing according to the number of CPU cores occupied, running time, etc.), and according to the number of task distribution nodes. Assume that the number of task distribution nodes is N, the overhead of the test case tasks after weighted processing is C, the total number of test case tasks is S, the number of test case tasks on the task distribution node is M, Cs represents the test overhead of the test case task with the task number s, and Cmn represents the test overhead of the test case task with the task number m on the task distribution node with the node number n, where 0 < n ≤ N, 0 < m ≤ M, 0 < s ≤ S, and MN ≥ S. Then the classification rules are as follows:
[0050] (1) Sort the test case task overheads to satisfy Cm ≥ Cm+1, 0 < m < M.
[0051] (2) When M ≤ N, allocate the test case tasks numbered from 1 to M to the task distribution nodes numbered from 1 to M in sequence, satisfying C1n ≥ C1(n+1). At this time, the number of task distribution nodes will be changed to M.
[0052] (3) When M > N, allocate the test case tasks numbered from 1 to N to the task distribution nodes numbered from 1 to N in sequence, satisfying C1n ≥ C1(n+1). Then allocate the test case tasks numbered from N + 1 to 2N to the task distribution nodes numbered from 1 to N, satisfying C2n ≤ C2(n+1), that is, when m is odd, Cmn ≥ Cm(n+1), and when m is even, Cmn ≤ Cm(n+1), and at the same time mn ≤ S.
[0053] Those skilled in the art should understand that as a further improvement of the test case task classification, a threshold for the number of test case tasks can be set, and according to the threshold for the number of test case tasks, the number of task distribution nodes can be dynamically adjusted, so as to achieve dynamic allocation of resources and improve the overall test efficiency.
[0054] In step S103, request the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node.
[0055] It can be understood that the embodiments of the present application can request the resource scheduling node to occupy the task distribution node in the following steps, so that the resource scheduling node locks the task execution node to the test task in the task distribution node, thereby achieving dynamic allocation of resources and effectively improving the overall test efficiency.
[0056] Among them, in one embodiment of the present application, requesting to occupy a task distribution node from a resource scheduling node includes: obtaining the maximum number of occupied task distribution nodes, the quantity of total test case tasks, the current number of occupied task distribution nodes, and / or the expected number of occupied task distribution nodes; and requesting to occupy a task distribution node from the resource scheduling node based on the preset rules for locking task distribution nodes according to the maximum number of occupied task distribution nodes, the quantity of total test case tasks, the current number of occupied task distribution nodes, and / or the expected number of occupied task distribution nodes.
[0057] In some embodiments, the task management node in the embodiments of the present application may request the allocation and locking of task distribution nodes from the resource scheduling node for the classified test case task groups. For example, assume that the maximum number of occupied task distribution nodes is NMax, the quantity of total test case tasks is S, the current number of occupied task distribution nodes is Ncur, and the expected number of occupied task distribution nodes is Nexp. Then the rules for locking task distribution nodes are as follows:
[0058] (1) When S ≥ Nmax, then Nexp = NMax; when S ≤ Nmax, then Nexp = S.
[0059] (2) When the currently occupied task distribution nodes are less than the expected number of occupied task distribution nodes, that is, Ncur < Nexp, then continue to occupy available task distribution nodes.
[0060] (3) When the currently occupied task distribution nodes are equal to the expected number of occupied task distribution nodes, that is, Ncur = Nexp, then stop occupying task distribution nodes.
[0061] In addition, after the task distribution nodes are locked, the test case task groups can be obtained from the task management node. After the task distribution nodes obtain the test case task groups, they can incrementally download test case data from the compilation node according to the test case tasks. After the test case data in the compilation node is downloaded by the corresponding task distribution nodes, the task distribution nodes can initiate a request to end the occupation, and thus can dynamically adjust the occupied resources, improving the reliability of the test tasks.
[0062] In step S104, receive the notification information generated by the task distribution node based on the test case data obtained from the compilation node.
[0063] It can be understood that the embodiments of the present application can receive the notification information generated by the task distribution node based on the test case data obtained from the compilation node, thereby improving the executability of the test and effectively enhancing the real-time performance and reliability of the test.
[0064] In step S105, a request is made to the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that test cases are incrementally obtained from the task distribution node and executed, and the execution results are returned to the task distribution node.
[0065] During the actual execution process, the embodiment of the present application can request the resource scheduling node to occupy the task execution node so that the resource scheduling node locks the task execution node to the task distribution node. For example, when a task distribution node completes downloading test case data to the task, it will notify the task management node. The task management node requests the resource scheduling node to lock a certain number of task execution nodes for the task distribution node, where the locking rules are similar to the locking rules of the task distribution node.
[0066] Next, after the task execution node is locked, the embodiment of the present application will obtain test case data from the task distribution node, wherein the judgment rules for obtaining test case data are as follows:
[0067] (1) The number of idle CPU cores on this node is 0, and no processing is required.
[0068] (2) When the number of CPU cores occupied by the test case is greater than the number of idle CPU cores of this node, the next test case data is judged. When the number of CPU cores occupied by the test case data is greater than the number of idle CPU cores of this node, no processing is required.
[0069] (3) When the number of CPU cores occupied by the test case data is less than the number of idle CPU cores of this node, the task is taken away, and the number of idle CPU cores of this node is modified to the number of idle CPU cores of this node minus the number of CPU cores occupied by the test case data, and the next test case is judged.
[0070] (4) When the number of CPU cores occupied by the test case data is equal to the number of idle CPU cores of this node, the number of idle CPU cores of this node is changed to 0.
[0071] In addition, the embodiments of the present application can incrementally obtain test cases from the task distribution node and execute them, and return the execution results to the task distribution node. For example, after the current task execution node executes the test case task, it can determine whether there is a test case task to be executed in the corresponding task distribution node test case task in the current task management node. When there is a test case task to be executed, the test case data is obtained from the task distribution node after the task execution node is locked. Otherwise, the current task execution node cancels the binding relationship with the task execution node and releases the occupancy, so that the task execution node returns the test case execution result to the task distribution node. After the task distribution node completes the collection of the test case execution results, it returns the result to the task management node, so that devices with different hardware performance can dynamically adjust the occupied resources, so that resources are dynamically allocated, and the load is more balanced when the task execution node obtains test cases.
[0072] Optionally, in one embodiment of the present application, the method of the embodiment of the present application further includes: receiving execution results of all test cases sent by the task distribution node; and generating test case information according to the execution results of all test cases.
[0073] As a possible implementation method, the embodiment of the present application can receive the execution results of all test cases sent by the task distribution node. For example, after the task management node collects the test case execution results, the average overhead value of the corresponding test case task data can be dynamically updated. It should be noted that the average overhead value generally refers to the weighted average overhead value. Generally speaking, the weight of the most recent test case task is relatively large. In the embodiment of the present application, the weight of the historical average overhead value is tentatively set to 0.7, and the weight value of the most recent test case task overhead value is 0.3, so that the task load of each task distribution node can be balanced. At the same time, by counting the average overhead of the same type of use cases in the recent period, the test case task classification can be used more reasonably, realizing dynamic allocation of resources and effectively improving the overall testing efficiency.
[0074] like Figure 2 As shown, in order to better implement distributed testing based on load balancing, seven roles can be involved in the embodiment of the present application, namely, test task initiator, remote code repository, compilation node, task management node, resource scheduling node, task distribution node and task execution node. The specific working principle of each node is described in detail below.
[0075] Specifically, the test task initiator can send local modifications to the remote code repository and initiate the test task to the task management node.
[0076] Among them, the remote code repository can store the code modifications made by the test task initiator.
[0077] The compilation node can receive the occupation instruction of the task management node, obtain the test case code from the remote code repository according to the test task information of the task management node, and compile and generate the test case data.
[0078] The task management node can receive user task triggers, parse test case tasks, compile node resource scheduling, calculate test case task weighted overhead and classify test case tasks, and request resource scheduling nodes to allocate resources based on test case task classification, including task distribution nodes and task execution nodes.
[0079] The resource scheduling node can receive resource occupation requests from the task management node based on a certain test task. After receiving the request, it can occupy the task distribution node and task execution node for the test task according to certain rules.
[0080] The task distribution node can receive the occupation command of the resource scheduling node, incrementally obtain test case data from the compilation node, receive the test case task execution results, and return them to the task management node.
[0081] The task execution node can receive the occupation command of the resource scheduling node, incrementally obtain test case data from the task distribution node, execute the test case task, and return the test case task execution result to the task distribution node.
[0082] like Figure 3 As shown, the working principle of the embodiment of the present application will be described in detail below with a specific embodiment.
[0083] Step S301: The test task initiator pushes the test code to the remote code repository.
[0084] Step S302: The test task initiator requests the task management node to initiate a test task.
[0085] Step S303: The task management node detects whether there is an available compilation node.
[0086] Step S304: Determine whether there is an available compile node. If there is an available compile node, execute step S305; otherwise, execute step S303.
[0087] Step S305: The task management node randomly occupies a compilation node.
[0088] Step S306: The compile node compiles the test case.
[0089] Step S307: Compilation is completed and the task management node is notified.
[0090] like Figure 4As shown, the working principle of the embodiment of the present application will be described in detail below with a specific embodiment.
[0091] Step S401: The task management node sorts the test case tasks according to their overhead, satisfying Cm≥Cm+1.
[0092] Step S402: Determine the number M of task distribution nodes and the number of test case tasks.
[0093] Step S403: Determine whether M≤N. If M≤N, execute step S404; otherwise, execute step S405.
[0094] Step S404: Allocate M test cases to M task distribution nodes, satisfying C1n≥C1(n+1).
[0095] Step S405: Determine the column number m, which is initially 1 (the test case task sequence number of the task distribution node).
[0096] Step S406: Determine whether m is an odd number. If m is an odd number, execute step S408; otherwise, execute step S407.
[0097] Step S407: satisfy Cmn≤Cm(n+1).
[0098] Step S408: Cmn≥Cm(n+1) is satisfied.
[0099] Step S409: Determine whether m*n==M. If m*n==M, execute step S410; otherwise, execute step S405.
[0100] Step S410: Test case task classification is completed.
[0101] like Figure 5 As shown, the working principle of the embodiment of the present application will be described in detail below with a specific embodiment.
[0102] Step S501: The task management node classifies the test case tasks.
[0103] Step S502: The task management node requests the resource scheduling node to occupy the task distribution node.
[0104] Step S503: The resource scheduling node detects the occupancy status of the task distribution node.
[0105] Step S504: Determine whether the occupied task distribution nodes have reached the expected value. If the occupied task distribution nodes have reached the expected value, execute step S506; otherwise, execute step S505.
[0106] Step S505: Continue to occupy the task distribution node.
[0107] Step S506: After the task distribution node is occupied, the test case task group is obtained from the task management node.
[0108] Step S507: The task distribution node obtains the test case data from the corresponding compiler according to the test case task.
[0109] Step S508: After the task distribution node completes acquiring the test case data, it notifies the task management node.
[0110] Step S509: After all test case data are acquired, the task management node releases the occupation of the compilation node.
[0111] like Figure 6 As shown, the working principle of the embodiment of the present application will be described in detail below with a specific embodiment.
[0112] Step S601: After the task distribution node completes acquiring the test case data, it notifies the task management node.
[0113] Step S602: The task management node requests the resource scheduling node for task execution node occupancy.
[0114] Step S603: The resource scheduling node detects the occupancy status of the task execution nodes.
[0115] Step S604: Determine whether the occupied task execution nodes have reached the expected value. If the occupied task execution nodes have reached the expected value, execute step S606; otherwise, execute step S605.
[0116] Step S605: Continue to occupy the task execution node.
[0117] Step S606: After the task execution node is occupied, it obtains the test case data from the corresponding task distribution node and executes it.
[0118] Step S607: After the test case task is executed, the result is returned to the task distribution node.
[0119] Step S608: After all test case tasks are completed, the task distribution node returns the execution results to the task management node.
[0120] like Figure 7 As shown, the working principle of the embodiment of the present application will be described in detail below with a specific embodiment.
[0121] Step S701: The task management node receives the test case result of the task distribution result.
[0122] Step S702: Calculate the current test case task overhead Ccur based on the number of CPU cores and the running time.
[0123] Step S703: the average cost of the test case task Cavg = Cavg*0.7+Ccur*0.3. By counting the average cost of the same type of test cases in the recent period, the test case task classification can be more reasonable.
[0124] According to the distributed test control method based on load balancing proposed in the embodiment of the present application, a test task request triggered by a remote warehouse branch based on the test code can be received, thereby locking the compilation node, and while the compilation node compiles according to the test case code, the actual classification of the test case is obtained, and then the resource scheduling node is requested to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node, and receives the notification information generated by the task distribution node based on the test case data obtained from the compilation node, thereby requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained and executed from the task distribution node, and the result is returned to the task distribution node, so that task management and resource scheduling can be separated, so that resources can be dynamically allocated, and the overall test efficiency is improved. Thus, the technical problem that the related technology cannot dynamically allocate test resources and cannot realize concurrent processing of multiple test tasks, reduces the efficiency of the overall test, and cannot meet the test requirements is solved.
[0125] Next, a distributed test control device based on load balancing proposed in accordance with an embodiment of the present application will be described with reference to the accompanying drawings.
[0126] Figure 8 It is a block diagram of a distributed test control device based on load balancing according to an embodiment of the present application.
[0127] like Figure 8 As shown, the distributed test control device 10 based on load balancing includes: a first receiving module 100 , a compiling module 200 , a requesting module 300 , a second receiving module 400 and a control module 500 .
[0128] Specifically, the first receiving module 100 is configured to receive a test task request triggered by a remote repository branch based on a test code.
[0129] The compiling module 200 is configured to lock a compiling node based on a test task request, and obtain an actual classification of the test case while the compiling node is compiling according to the test case code.
[0130] The request module 300 is used to request the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node.
[0131] The second receiving module 400 is configured to receive notification information generated by the task distribution node based on the test case data obtained from the compilation node.
[0132] The control module 500 is used to request the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test cases are incrementally obtained and executed from the task distribution node, and the execution results are returned to the task distribution node.
[0133] Optionally, in one embodiment of the present application, the apparatus 10 of the embodiment of the present application further includes: a third receiving module and a generating module.
[0134] The third receiving module is used to receive the execution results of all test cases sent by the task distribution node.
[0135] The generation module is used to generate test case information based on the execution results of all test cases.
[0136] Optionally, in one embodiment of the present application, obtaining the actual classification of the test case includes obtaining one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number, and obtaining the actual classification based on preset classification rules according to one or more of the task overhead of the test case, the number of task distribution nodes, the test case task overhead after weighted processing, the total number of test case tasks, the number of test case tasks of task distribution nodes, and the test overhead corresponding to the test case task number.
[0137] Optionally, in one embodiment of the present application, the request module 300 includes: an acquisition unit and a request unit.
[0138] The acquisition unit is used to acquire the maximum number of task distribution node occupancy, the total number of test case tasks, the current number of task distribution node occupancy and / or the expected number of task distribution node occupancy.
[0139] The request unit is used to request the resource scheduling node to occupy the task distribution node based on the preset rules for locking the task distribution node according to the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number.
[0140] It should be noted that the above explanation of the embodiment of the distributed test control method based on load balancing is also applicable to the distributed test control device based on load balancing in this embodiment, and will not be repeated here.
[0141] According to the distributed test control device based on load balancing proposed in the embodiment of the present application, it can receive a test task request triggered by a remote warehouse branch based on the test code, thereby locking the compilation node, and while the compilation node compiles according to the test case code, it obtains the actual classification of the test case, and then requests the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node, and receives the notification information generated by the task distribution node based on the test case data obtained from the compilation node, thereby requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained and executed from the task distribution node, and the result is returned to the task distribution node, so that task management and resource scheduling can be separated, so that resources can be dynamically allocated, and the overall test efficiency is improved. Thus, the technical problem that the related technology cannot dynamically allocate test resources and cannot realize concurrent processing of multiple test tasks, reduces the efficiency of the overall test, and cannot meet the test requirements is solved.
[0142] Figure 9 A schematic diagram of the structure of a vehicle provided in an embodiment of the present application. The vehicle may include:
[0143] A memory 901 , a processor 902 , and a computer program stored in the memory 901 and executable on the processor 902 .
[0144] When the processor 902 executes the program, the distributed test control method based on load balancing provided in the above embodiment is implemented.
[0145] Furthermore, the vehicle further comprises:
[0146] The communication interface 903 is used for communication between the memory 901 and the processor 902 .
[0147] The memory 901 is used to store computer programs that can be run on the processor 902 .
[0148] The memory 901 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0149] If the memory 901, processor 902, and communication interface 903 are implemented independently, the communication interface 903, memory 901, and processor 902 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0150] Optionally, in a specific implementation, if the memory 901, the processor 902 and the communication interface 903 are integrated on a chip, the memory 901, the processor 902 and the communication interface 903 can communicate with each other through an internal interface.
[0151] The processor 902 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
[0152] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned distributed test control method based on load balancing.
[0153] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.
[0154] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of technical features indicated. Thus, a feature specified as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of this application, "N" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0155] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or N executable instructions for implementing a custom logical function or process step, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed in a different order than shown or discussed, including performing functions in a substantially simultaneous manner or in a reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application pertain.
[0156] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or N wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program can be obtained electronically by optically scanning the paper or other medium and then editing, interpreting or processing it in other suitable ways as necessary, and then storing it in a computer memory.
[0157] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiment, the N steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. If implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0158] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.
[0159] In addition, the functional units in the various embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into a module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0160] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.
Claims
1. A distributed test control method based on load balancing, characterized in that: The following steps are involved: Receive test task requests triggered by remote warehouse branches based on test code; Locking a compilation node based on the test task request, and obtaining an actual classification of the test case while the compilation node compiles the test case code; Requesting the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node; receiving notification information generated by the task distribution node based on the test case data obtained from the compilation node; as well as Requesting the resource scheduling node to occupy the task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained from the task distribution node and executed, and the execution result is returned to the task distribution node; The actual classification of the test case is obtained, including: Obtain one or more of the following: the task overhead of the test case, the number of task distribution nodes, the weighted test case task overhead, the total number of test case tasks, the number of task distribution node test case tasks, and the test overhead corresponding to the test case task number; The actual classification is obtained based on preset classification rules according to one or more of the task overhead of the test case, the number of task distribution nodes, the weighted test case task overhead, the total number of test case tasks, the number of test case tasks of the task distribution node, and the test overhead corresponding to the test case task number.
2. The method according to claim 1, characterized in that Also includes: Receive the execution results of all test cases sent by the task distribution node; Test case information is generated based on the execution results of all the test cases.
3. The method according to claim 1, characterized in that The requesting the resource scheduling node to occupy the task distribution node includes: Obtaining the maximum number of task distribution node occupancy, the total number of test case tasks, the current number of task distribution node occupancy, and / or the expected number of task distribution node occupancy; According to the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number, the resource scheduling node is requested to occupy the task distribution node based on the preset rule of locking the task distribution node.
4. A distributed test control device based on load balancing, characterized in that: include: The first receiving module is used to receive a test task request triggered by a remote warehouse branch based on the test code; A compiling module, configured to lock a compiling node based on the test task request, and obtain an actual classification of the test case while the compiling node compiles the test case code; A request module, configured to request the resource scheduling node to occupy the task distribution node, so that the resource scheduling node locks the task execution node to the test task in the task distribution node; A second receiving module is configured to receive notification information generated by the task distribution node based on the test case data obtained from the compiling node; as well as a control module configured to request the resource scheduling node to occupy a task execution node, so that the resource scheduling node locks the task execution node to the task distribution node, so that the test case is incrementally obtained from the task distribution node and executed, and the execution result is returned to the task distribution node; The actual classification of the test case is obtained by obtaining one or more of the task overhead of the test case, the number of task distribution nodes, the weighted test case task overhead, the total number of test case tasks, the number of test case tasks of the task distribution node, and the test overhead corresponding to the test case task number. The actual classification is obtained based on a preset classification rule according to one or more of the task overhead of the test case, the number of task distribution nodes, the weighted test case task overhead, the total number of test case tasks, the number of test case tasks of the task distribution node, and the test overhead corresponding to the test case task number.
5. The device according to claim 4, characterized in that Also includes: A third receiving module is used to receive the execution results of all test cases sent by the task distribution node; A generation module is used to generate test case information according to the execution results of all the test cases.
6. The device according to claim 4, characterized in that The request module includes: An acquisition unit, configured to acquire a maximum number of task distribution node occupancy, the number of the total test case tasks, a current number of task distribution node occupancy, and / or an expected number of task distribution node occupancy; A request unit is used to request the resource scheduling node to occupy the task distribution node based on the preset rules for locking the task distribution node according to the maximum task distribution node occupancy number, the total number of test case tasks, the current task distribution node occupancy number and / or the expected task distribution node occupancy number.
7. A vehicle, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the distributed test control method based on load balancing according to any one of claims 1 to 3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the distributed test control method based on load balancing as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Distributed scheduling automated testing platform and method
CN106844198A
Test system and method
CN109739744A