[go: up one dir, main page]

CN109194538B - Testing method, device, server and storage medium based on distributed coordination - Google Patents

Testing method, device, server and storage medium based on distributed coordination Download PDF

Info

Publication number
CN109194538B
CN109194538B CN201810876289.1A CN201810876289A CN109194538B CN 109194538 B CN109194538 B CN 109194538B CN 201810876289 A CN201810876289 A CN 201810876289A CN 109194538 B CN109194538 B CN 109194538B
Authority
CN
China
Prior art keywords
node
task
server
test
machine
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.)
Active
Application number
CN201810876289.1A
Other languages
Chinese (zh)
Other versions
CN109194538A (en
Inventor
林铭森
毛皓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810876289.1A priority Critical patent/CN109194538B/en
Priority to PCT/CN2018/107675 priority patent/WO2020024405A1/en
Publication of CN109194538A publication Critical patent/CN109194538A/en
Application granted granted Critical
Publication of CN109194538B publication Critical patent/CN109194538B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/12Network monitoring probes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a testing method, a testing device, a server and a storage medium based on distributed coordination, wherein the method comprises the following steps: the server registers the task node and the task lock node through the control service module zk-server and performs enqueue operation on the test task; the executive machine monitors the server by controlling the client zk-client, after a test task exists, the client zk-client informs an agent module on the executive machine, and the agent module is controlled to newly establish an executive machine node under a task lock node registered by the server so as to acquire the test task; the server informs the executive machine to deploy the script corresponding to the test task; the execution machine downloads the script from the script library and sends the deployment state information to the server; the server sends a message for executing the test task to the execution machine; and the execution machine performs test construction and executes the script so as to test the test task. The invention does not need to monitor the state of the executive machine, has simple test task allocation flow and improves the execution efficiency of the test task.

Description

Testing method, device, server and storage medium based on distributed coordination
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a test method, an apparatus, a server, and a storage medium based on distributed coordination.
Background
At present, in a master-slave mode of a Jenkins scheduling platform, a host master needs to judge whether an execution machine slave is in an idle state or not, and monitors heartbeat of the execution machine slave in real time to monitor the state of the execution machine slave. If there is a certain delay (5-10 seconds) in the process of monitoring the heartbeat of the execution machine slave, if there is an execution machine slave down in a time slot of the heartbeat delay, but the execution machine slave on the host master is still in an available state, and at this time, the execution machine slave is still allocated, a node construction failure will result, the execution machine slave cannot execute a test task, and at this time, a test task needs to be reallocated, the state of the execution machine slave in the construction process of one test is difficult to monitor, the test task allocation flow is complex, and the execution efficiency of the test task is low.
Disclosure of Invention
The invention aims to provide a testing method, a testing device, a testing server and a testing storage medium based on distributed coordination, and aims to simplify the distribution process of testing tasks and improve the execution efficiency of the testing tasks.
In order to achieve the above object, the present invention provides a testing method based on distributed coordination, wherein the testing method based on distributed coordination comprises:
s1, when receiving a test task, the server registers a task node and a task lock node through a control service module zk-server, performs enqueue operation on the test task, and stores attribute information corresponding to the task node, wherein the attribute information comprises a script library system name;
s2, the executive machine monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs the agent module on the executive machine, and controls the agent module to establish an executive machine node under the task lock node registered by the server by using a preset lock mechanism so as to acquire the test task;
s3, after the executive machine obtains the test task, the server records the corresponding node name and state information under the executive machine node, if the state information is a new successful state, the executive machine is informed to deploy the script corresponding to the test task;
s4, after receiving the notification of the deployment script of the server, the executive machine obtains the name of the script library system in the attribute information corresponding to the task node registered by the server, downloads the script in the script library corresponding to the name of the script library system, updates the deployment state information of the executive machine after completing the deployment of the script, and sends the corresponding deployment state information to the server;
s5, after receiving the deployment state information of the execution machine, the server sends a message for executing the test task to the execution machine if all the deployment state information is in a deployment completion state;
and S6, after receiving the message of the server for executing the test task, the execution machine performs test construction and executes a script to test the test task.
Preferably, the predetermined locking mechanism is an optimistic locking mechanism, and the step of controlling the agent module to newly create an execution engine node under the task lock node specifically includes:
controlling the agent module to try to create an executive machine node under the task lock node;
if the new establishment of the executive machine node is successful, the executive machine is successfully distributed, and the agent module obtains a test task;
if the new establishment of the executive machine node fails, the allocation of the executive machine fails, and the step of trying to establish the new executive machine node is returned to.
Preferably, the predetermined locking mechanism is a concurrent locking mechanism, and the step of controlling the agent module to newly create an execution machine node under the task lock node specifically includes:
controlling the agent module to create a temporary sequence node under the task lock node;
if the number of the temporary sequence node is the minimum number, the agent module acquires the lock and acquires the test task;
and if the number of the temporary sequence node is not the minimum number, returning to the step of creating the temporary sequence node under the task lock node after monitoring that the lock is released.
Preferably, the attribute information further includes the number of execution machines, and the step of performing test construction and executing a script specifically includes: if the number of the execution machines required by the test task construction is two or more than two, the two or more than two execution machines execute the same script at the same time so as to perform concurrent scheduling.
In order to achieve the above object, the present invention further provides a testing apparatus, where the testing apparatus is an execution machine, the testing apparatus includes a memory and a processor connected to the memory, the memory stores a processing system that can run on the processor, and when executed by the processor, the processing system implements the following steps:
the executive machine monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs an agent module on the executive machine, and controls the agent module to newly establish an executive machine node under a task lock node registered by the server by using a preset lock mechanism so as to acquire the test task;
after receiving a notification of a deployment script of the server, acquiring a script library system name in attribute information corresponding to a task node registered by the server, downloading the script in a script library corresponding to the script library system name, updating deployment state information of the script library after completing script deployment, and sending the corresponding deployment state information to the server;
and after receiving a message of the server for executing the test task, performing test construction and executing a script to test the test task.
Preferably, the predetermined locking mechanism is an optimistic locking mechanism, and the step of controlling the agent module to newly create an execution engine node under the task lock node specifically includes:
controlling the agent module to try to create an executive machine node under the task lock node;
if the new establishment of the executive machine node is successful, the executive machine is successfully distributed, and the agent module obtains a test task;
if the new establishment of the executive machine node fails, the allocation of the executive machine fails, and the step of trying to establish the new executive machine node is returned to.
Preferably, the predetermined locking mechanism is a concurrent locking mechanism, and the step of controlling the agent module to newly create an execution machine node under the task lock node specifically includes:
controlling the agent module to create a temporary sequence node under the task lock node;
if the number of the temporary sequence node is the minimum number, the agent module acquires the lock and acquires the test task;
and if the number of the temporary sequence node is not the minimum number, returning to the step of creating the temporary sequence node under the task lock node after monitoring that the lock is released.
Preferably, the attribute information further includes the number of execution machines, and the step of performing test construction and executing a script specifically includes: if the number of the execution machines required by the test task construction is two or more than two, the two or more than two execution machines execute the same script at the same time so as to perform concurrent scheduling.
In order to achieve the above object, the present invention further provides a server, where the server includes a memory and a processor connected to the memory, the memory stores therein a processing system that is executable on the processor, and when executed by the processor, the processing system implements the following steps:
when a test task is received, registering a task node and a task lock node through a control service module zk-server, carrying out enqueue operation on the test task, and storing attribute information corresponding to the task node, wherein the attribute information comprises a script library system name;
after an executive machine acquires a test task, recording a corresponding node name and state information under the node of the executive machine, and if the state information is a new successful state, informing the executive machine to deploy a script corresponding to the test task;
and after the deployment state information of the execution machine is received, if all the deployment state information is in a deployment completion state, sending a message for executing the test task to the execution machine so as to test the test task.
The present invention also provides a computer readable storage medium having stored thereon a processing system, which when executed by a processor implements the steps of the above-described server-implemented distributed coordination-based testing method, or which when executed by a processor implements the steps of the above-described server-implemented distributed coordination-based testing method.
The invention has the beneficial effects that: the invention introduces zookeeper on the framework, the client zk-client on each executive machine monitors the test task on the service module zk-server, the service module zk-server has test tasks, all the client zk-clients receive the notification, the client zk-client notifies the agent module slave-agent to obtain the test task, the executive machine of the downtime can not obtain the test task, thus realizing the active fetching of the test task by the executive machine.
Drawings
FIG. 1 is a schematic diagram of an alternative application environment according to various embodiments of the present invention;
FIG. 2 is a diagram illustrating a hardware architecture of an embodiment of the server in FIG. 1
FIG. 3 is a diagram illustrating a hardware architecture of an embodiment of the testing apparatus in FIG. 1;
fig. 4 is a flowchart illustrating a testing method based on distributed coordination according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the description relating to "first", "second", etc. in the present invention is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Fig. 1 is a schematic application environment diagram of a distributed coordination-based test method according to a preferred embodiment of the present invention. The schematic diagram of the application environment includes a server 1 and a plurality of test devices 2 (i.e. execution machines). The server 1 may interact data with the testing device 2 via a network, near field communication technology or other suitable technology. In this embodiment, a distributed application program coordination service zookeeper is introduced into the framework, wherein a service module zk-server is deployed in the server 1, a client zk-client is deployed in each testing device 2, in addition, an agent module slave-agent is deployed in each testing device 2, and the client zk-client may be encapsulated in the agent module slave-agent or may exist independently. All state and running data are managed by the service module zk-server, and the client zk-client feeds back information in the execution machine to the service module zk-server.
The server 1 or the test apparatus 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. The server 1 or the testing device 2 may be a computer, or may be a single network server, a server group composed of a plurality of network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing, where the cloud computing is one of distributed computing, and is a super virtual computer composed of a group of loosely coupled computers.
In the embodiment, as shown in fig. 2, the server 1 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13, which are communicatively connected to each other through a system bus, and the memory 11 stores a processing system and a service module zk-server that can run on the processor 12. It is noted that fig. 1 only shows the server 1 with components 11-13, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
The storage 11 includes a memory and at least one type of readable storage medium. The memory provides cache for the operation of the server 1; the readable storage medium may be a non-volatile storage medium such as flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the readable storage medium may be an internal storage unit of the server 1, such as a hard disk of the server 1; in other embodiments, the non-volatile storage medium may be an external storage device of the server 1, such as a plug-in hard disk provided on the server 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. In this embodiment, the readable storage medium of the memory 11 is generally used for storing an operating system and various application software installed in the testing apparatus 1, for example, program codes of a processing system in an embodiment of the present invention. Further, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 12 is generally used for controlling the overall operation of the server 1, such as performing control and processing related to data interaction or communication with the test apparatus 2. In this embodiment, the processor 12 is configured to run the program code stored in the memory 11 or process data, for example, run a processing system.
The network interface 13 may comprise a wireless network interface or a wired network interface, and the network interface 13 is typically used for establishing a communication connection between the server 1 and the testing device 2. In this embodiment, the network interface 13 is mainly used to connect the server 1 and one or more test devices 2, and establish a data transmission channel and a communication connection between the server 1 and the one or more test devices 2.
The processing system and services module zk-server is stored in memory 11 and includes at least one computer readable instruction stored in memory 11, which is executable by processor 12 to implement the methods of the embodiments of the present application; and the at least one computer readable instruction may be divided into different logic blocks depending on the functions implemented by the respective portions.
In the embodiment, as shown in fig. 3, the testing device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23, which are communicatively connected to each other through a system bus, and the memory 21 stores a processing system, a client zk-client, and an agent that can run on the processor 22. It is noted that fig. 3 only shows the testing device 2 with components 21-23, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
The memory 21 is similar to the memory 11, the processor 22 is similar to the processor 12, and the network interface 23 is similar to the network interface 13, which are not described herein again. The processing system, client zk-client, and agent are stored in the memory 21 and comprise at least one computer readable instruction stored in the memory 21, the at least one computer readable instruction being executable by the processor 22 to implement the methods of the embodiments of the present application; and the at least one computer readable instruction may be divided into different logic blocks depending on the functions implemented by the respective portions.
In one embodiment, the processing system described above, when executed by the processor 12, performs the following steps:
when a test task is received, registering a task node and a task lock node through a control service module zk-server, carrying out enqueue operation on the test task, and storing attribute information corresponding to the task node, wherein the attribute information comprises a script library system name;
after an executive machine acquires a test task, recording a corresponding node name and state information under the node of the executive machine, and if the state information is a new successful state, informing the executive machine to deploy a script corresponding to the test task;
and after the deployment state information of the execution machine is received, if all the deployment state information is in a deployment completion state, sending a message for executing the test task to the execution machine so as to test the test task.
In another embodiment, the processing system described above, when executed by the processor 22, performs the steps of:
the executive machine monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs an agent module on the executive machine, and controls the agent module to newly establish an executive machine node under a task lock node registered by the server by using a preset lock mechanism so as to acquire the test task;
after receiving a notification of a deployment script of the server, acquiring a script library system name in attribute information corresponding to a task node registered by the server, downloading the script in a script library corresponding to the script library system name, updating deployment state information of the script library after completing script deployment, and sending the corresponding deployment state information to the server;
and after receiving a message of the server for executing the test task, performing test construction and executing a script to test the test task.
Further, the predetermined locking mechanism is an optimistic locking mechanism, and the step of controlling the agent module to newly establish an execution engine node under the task locking node specifically includes:
controlling the agent module to try to create an executive machine node under the task lock node;
if the new establishment of the executive machine node is successful, the executive machine is successfully distributed, and the agent module obtains a test task;
if the new establishment of the executive machine node fails, the allocation of the executive machine fails, and the step of trying to establish the new executive machine node is returned to.
Further, the predetermined locking mechanism is a concurrent locking mechanism, and the step of controlling the agent module to newly establish an execution machine node under the task locking node specifically includes:
controlling the agent module to create a temporary sequence node under the task lock node;
if the number of the temporary sequence node is the minimum number, the agent module acquires the lock and acquires the test task;
and if the number of the temporary sequence node is not the minimum number, returning to the step of creating the temporary sequence node under the task lock node after monitoring that the lock is released.
Further, the attribute information further includes the number of execution machines, and the step of performing test construction and executing a script specifically includes: if the number of the execution machines required by the test task construction is two or more, the two or more execution machines execute the same script simultaneously to perform concurrent scheduling.
The invention introduces zookeeper on the framework, the client zk-client on each executive machine monitors the test task on the service module zk-server, the service module zk-server has test tasks, all the client zk-clients receive the notification, the client zk-client notifies the agent module slave-agent to obtain the test task, the executive machine of the downtime can not obtain the test task, thus realizing the active fetching of the test task by the executive machine.
As shown in fig. 4, fig. 4 is a schematic flowchart of an embodiment of a testing method based on distributed coordination according to the present invention, and the testing method based on distributed coordination includes the following steps:
step S1, when receiving a test task, a server registers a task node and a task lock node through a control service module zk-server, performs enqueue operation on the test task, and stores attribute information corresponding to the task node, wherein the attribute information comprises a script library system name;
when the server receives a test task, the service module zk-server firstly creates a root directory as a task node, the enqueuing operation is to create child nodes under the root directory, then calculate the total number of the child nodes, and analyze whether the total number of the child nodes is the same as the target number of the task queue. If the two nodes are the same, then a root directory start node is created, and since the root directory start node has a state change, the service module zk-server notifies the client zk-client of the execution machine: the task queue is already full. Meanwhile, the service module zk-server also newly establishes a task lock node for the new node of the execution machine to fetch the task.
In addition, the attribute information of the registered task node comprises an ID code of the task node, the number of execution machines and a script library system name, wherein the script library system name is used for downloading scripts from a corresponding script library.
Step S2, the executive monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs the agent module on the executive, and controls the agent module to establish an executive node under the task lock node registered by the server by using a preset lock mechanism to obtain the test task;
after receiving the notification of the client zk-client, each agent module attempts to create an actuator node under the task lock node, wherein the actuator node is created by using a predetermined lock mechanism, and an actuator which successfully creates the actuator node can acquire a test task. In the process, the downtime of the executive machine does not need to newly establish an executive machine node to fetch tasks, so that whether the state of the executive machine is in an idle available state or not does not need to be concerned, the state of the executive machine does not need to be monitored, and the flow is simplified.
In one embodiment, the test tasks may be prepared using an optimistic lock machine, assuming that the number of execution machines is 2:
firstly, an agent module of a first execution machine tries to create an execution machine slave1 under a task lock node, and if the creation is successful, the execution machine is successfully distributed;
the agent module of the second execution machine tries to newly build an execution machine node slave1 under the task lock node, and if the new building is unsuccessful, the allocation of the execution machine fails;
then, the agent module of the second execution machine tries to create an execution machine slave2 under the task lock node, and if the creation is successful, the execution machine is successfully allocated.
In another embodiment, the testing task may be prepared using a concurrent lock machine:
controlling the agent module to create a temporary sequence node under the task lock node, and only one executive machine obtains the concurrent lock of the task at the same time;
if the number of the temporary sequence node is the minimum number, namely the temporary sequence node which is arranged at the first position is created firstly, the agent module acquires the concurrent lock and acquires the test task;
if the number of the temporary sequence node is not the minimum number, it indicates that the concurrency lock is acquired by other execution machines, at this time, whether the concurrency lock is released is known by monitoring whether the temporary sequence node of the minimum number deletes the event, after it is monitored that the concurrency lock is released, the step of creating the temporary sequence node under the task lock node is returned to be executed until the number of the temporary sequence node is the minimum number, at this time, it indicates that the concurrency lock is acquired, and the test task can be acquired after the concurrency lock is acquired.
The predetermined locking mechanism in the above embodiment may be an optimistic locking mechanism or a concurrent locking mechanism, so that the embodiment supports execution of high-concurrency and ultrahigh-concurrency test tasks, and is beneficial to improving test efficiency.
Step S3, after the executive machine obtains the test task, the server records the corresponding node name and state information under the executive machine node, if the state information is a new successful state, the executive machine is informed to deploy the script corresponding to the test task;
the node name is the host IP of the execution machine, and the state information comprises new establishment success and new establishment failure. And the server monitors the state information of the executive machine under the node of the executive machine, and if the state information is successfully established, the executive machine is informed to deploy the script corresponding to the test task.
In addition, in the prior art, state information, data and the like of the execution machine need to be stored in the database, and the service module zk-server stores state information and data of all the execution machines, so that interaction with the database is not needed, and the operation is more convenient.
Step S4, the executive machine obtains the name of the script library system in the attribute information corresponding to the task node registered by the server after receiving the notification of the deployment script of the server, downloads the script in the script library corresponding to the name of the script library system, updates the deployment state information of the executive machine after completing the deployment of the script, and sends the corresponding deployment state information to the server;
the execution machine downloads the script from the script library, completes script deployment, updates deployment state information of the execution machine, and sends the deployment state information to the server, wherein the deployment state information is 'deployment completion'.
Step S5, after receiving the deployment state information of the execution machine, the server sends a message for executing a test task to the execution machine if all the deployment state information is in a deployment completion state;
step S6, after receiving the message of executing the test task from the server, the execution machine performs test construction and executes a script to test the test task.
If the number of the execution machines required by the test task construction is one, the execution machines perform test construction and execute scripts after receiving a message of executing the test task from the server;
if the number of the execution machines required by the construction of the test task is two or more, each execution machine receives the message of the server for executing the test task, and because the time difference of the message received by each execution machine is small and can be ignored, the construction can be considered to be triggered simultaneously, N identical queue tasks can be submitted sequentially when the test task is constructed, the execution machines which rob the task belong to the same construction, the same test script is run on a plurality of execution machines, the concurrent scheduling is realized, and the test efficiency is further improved.
The invention introduces zookeeper on the framework, the client zk-client on each executive machine monitors the test task on the service module zk-server, the service module zk-server has test tasks, all the client zk-clients receive the notification, the client zk-client notifies the agent module slave-agent to obtain the test task, the executive machine of the downtime can not obtain the test task, thus realizing the active fetching of the test task by the executive machine.
The present invention also provides a computer readable storage medium having stored thereon a processing system, which when executed by a processor implements the steps of the above-described server-implemented distributed coordination-based testing method, or which when executed by a processor implements the steps of the above-described server-implemented distributed coordination-based testing method.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A test method based on distributed coordination is characterized in that the test method based on distributed coordination comprises the following steps:
s1, when receiving a test task, the server registers a task node and a task lock node through a control service module zk-server, performs enqueue operation on the test task, and stores attribute information corresponding to the task node, wherein the attribute information comprises an ID code of the task node, the number of execution machines and a script library system name;
s2, the executive machine monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs the agent module on the executive machine, and controls the agent module to establish an executive machine node under the task lock node registered by the server by using a preset lock mechanism so as to acquire the test task;
s3, after the executive machine obtains the test task, the server records the corresponding node name and state information under the node of the executive machine, wherein the node name is the host IP of the executive machine, the state information comprises success and failure of new establishment, and if the state information is the success state of new establishment, the executive machine is informed to deploy the script corresponding to the test task;
s4, after receiving the notification of the deployment script of the server, the executive machine obtains the name of the script library system in the attribute information corresponding to the task node registered by the server, downloads the script in the script library corresponding to the name of the script library system, updates the deployment state information of the executive machine after completing the deployment of the script, and sends the corresponding deployment state information to the server;
s5, after receiving the deployment state information of the execution machine, the server sends a message for executing the test task to the execution machine if all the deployment state information is in a deployment completion state;
and S6, after receiving the message of the server for executing the test task, the execution machines perform test construction and execute the script to test the test task, and if the number of the execution machines required by the test task construction is two or more, the two or more execution machines execute the same script at the same time to perform concurrent scheduling.
2. The distributed coordination based testing method according to claim 1, wherein the predetermined locking mechanism is an optimistic locking mechanism, and the step of controlling the agent module to newly create an execution machine node under the task lock node specifically includes:
controlling the agent module to try to create an executive machine node under the task lock node;
if the new establishment of the executive machine node is successful, the executive machine is successfully distributed, and the agent module obtains a test task;
if the new establishment of the executive machine node fails, the allocation of the executive machine fails, and the step of trying to establish the new executive machine node is returned to.
3. The distributed coordination based testing method according to claim 1, wherein the predetermined locking mechanism is a concurrent locking mechanism, and the step of controlling the agent module to newly establish an execution machine node under the task lock node specifically includes:
controlling the agent module to create a temporary sequence node under the task lock node;
if the number of the temporary sequence node is the minimum number, the agent module acquires the lock and acquires the test task;
and if the number of the temporary sequence node is not the minimum number, returning to the step of creating the temporary sequence node under the task lock node after monitoring that the lock is released.
4. A testing apparatus, wherein the testing apparatus is an execution machine, the testing apparatus includes a memory and a processor connected to the memory, the memory stores therein a processing system that is executable on the processor, and when executed by the processor, the processing system implements the following steps:
the executive machine monitors the server by controlling the client zk-client, after monitoring that the server has a test task, the client zk-client informs an agent module on the executive machine, and the agent module is controlled to try to establish an executive machine node under the task lock node by using a preset lock mechanism;
if the new establishment of the executive machine node is successful, the executive machine is successfully distributed, and the agent module obtains a test task;
if the new establishment of the executive machine node fails, the allocation of the executive machine fails, and the step of trying to establish the new executive machine node is returned;
after receiving a notification of a deployment script of the server, acquiring a script library system name in attribute information corresponding to a task node registered by the server, downloading the script in a script library corresponding to the script library system name, updating deployment state information of the script library after completing script deployment, and sending the corresponding deployment state information to the server;
and after receiving a message of the server for executing the test task, testing and constructing and executing a script to test the test task, wherein if the number of the execution machines required by the construction of the test task is two or more, the two or more execution machines execute the same script at the same time to perform concurrent scheduling.
5. The test device of claim 4, wherein the predetermined lock mechanism is an optimistic lock mechanism.
6. The testing apparatus according to claim 4, wherein the predetermined locking mechanism is a concurrent locking mechanism, and the step of controlling the agent module to newly create an execution machine node under the task lock node specifically includes:
controlling the agent module to create a temporary sequence node under the task lock node;
if the number of the temporary sequence node is the minimum number, the agent module acquires the lock and acquires the test task;
and if the number of the temporary sequence node is not the minimum number, returning to the step of creating the temporary sequence node under the task lock node after monitoring that the lock is released.
7. A server, comprising a memory and a processor coupled to the memory, the memory having stored therein a processing system operable on the processor, the processing system when executed by the processor performing the steps of:
when a test task is received, registering a task node and a task lock node through a control service module zk-server, carrying out enqueuing operation on the test task, and storing attribute information corresponding to the task node, wherein the attribute information comprises an ID code of the task node, the number of executors and a script library system name;
after an executive machine obtains a test task, recording a corresponding node name and state information under the node of the executive machine, wherein the node name is a host IP of the executive machine, the state information comprises a new success and a new failure, and if the state information is the new success, informing the executive machine to deploy a script corresponding to the test task;
and after the deployment state information of the execution machine is received, if all the deployment state information is in a deployment completion state, sending a message for executing the test task to the execution machine so as to test the test task.
8. A computer readable storage medium, having stored thereon a processing system, which when executed by a processor performs the steps of the distributed coordination based test method performed by the server according to any of claims 1 to 3, or which when executed by a processor performs the steps of the distributed coordination based test method performed by the execution machine according to any of claims 1 to 3.
CN201810876289.1A 2018-08-03 2018-08-03 Testing method, device, server and storage medium based on distributed coordination Active CN109194538B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201810876289.1A CN109194538B (en) 2018-08-03 2018-08-03 Testing method, device, server and storage medium based on distributed coordination
PCT/CN2018/107675 WO2020024405A1 (en) 2018-08-03 2018-09-26 Test method, device, server and storage medium based on distributed coordination

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810876289.1A CN109194538B (en) 2018-08-03 2018-08-03 Testing method, device, server and storage medium based on distributed coordination

Publications (2)

Publication Number Publication Date
CN109194538A CN109194538A (en) 2019-01-11
CN109194538B true CN109194538B (en) 2022-03-25

Family

ID=64920023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810876289.1A Active CN109194538B (en) 2018-08-03 2018-08-03 Testing method, device, server and storage medium based on distributed coordination

Country Status (2)

Country Link
CN (1) CN109194538B (en)
WO (1) WO2020024405A1 (en)

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109742B (en) * 2019-05-09 2020-04-28 重庆八戒电子商务有限公司 Zookeeper-based distributed task coordination method and device
CN112015632B (en) * 2019-05-29 2024-02-09 深圳兆日科技股份有限公司 Test method, device and system based on distributed architecture and storage medium
CN110456777B (en) * 2019-08-20 2022-03-18 广州小鹏汽车科技有限公司 Test method and system for vehicle controller
CN110768866B (en) * 2019-10-23 2022-04-19 通号城市轨道交通技术有限公司 Method and device for building distributed bottom layer framework
CN111045807B (en) * 2019-12-17 2024-05-14 深圳前海环融联易信息科技服务有限公司 Method, device, computer equipment and storage medium for processing task based on zookeeper
CN111400192A (en) * 2020-04-02 2020-07-10 北京达佳互联信息技术有限公司 Service program performance testing method and device, electronic equipment and storage medium
CN111858047B (en) * 2020-07-14 2024-03-22 中国工商银行股份有限公司 File interaction method, device and system
CN112671531B (en) * 2020-09-24 2023-03-07 紫光云技术有限公司 Cross-cloud persistence construction method based on Jenkins
CN114613421A (en) * 2020-12-08 2022-06-10 深圳市江波龙电子股份有限公司 Test system, test method, and computer-readable storage medium
CN112527489B (en) * 2020-12-22 2024-07-19 税友软件集团股份有限公司 Task scheduling method, device, equipment and computer readable storage medium
CN112527686A (en) * 2020-12-29 2021-03-19 平安普惠企业管理有限公司 Interface performance test method, device, equipment and storage medium
CN112698946A (en) * 2020-12-30 2021-04-23 航天信息股份有限公司 Jenkins distributed task allocation method and system
CN112988343A (en) * 2021-02-05 2021-06-18 开店宝科技集团有限公司 Batch data fragmentation method, system, computer equipment and storage medium
CN113190425B (en) * 2021-04-28 2023-09-22 北京京东振世信息技术有限公司 Resource switching method and device
CN113485908B (en) * 2021-05-25 2024-06-18 中国人民财产保险股份有限公司 Coverage rate obtaining method and device and electronic equipment
CN113220592B (en) * 2021-06-04 2024-04-30 中国农业银行股份有限公司 Processing method and device for automatic test resources, server and storage medium
CN113553162B (en) * 2021-08-09 2025-02-18 湖南酷陆网络科技有限公司 A sanitation cloud platform program running timed task management system
CN113900781B (en) * 2021-09-27 2025-02-18 浪潮云信息技术股份公司 A self-feedback task scheduling method for DevOps platform
CN114564386B (en) * 2022-02-15 2025-03-18 阿里巴巴(中国)有限公司 Method and system for processing test tasks
CN114595149A (en) * 2022-03-03 2022-06-07 平安普惠企业管理有限公司 Concurrent testing method and device for timed tasks, storage medium, and computer equipment
CN114780217B (en) * 2022-04-19 2023-05-23 湖南长银五八消费金融股份有限公司 Task scheduling method, device, computer equipment and medium
CN116380149B (en) * 2023-04-07 2024-02-02 深圳市兴源智能仪表股份有限公司 Method and system for testing rotation of instrument code wheel
CN117493030B (en) * 2023-11-20 2024-10-15 中电云计算技术有限公司 Cluster system business flow control method and system based on distributed lock

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420727A (en) * 2012-01-05 2012-04-18 北京邮电大学 Distributed protocol test system and method
CN104092591A (en) * 2014-08-04 2014-10-08 飞狐信息技术(天津)有限公司 Task monitoring method and system
CN105721582A (en) * 2016-02-22 2016-06-29 中国农业银行股份有限公司 Multi-node file backup system
CN106452830A (en) * 2016-08-22 2017-02-22 平安科技(深圳)有限公司 Test task execution machine distribution method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7702766B2 (en) * 2003-06-13 2010-04-20 Oracle America, Inc. Testing framework for communication in a distributed environment
US9942124B2 (en) * 2011-06-28 2018-04-10 Time Warner Cable Enterprises Llc Apparatus and methods for automated device testing in content distribution network
CN103064742B (en) * 2012-12-25 2016-05-11 中国科学院深圳先进技术研究院 A kind of automatic deployment system and method for hadoop cluster
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN104184823B (en) * 2014-09-05 2017-11-14 北京京东尚科信息技术有限公司 A kind of method and system for automating task scheduling
US10606651B2 (en) * 2015-04-17 2020-03-31 Microsoft Technology Licensing, Llc Free form expression accelerator with thread length-based thread assignment to clustered soft processor cores that share a functional circuit
CN107766147A (en) * 2016-08-23 2018-03-06 上海宝信软件股份有限公司 Distributed data analysis task scheduling system
CN106713458A (en) * 2016-12-23 2017-05-24 智者四海(北京)技术有限公司 Zookeeper cluster deployment method, Zookeeper cluster deployment device, Zookeeper instance deployment method, Zookeeper instance deployment device, and Zookeeper cluster management platform

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420727A (en) * 2012-01-05 2012-04-18 北京邮电大学 Distributed protocol test system and method
CN104092591A (en) * 2014-08-04 2014-10-08 飞狐信息技术(天津)有限公司 Task monitoring method and system
CN105721582A (en) * 2016-02-22 2016-06-29 中国农业银行股份有限公司 Multi-node file backup system
CN106452830A (en) * 2016-08-22 2017-02-22 平安科技(深圳)有限公司 Test task execution machine distribution method and device

Also Published As

Publication number Publication date
CN109194538A (en) 2019-01-11
WO2020024405A1 (en) 2020-02-06

Similar Documents

Publication Publication Date Title
CN109194538B (en) Testing method, device, server and storage medium based on distributed coordination
CN115292026B (en) Management method, device and equipment of container cluster and computer readable storage medium
CN111464355A (en) Method and device for controlling expansion capacity of Kubernetes container cluster and network equipment
CN109862101B (en) Cross-platform application starting method and device, computer equipment and storage medium
CN106155759B (en) Virtual machine batch creation method and device
CN105700939A (en) Method and system for multi-thread synchronization in distributed system
CN112860282B (en) Cluster plug-in upgrading method, device and server
CN112470119B (en) Service upgrade method, device and distributed system in a distributed system
CN110991127B (en) Task execution method and device, computer equipment and storage medium
CN110855746A (en) Middleware management method, electronic device and storage medium
CN110196749B (en) Virtual machine recovery method and device, storage medium and electronic device
CN112363731A (en) Application automation deployment method and device and computer readable storage medium
CN117112185B (en) Call control method and device of simulation engine and simulation system
JP2018535456A (en) System and method for starting application servers in parallel
CN114546588A (en) Task deployment method, device, storage medium, and electronic device
CN113961221A (en) Service management method based on registration center
CN108536541B (en) Process engine object processing method and device
EP4130982B1 (en) Network-based solution module deployment platform
CN116719722A (en) Automatic testing method and related device for variable networking
CN107463390B (en) Software upgrading method and upgrading server
CN116450165A (en) Method, system, terminal and storage medium for quickly building environment and deploying program
CN115268909A (en) Method, system and terminal for establishing and running construction task at web front end
CN115905271B (en) Virus library updating method and device and multi-engine detection system
CN113886215A (en) Interface test method, device and storage medium
CN113886349A (en) Billing system parameter loading and sharing method, device and computing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant