WO2020024405A1 - Test method, device, server and storage medium based on distributed coordination - Google Patents

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

Info

Publication number
WO2020024405A1
WO2020024405A1 PCT/CN2018/107675 CN2018107675W WO2020024405A1 WO 2020024405 A1 WO2020024405 A1 WO 2020024405A1 CN 2018107675 W CN2018107675 W CN 2018107675W WO 2020024405 A1 WO2020024405 A1 WO 2020024405A1
Authority
WO
WIPO (PCT)
Prior art keywords
execution
node
task
server
test
Prior art date
Application number
PCT/CN2018/107675
Other languages
French (fr)
Chinese (zh)
Inventor
林铭森
毛皓
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020024405A1 publication Critical patent/WO2020024405A1/en

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

Definitions

  • the present application relates to the field of communication technologies, and in particular, to a test method, device, server, and storage medium based on distributed coordination.
  • the host master needs to determine whether the slave of the actuator is idle and monitor the heartbeat of the slave in real time to monitor the status of the slave of the executive. There is a certain delay (5-10 seconds) in the process of monitoring the heartbeat of the slave of the executive machine. If the slave of the executive machine is down during the time gap of the heartbeat delay, the slave of the master machine is still available. The execution machine slave is still assigned, then the node construction will fail, and the execution machine slave cannot execute the test task. At this time, the test task needs to be redistributed. The state of the execution machine slave is difficult to monitor during the construction of a test, and the test task allocation process is complicated. , Resulting in inefficient execution of test tasks.
  • the purpose of this application is to provide a test method, device, server, and storage medium based on distributed coordination, which are intended to simplify the test task allocation process and improve the test task execution efficiency.
  • the present application provides a testing method based on distributed coordination, where the testing method based on distributed coordination includes:
  • the server When receiving a test task, the server registers the task node and the task lock node through the control service module zk-server, enqueues the test task, and saves the attribute information corresponding to the task node.
  • the attribute information includes a script Library system name
  • the execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine to control the agent module to use a predetermined locking mechanism in A new executor node under the task lock node registered by the server to obtain a test task;
  • the server After the execution machine obtains the test task, the server records the corresponding node name and status information under the execution machine node. If the status information is a newly created success state, the server is notified to deploy the script corresponding to the test task. ;
  • the executor After receiving the notification of the deployment script of the server, the executor obtains the script library system name in the attribute information corresponding to the task node registered by the server, and in the script library corresponding to the script library system name Download the script, and after completing the script deployment, update its own deployment status information and send the corresponding deployment status information to the server;
  • the server After the server receives the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, it sends a message to perform a test task to the execution machine;
  • the execution machine After receiving the message that the server executes a test task, the execution machine performs test construction and executes a script to test the test task.
  • the present application further provides a test device, the test device is an execution machine, the test device includes a memory and a processor connected to the memory, and the memory stores a memory that can be stored in the processor.
  • a processing system running on the server the processing system implements the following steps when executed by the processor:
  • the execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
  • test build is performed and a script is executed to test the test task.
  • the present application further provides a server.
  • the server includes a memory and a processor connected to the memory.
  • the memory stores a processing system that can run on the processor.
  • the processing system When executed by the processor, the following steps are implemented:
  • the attribute information includes the script library system name ;
  • the executor After the executor obtains the test task, the corresponding node name and status information are recorded under the executor node. If the status information is a new successful state, the executor is notified to deploy the script corresponding to the test task;
  • a message for executing a test task is sent to the execution machine to test the test task.
  • the present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a processing system, and the processing system implements steps when executed by a processor:
  • the execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
  • test build is performed and a script is executed to test the test task.
  • the present application also provides a computer-readable storage medium on which a processing system is stored.
  • a processing system is stored.
  • the steps performed by the server are implemented.
  • This application introduces zookeeper in the architecture, the client zk-client on each execution machine listens to the test task on the service module zk-server, and if there is a test task on the service module zk-server, all clients zk -client will receive a notification.
  • the client zk-client notifies its own agent module slave-agent to obtain the test task.
  • the downtime execution machine cannot obtain the test task, so that the execution machine can take the test task actively.
  • This application is provided by the service module zk. -server manages all status and operating data, and the client zk-client feeds back the information in the execution machine to the service module zk-server.
  • the test task allocation process is simple, and the execution efficiency of the test task is improved.
  • FIG. 1 is a schematic diagram of an optional application environment of each embodiment of the present application.
  • FIG. 2 is a schematic diagram of a hardware architecture of an embodiment of the server in FIG. 1.
  • FIG. 3 is a schematic diagram of a hardware architecture of an embodiment of the test apparatus in FIG. 1;
  • FIG. 4 is a schematic flowchart of an embodiment of a test method based on distributed coordination in this application.
  • FIG. 1 is a schematic diagram of an application environment of a preferred embodiment of a test method based on distributed coordination in the present application.
  • the schematic diagram of the application environment includes a server 1 and a plurality of test devices 2 (ie, execution machines).
  • the server 1 may perform data interaction with the test device 2 through a suitable technology such as a network and a near field communication technology.
  • a distributed application coordination service zookeeper is introduced into the architecture, where a service module zk-server is deployed on server 1, a client zk-client is deployed on each test device 2, and in addition, each test device 2 is deployed There is an agent module slave-agent, and the client zk-client can be encapsulated in the agent module slave-agent, or it can exist independently.
  • the service module zk-server manages all status and operating data, and the client zk-client feeds back the information in the execution machine to the service module zk-server.
  • the server 1 or the testing device 2 is a device capable of automatically performing numerical calculation and / or information processing according to an instruction set or stored in advance.
  • the server 1 or the test device 2 may be a computer, a single network server, a server group composed of multiple network servers, or a cloud based on a cloud computing composed of a large number of hosts or network servers, where the cloud computing is distributed computing A super virtual computer consisting of a group of loosely coupled computers.
  • the server 1 may include, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be communicatively connected to each other through a system bus.
  • Running processing system and service module zk-server It should be noted that FIG. 1 only shows the server 1 with components 11-13, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
  • the memory 11 includes a memory and at least one type of readable storage medium.
  • the memory provides a cache for the operation of the server 1;
  • the readable storage medium may be, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a random access memory (RAM), and a static random access memory (SRAM) ,
  • Non-volatile storage media such as read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
  • the readable storage medium may be an internal storage unit of the server 1, such as a hard disk of the server 1.
  • the non-volatile storage medium may also be an external storage device of the server 1, For example, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card (Flash card), etc. provided on the server 1.
  • the readable storage medium of the memory 11 is generally used to store an operating system and various types of application software installed in the test device 1, for example, program codes of a processing system in an embodiment of the present application.
  • the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or another data processing chip.
  • the processor 12 is generally used to control overall operations of the server 1, for example, to perform control and processing related to data interaction or communication with the test device 2.
  • the processor 12 is configured to run program code or process data stored in the memory 11, for example, to run a processing system.
  • the network interface 13 may include a wireless network interface or a wired network interface.
  • the network interface 13 is generally used to establish a communication connection between the server 1 and the test device 2.
  • the network interface 13 is mainly used to connect the server 1 with one or more test devices 2, and establish a data transmission channel and communication connection between the server 1 and one or more test devices 2.
  • the processing system and service module zk-server are stored in the memory 11 and include at least one computer-readable instruction stored in the memory 11.
  • the at least one computer-readable instruction can be executed by the processor 12 to implement each of the applications in the present application.
  • the method of the embodiment; and the at least one computer-readable instruction may be divided into different logic modules according to different functions implemented by each part thereof.
  • the test device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can be communicatively connected to each other through a system bus.
  • the memory 21 stores The processing system, client zk-client and agent module agent running on the server. It should be noted that FIG. 3 only shows the test device 2 with components 21-23, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
  • the memory 21 is similar to the memory 11 described above, the processor 22 is similar to the processor 12 described above, and the network interface 23 is similar to the network interface 13 described above, and details are not described herein again.
  • the processing system, the client zk-client, and the agent module agent are stored in the memory 21 and include at least one computer-readable instruction stored in the memory 21, and the at least one computer-readable instruction can be executed by the processor 22 to The method for implementing the embodiments of the present application; and the at least one computer-readable instruction may be divided into different logic modules according to different functions implemented by each part thereof.
  • the attribute information includes the script library system name ;
  • the executor After the executor obtains the test task, the corresponding node name and status information are recorded under the executor node. If the status information is a new successful state, the executor is notified to deploy the script corresponding to the test task;
  • a message for executing a test task is sent to the execution machine to test the test task.
  • the execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
  • test build is performed and a script is executed to test the test task.
  • the predetermined lock mechanism is an optimistic lock mechanism
  • the step of controlling the agent module to create a new execution machine node under the task lock node specifically includes:
  • the predetermined lock mechanism is a concurrent lock mechanism
  • the step of controlling the agent module to newly create an executive node under the task lock node specifically includes:
  • the agent module obtains the lock, and the agent module obtains the test task;
  • the attribute information further includes the number of execution machines, and the steps of performing test construction and executing the script specifically include: if the number of execution machines required for the construction of the test task is two or more, two Two or more executors execute the same script at the same time for concurrent scheduling.
  • This application introduces zookeeper in architecture.
  • the client zk-client on each execution machine listens to the test task on the service module zk-server. If there is a test task on the service module zk-server, all clients zk-client will receive a notification. The client zk-client notifies its agent module slave-agent to obtain the test task. The downtimed execution machine cannot obtain the test task, so that the execution machine can take the test task actively.
  • the service module zk-server manages all states and operations. The data is fed back by the client zk-client to the service module zk-server. Compared with the master-slave mode of the prior art, there is no need to monitor the status of the execution machine and test the task allocation process. It is simple and improves the execution efficiency of test tasks.
  • FIG. 4 is a schematic flowchart of an embodiment of a test method based on distributed coordination of the present application.
  • the test method based on distributed coordination includes the following steps:
  • step S1 when receiving the test task, the server registers the task node and the task lock node through the control service module zk-server, enqueues the test task, and saves the attribute information corresponding to the task node.
  • the attribute information includes Script library system name;
  • the service module zk-server when the server receives the test task, the service module zk-server first creates a root directory as a task node, and the enqueue operation is to create child nodes under this root directory, and then calculate the total number of child nodes and analyze the child nodes. Whether the total number is the same as the target number of the task queue. If it is the same, then create the root directory start node. Due to the state change of the root directory start node, the service module zk-server will notify the client zk-client of the execution machine: the task queue has been completed. At the same time, the service module zk-server also creates a new task lock node for the executive to create a new node to fetch tasks.
  • the attribute information of the registered task node includes the ID code of the task node, the number of execution machines, and the script library system name.
  • the script library system name is used to download the script from the corresponding script library.
  • step S2 the execution machine controls the client zk-client to listen to the server. After monitoring the server, the client zk-client notifies the agent module on the execution machine to control the agent module to use a predetermined lock mechanism. A new executor node under the task lock node registered by the server to obtain a test task;
  • each agent module after receiving the notification from the client zk-client, each agent module will go to the task lock node to try to create a new execution node.
  • a predetermined lock mechanism is used to create a new execution node.
  • the successful execution of the new execution node can Get the test task.
  • the executor that is down will not go to the new executor node to take the task, so there is no need to worry about whether the status of the executor is idle or available, there is no need to monitor the status of the executor, and simplify the process.
  • the optimistic locking mechanism can be used to take the test task, assuming that the number of execution machines is two:
  • the agent module of the first executor attempts to create a new executor node slave1 under the task lock node. If the new executor is successfully created, the executor is assigned successfully.
  • the agent module of the second executor tries to create a new executor node slave1 under the task lock node. If the new executor is unsuccessful, the allocation of the executor fails;
  • the agent module of the second executor attempts to create a new executor node slave2 under the task lock node. If the new executor is successfully created, the executor allocation is successful.
  • a test task may be fetched using a concurrent lock mechanism:
  • the proxy module acquires a concurrent lock, and the proxy module acquires a test task
  • the number of the temporary sequence node is not the lowest number, it means that the concurrency lock has been acquired by other executors. At this time, it is known whether the concurrency has been released by monitoring whether the lowest numbered temporary sequence node has deleted the event.
  • the lock after listening to the concurrent lock being released, returns to the step of creating a temporary sequence node under the task lock node until the numerical number of the temporary sequence node is the lowest number, which means that the concurrent lock is acquired, and the Test tasks can be obtained after concurrent locks.
  • the predetermined lock mechanism in the foregoing embodiment may be an optimistic lock mechanism or a concurrent lock mechanism, so that this embodiment supports the execution of high-concurrency and ultra-high-concurrency test tasks, which is conducive to improving test efficiency.
  • step S3 after the execution machine obtains the test task, the server records the corresponding node name and status information under the execution machine node. If the status information is a newly created success state, it informs the execution machine to deploy the corresponding test task. script;
  • the node name is the host IP of the executor
  • the status information includes the success of the new build and the failure of the new build.
  • the server monitors the status information of the execution machine under the execution machine node. If the status information is successfully created, the server is notified to deploy the script corresponding to the test task.
  • the service module zk-server of this embodiment saves the status information and data of all the execution machines, which does not need to interact with the database, which is more convenient.
  • Step S4 after receiving the notification of the deployment script of the server, the executor obtains the script library system name in the attribute information corresponding to the task node registered by the server, and the script library corresponding to the script library system name Download the script, and after completing the script deployment, update its own deployment status information and send the corresponding deployment status information to the server;
  • the execution machine downloads the script from the script library, completes the script deployment, and updates its deployment status information.
  • the deployment status information is "deployment complete” and sends the deployment status information to the server.
  • step S5 after the server receives the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, it sends a message to perform a test task to the execution machine;
  • Step S6 After receiving the message that the server executes a test task, the execution machine performs a test construction and executes a script to test the test task.
  • the execution machine performs test construction and executes a script after receiving a message from the server to execute the test tasks;
  • each execution machine receives messages from the server to execute the test task. Since the time difference between each execution machine receiving the message is small, it can be ignored. Not counting, so it can be considered that the build is triggered at the same time.
  • N identical queue tasks are submitted in sequence.
  • the execution machine that grabs the task belongs to the same build. Multiple execution machines run the same test script to achieve concurrent scheduling. Further improve test efficiency.
  • This application introduces zookeeper in architecture.
  • the client zk-client on each execution machine listens to the test task on the service module zk-server. If there is a test task on the service module zk-server, all clients zk-client will receive a notification. The client zk-client notifies its agent module slave-agent to obtain the test task. The downtimed execution machine cannot obtain the test task, so that the execution machine can take the test task actively.
  • the service module zk-server manages all states and operations. The data is fed back by the client zk-client to the service module zk-server. Compared with the master-slave mode of the prior art, there is no need to monitor the status of the execution machine and test the task allocation process. It is simple and improves the execution efficiency of test tasks.
  • the present application also provides a computer-readable storage medium on which a processing system is stored, and when the processing system is executed by a processor, the steps of the above-mentioned server-based distributed coordination testing method are implemented, Alternatively, when the processing system is executed by a processor, the steps of the test method based on distributed coordination performed by the above-mentioned execution machine are implemented.
  • the methods in the above embodiments can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware, but in many cases the former is better.
  • Implementation Based on such an understanding, the technical solution of this application that is essentially or contributes to the existing technology can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, The optical disc) includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the embodiments of the present application.
  • a terminal device which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Abstract

A test method, device, server and storage medium based on distributed coordination, the method comprising: a server registering a task node and a task lock node by means of a control service module ZK-server, entering a test task into a team operation; an executor monitoring the server by means of a control client ZK-client, and when there is a test task, the client ZK client notifying an agent module on the executor and controlling the agent module to create a new executor node under the task lock node registered at the server so as to obtain the test task; the server informing the executor to deploy a script corresponding to the test task; the executor downloading the script from a script library and sending deployment status information to the server; the server sending a message for executing the test task to the executor; the executor building the test and executing the script so as to test the test task. The present method does not require monitoring the status of the executor, and the process of test task assignment is simple, which improves the efficiency of test task execution.

Description

基于分布式协调的测试方法、装置、服务器及存储介质Test method, device, server and storage medium based on distributed coordination
优先权申明Declaration of priority
本申请基于巴黎公约申明享有2018年08月03日递交的申请号为CN201810876289.1、名称为“基于分布式协调的测试方法、装置、服务器及存储介质”中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。Based on the Paris Convention, this application claims the priority of a Chinese patent application filed on August 3, 2018 with the application number CN201810876289.1, entitled "Test method, device, server and storage medium based on distributed coordination", which is a Chinese patent The entire content of the application is incorporated in this application by reference.
技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种基于分布式协调的测试方法、装置、服务器及存储介质。The present application relates to the field of communication technologies, and in particular, to a test method, device, server, and storage medium based on distributed coordination.
背景技术Background technique
目前,Jenkins调度平台的主仆模式master-slave模式中,主机master需要判断执行机slave是否处于空闲状态,并实时监测执行机slave的心跳,以监控执行机slave的状态。监测执行机slave的心跳的过程中存在一定的延迟(5-10秒),如果在心跳延迟的时间空隙里,有执行机slave宕机,但主机master上执行机slave仍然是可用状态,这时执行机slave仍然被分配,那么将导致节点构建失败,执行机slave无法执行测试任务,这时需要重新分配测试任务,一次测试的构建过程中执行机slave的状态很难监控,测试任务分配流程复杂,导致测试任务的执行效率低。At present, in the master-slave mode of the Jenkins scheduling platform, the host master needs to determine whether the slave of the actuator is idle and monitor the heartbeat of the slave in real time to monitor the status of the slave of the executive. There is a certain delay (5-10 seconds) in the process of monitoring the heartbeat of the slave of the executive machine. If the slave of the executive machine is down during the time gap of the heartbeat delay, the slave of the master machine is still available. The execution machine slave is still assigned, then the node construction will fail, and the execution machine slave cannot execute the test task. At this time, the test task needs to be redistributed. The state of the execution machine slave is difficult to monitor during the construction of a test, and the test task allocation process is complicated. , Resulting in inefficient execution of test tasks.
发明内容Summary of the invention
本申请的目的在于提供一种基于分布式协调的测试方法、装置、服务器及存储介质,旨在简化测试任务分配流程,提高测试任务的执行效率。The purpose of this application is to provide a test method, device, server, and storage medium based on distributed coordination, which are intended to simplify the test task allocation process and improve the test task execution efficiency.
为实现上述目的,本申请提供一种基于分布式协调的测试方法,所述基于分布式协调的测试方法包括:To achieve the above objective, the present application provides a testing method based on distributed coordination, where the testing method based on distributed coordination includes:
S1,服务器在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;S1. When receiving a test task, the server registers the task node and the task lock node through the control service module zk-server, enqueues the test task, and saves the attribute information corresponding to the task node. The attribute information includes a script Library system name
S2,执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;S2. The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine to control the agent module to use a predetermined locking mechanism in A new executor node under the task lock node registered by the server to obtain a test task;
S3,所述服务器在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;S3. After the execution machine obtains the test task, the server records the corresponding node name and status information under the execution machine node. If the status information is a newly created success state, the server is notified to deploy the script corresponding to the test task. ;
S4,所述执行机在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;S4. After receiving the notification of the deployment script of the server, the executor obtains the script library system name in the attribute information corresponding to the task node registered by the server, and in the script library corresponding to the script library system name Download the script, and after completing the script deployment, update its own deployment status information and send the corresponding deployment status information to the server;
S5,所述服务器接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机;S5. After the server receives the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, it sends a message to perform a test task to the execution machine;
S6,所述执行机在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。S6. After receiving the message that the server executes a test task, the execution machine performs test construction and executes a script to test the test task.
为实现上述目的,本申请还提供一种测试装置,所述测试装置为执行机,所述测试装置包括存储器及与所述存储器连接的处理器,所述存储器中存储有可在所述处理器上运行的处理系统,所述处理系统被所述处理器执行时实现如下步骤:In order to achieve the above object, the present application further provides a test device, the test device is an execution machine, the test device includes a memory and a processor connected to the memory, and the memory stores a memory that can be stored in the processor. A processing system running on the server, the processing system implements the following steps when executed by the processor:
执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以 获取测试任务;The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;After receiving the notification of the deployment script of the server, obtain the script library system name in the attribute information corresponding to the task node registered by the server, download the script from the script library corresponding to the script library system name, and complete the process. After the script is deployed, update its own deployment status information and send the corresponding deployment status information to the server;
在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。After receiving the message that the server executes a test task, a test build is performed and a script is executed to test the test task.
为实现上述目的,本申请还提供一种服务器,所述服务器包括存储器及与所述存储器连接的处理器,所述存储器中存储有可在所述处理器上运行的处理系统,所述处理系统被所述处理器执行时实现如下步骤:In order to achieve the above object, the present application further provides a server. The server includes a memory and a processor connected to the memory. The memory stores a processing system that can run on the processor. The processing system When executed by the processor, the following steps are implemented:
在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;When receiving a test task, register the task node and task lock node through the control service module zk-server, enqueue the test task, and save the attribute information corresponding to the task node. The attribute information includes the script library system name ;
在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;After the executor obtains the test task, the corresponding node name and status information are recorded under the executor node. If the status information is a new successful state, the executor is notified to deploy the script corresponding to the test task;
接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机,以对测试任务进行测试。After receiving the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, a message for executing a test task is sent to the execution machine to test the test task.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有处理系统,所述处理系统被处理器执行时实现步骤:The present application also provides a computer-readable storage medium, where the computer-readable storage medium stores a processing system, and the processing system implements steps when executed by a processor:
执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务 节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;After receiving the notification of the deployment script of the server, obtain the script library system name in the attribute information corresponding to the task node registered by the server, download the script from the script library corresponding to the script library system name, and complete the process. After the script is deployed, update its own deployment status information and send the corresponding deployment status information to the server;
在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。After receiving the message that the server executes a test task, a test build is performed and a script is executed to test the test task.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有处理系统,所述处理系统被处理器执行时实现上述的服务器执行的步骤。The present application also provides a computer-readable storage medium on which a processing system is stored. When the processing system is executed by a processor, the steps performed by the server are implemented.
本申请的有益效果是:本申请在架构上引入了zookeeper,各执行机上的客户端zk-client监听服务模块zk-server上的测试任务,服务模块zk-server上有测试任务则所有客户端zk-client会收到通知,客户端zk-client通知自身的代理模块slave-agent去获取测试任务,宕机的执行机不能去获取测试任务,实现执行机主动取测试任务,本申请由服务模块zk-server管理所有状态和运行数据,由客户端zk-client将执行机中的信息反馈至服务模块zk-server中,相比于现有技术的主仆模式master-slave模式,不需要监控执行机的状态,测试任务分配流程简单,提高了测试任务的执行效率。The beneficial effect of this application is: This application introduces zookeeper in the architecture, the client zk-client on each execution machine listens to the test task on the service module zk-server, and if there is a test task on the service module zk-server, all clients zk -client will receive a notification. The client zk-client notifies its own agent module slave-agent to obtain the test task. The downtime execution machine cannot obtain the test task, so that the execution machine can take the test task actively. This application is provided by the service module zk. -server manages all status and operating data, and the client zk-client feeds back the information in the execution machine to the service module zk-server. Compared with the prior art master-slave mode, there is no need to monitor the execution machine. Status, the test task allocation process is simple, and the execution efficiency of the test task is improved.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1为本申请各个实施例一可选的应用环境示意图;FIG. 1 is a schematic diagram of an optional application environment of each embodiment of the present application; FIG.
图2是图1中服务器一实施例的硬件架构的示意图FIG. 2 is a schematic diagram of a hardware architecture of an embodiment of the server in FIG. 1.
图3是图1中测试装置一实施例的硬件架构的示意图;3 is a schematic diagram of a hardware architecture of an embodiment of the test apparatus in FIG. 1;
图4为本申请基于分布式协调的测试方法一实施例的流程示意图。FIG. 4 is a schematic flowchart of an embodiment of a test method based on distributed coordination in this application.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及 实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution, and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions related to "first" and "second" in this application are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. . Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but must be based on those that can be realized by a person of ordinary skill in the art. When the combination of technical solutions conflicts or cannot be achieved, it should be considered that such a combination of technical solutions does not exist. Is not within the scope of protection claimed in this application.
参阅图1所示,是本申请基于分布式协调的测试方法的较佳实施例的应用环境示意图。该应用环境示意图包括服务器1及多个测试装置2(即执行机)。服务器1可以通过网络、近场通信技术等适合的技术与测试装置2进行数据交互。在本实施例中,架构中引入分布式应用程序协调服务zookeeper,其中,在服务器1部署服务模块zk-server,在各个测试装置2中部署客户端zk-client,此外,各个测试装置2中部署有代理模块slave-agent,而客户端zk-client可以被封装到代理模块slave-agent中,也可以独立存在。由服务模块zk-server管理所有状态和运行数据,客户端zk-client将执行机中的信息反馈至服务模块zk-server中。Refer to FIG. 1, which is a schematic diagram of an application environment of a preferred embodiment of a test method based on distributed coordination in the present application. The schematic diagram of the application environment includes a server 1 and a plurality of test devices 2 (ie, execution machines). The server 1 may perform data interaction with the test device 2 through a suitable technology such as a network and a near field communication technology. In this embodiment, a distributed application coordination service zookeeper is introduced into the architecture, where a service module zk-server is deployed on server 1, a client zk-client is deployed on each test device 2, and in addition, each test device 2 is deployed There is an agent module slave-agent, and the client zk-client can be encapsulated in the agent module slave-agent, or it can exist independently. The service module zk-server manages all status and operating data, and the client zk-client feeds back the information in the execution machine to the service module zk-server.
其中,所述服务器1或测试装置2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。所述服务器1或测试装置2可以是计算机、也可以是单个网络服务器、多个网络服务器组成的服务器组或者基于云计算的由大量主机或者网络服务器构成的云,其中云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。The server 1 or the testing device 2 is a device capable of automatically performing numerical calculation and / or information processing according to an instruction set or stored in advance. The server 1 or the test device 2 may be a computer, a single network server, a server group composed of multiple network servers, or a cloud based on a cloud computing composed of a large number of hosts or network servers, where the cloud computing is distributed computing A super virtual computer consisting of a group of loosely coupled computers.
在本实施例中,如图2所示,服务器1可包括,但不仅限于,可通过系统总线相互通信连接的存储器11、处理器12、网络接口13,存储器11存储有可在处理器12上运行的处理系统及服务模块zk-server。需要指出的是,图1仅示出了具有组件11-13的服务器1,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In this 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 that can be communicatively connected to each other through a system bus. Running processing system and service module zk-server. It should be noted that FIG. 1 only shows the server 1 with components 11-13, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
其中,存储器11包括内存及至少一种类型的可读存储介质。内存为服务器1的运行提供缓存;可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等的非易失性存储介质。在一些实施例中,可读存储介质可以是服务器1的内部存储单元,例如该服务器1的硬盘;在另一些实施例中,该非易失性存储介质也可以是服务器1的外部存储设备,例如服务器1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。本实施例中,存储器11的可读存储介质通常用于存储安装于测试装置1的操作系统和各类应用软件,例如存储本申请一实施例中的处理系统的程序代码等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 11 includes a memory and at least one type of readable storage medium. The memory provides a cache for the operation of the server 1; the readable storage medium may be, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a random access memory (RAM), and a static random access memory (SRAM) , Non-volatile storage media such as read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, 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 also be an external storage device of the server 1, For example, a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash memory card (Flash card), etc. provided on the server 1. In this embodiment, the readable storage medium of the memory 11 is generally used to store an operating system and various types of application software installed in the test device 1, for example, program codes of a processing system in an embodiment of the present application. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
所述处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器12通常用于控制所述服务器1的总体操作,例如执行与所述测试装置2进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器12用于运行所述存储器11中存储的程序代码或者处理数据,例如运行处理系统等。In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or another data processing chip. The processor 12 is generally used to control overall operations of the server 1, for example, to perform control and processing related to data interaction or communication with the test device 2. In this embodiment, the processor 12 is configured to run program code or process data stored in the memory 11, for example, to run a processing system.
所述网络接口13可包括无线网络接口或有线网络接口,该网络接口13 通常用于在所述服务器1与测试装置2之间建立通信连接。本实施例中,网络接口13主要用于将服务器1与一个或多个测试装置2相连,在服务器1与一个或多个测试装置2之间建立数据传输通道和通信连接。The network interface 13 may include a wireless network interface or a wired network interface. The network interface 13 is generally used to establish a communication connection between the server 1 and the test device 2. In this embodiment, the network interface 13 is mainly used to connect the server 1 with one or more test devices 2, and establish a data transmission channel and communication connection between the server 1 and one or more test devices 2.
所述处理系统及服务模块zk-server存储在存储器11中,包括至少一个存储在存储器11中的计算机可读指令,该至少一个计算机可读指令可被处理器器12执行,以实现本申请各实施例的方法;以及,该至少一个计算机可读指令依据其各部分所实现的功能不同,可被划为不同的逻辑模块。The processing system and service module zk-server are stored in the memory 11 and include at least one computer-readable instruction stored in the memory 11. The at least one computer-readable instruction can be executed by the processor 12 to implement each of the applications in the present application. The method of the embodiment; and the at least one computer-readable instruction may be divided into different logic modules according to different functions implemented by each part thereof.
在本实施例中,如图3所示,测试装置2可包括,但不仅限于,可通过系统总线相互通信连接的存储器21、处理器22、网络接口23,存储器21存储有可在处理器22上运行的处理系统、客户端zk-client及代理模块agent。需要指出的是,图3仅示出了具有组件21-23的测试装置2,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。In this embodiment, as shown in FIG. 3, the test device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can be communicatively connected to each other through a system bus. The memory 21 stores The processing system, client zk-client and agent module agent running on the server. It should be noted that FIG. 3 only shows the test device 2 with components 21-23, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
其中,存储器21与上述的存储器11类似、处理器22与上述的处理器12类似,网络接口23与上述的网络接口13类似,此处不再赘述。所述处理系统、客户端zk-client及代理模块agent存储在存储器21中,包括至少一个存储在存储器21中的计算机可读指令,该至少一个计算机可读指令可被处理器器22执行,以实现本申请各实施例的方法;以及,该至少一个计算机可读指令依据其各部分所实现的功能不同,可被划为不同的逻辑模块。The memory 21 is similar to the memory 11 described above, the processor 22 is similar to the processor 12 described above, and the network interface 23 is similar to the network interface 13 described above, and details are not described herein again. The processing system, the client zk-client, and the agent module agent are stored in the memory 21 and include at least one computer-readable instruction stored in the memory 21, and the at least one computer-readable instruction can be executed by the processor 22 to The method for implementing the embodiments of the present application; and the at least one computer-readable instruction may be divided into different logic modules according to different functions implemented by each part thereof.
在一实施例中,上述处理系统被所述处理器12执行时实现如下步骤:In an embodiment, when the processing system is executed by the processor 12, the following steps are implemented:
在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;When receiving a test task, register the task node and task lock node through the control service module zk-server, enqueue the test task, and save the attribute information corresponding to the task node. The attribute information includes the script library system name ;
在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;After the executor obtains the test task, the corresponding node name and status information are recorded under the executor node. If the status information is a new successful state, the executor is notified to deploy the script corresponding to the test task;
接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机,以对测试任务进行测试。After receiving the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, a message for executing a test task is sent to the execution machine to test the test task.
在另一实施例中,上述处理系统被所述处理器22执行时实现如下步骤:In another embodiment, when the processing system is executed by the processor 22, the following steps are implemented:
执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;After receiving the notification of the deployment script of the server, obtain the script library system name in the attribute information corresponding to the task node registered by the server, download the script from the script library corresponding to the script library system name, and complete the process. After the script is deployed, update its own deployment status information and send the corresponding deployment status information to the server;
在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。After receiving the message that the server executes a test task, a test build is performed and a script is executed to test the test task.
进一步地,所述预定的锁机制为乐观锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:Further, the predetermined lock mechanism is an optimistic lock mechanism, and the step of controlling the agent module to create a new execution machine node under the task lock node specifically includes:
控制该代理模块在该任务锁节点下尝试新建执行机节点;Control the agent module to try to create a new execution machine node under the task lock node;
若新建执行机节点成功,则分配执行机成功,该代理模块获取测试任务;If the new execution of the execution node is successful, the execution of the execution of the execution node is successful, and the agent module obtains the test task;
若新建执行机节点失败,则分配执行机失败,返回执行尝试新建执行机节点的步骤。If the execution of the new execution node fails, the allocation of the execution fails, and the execution returns to the step of trying to create a new execution node.
进一步地,所述预定的锁机制为并发锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:Further, the predetermined lock mechanism is a concurrent lock mechanism, and the step of controlling the agent module to newly create an executive node under the task lock node specifically includes:
控制该代理模块在该任务锁节点下创建临时顺序节点;Control the agent module to create a temporary sequence node under the task lock node;
若该临时顺序节点的数字编号是最小的数字编号,则该代理模块获取到锁,该代理模块获取测试任务;If the number of the temporary sequence node is the smallest number, the agent module obtains the lock, and the agent module obtains the test task;
若该临时顺序节点的数字编号不是最小的数字编号,则在监听到锁被释 放后,返回执行在该任务锁节点下创建临时顺序节点的步骤。If the number of the temporary sequence node is not the lowest number, after monitoring the release of the lock, return to the step of creating a temporary sequence node under the task lock node.
进一步地,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两个及两个以上,则两个及两个以上的执行机同时执行同一脚本,以进行并发调度。Further, the attribute information further includes the number of execution machines, and the steps of performing test construction and executing the script specifically include: if the number of execution machines required for the construction of the test task is two or more, two Two or more executors execute the same script at the same time for concurrent scheduling.
本申请在架构上引入了zookeeper,各执行机上的客户端zk-client监听服务模块zk-server上的测试任务,服务模块zk-server上有测试任务则所有客户端zk-client会收到通知,客户端zk-client通知自身的代理模块slave-agent去获取测试任务,宕机的执行机不能去获取测试任务,实现执行机主动取测试任务,本申请由服务模块zk-server管理所有状态和运行数据,由客户端zk-client将执行机中的信息反馈至服务模块zk-server中,相比于现有技术的主仆模式master-slave模式,不需要监控执行机的状态,测试任务分配流程简单,提高了测试任务的执行效率。This application introduces zookeeper in architecture. The client zk-client on each execution machine listens to the test task on the service module zk-server. If there is a test task on the service module zk-server, all clients zk-client will receive a notification. The client zk-client notifies its agent module slave-agent to obtain the test task. The downtimed execution machine cannot obtain the test task, so that the execution machine can take the test task actively. In this application, the service module zk-server manages all states and operations. The data is fed back by the client zk-client to the service module zk-server. Compared with the master-slave mode of the prior art, there is no need to monitor the status of the execution machine and test the task allocation process. It is simple and improves the execution efficiency of test tasks.
如图4所示,图4为本申请基于分布式协调的测试方法一实施例的流程示意图,该基于分布式协调的测试方法包括以下步骤:As shown in FIG. 4, FIG. 4 is a schematic flowchart of an embodiment of a test method based on distributed coordination of the present application. The test method based on distributed coordination includes the following steps:
步骤S1,服务器在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;In step S1, when receiving the test task, the server registers the task node and the task lock node through the control service module zk-server, enqueues the test task, and saves the attribute information corresponding to the task node. The attribute information includes Script library system name;
其中,服务器在接收到测试任务时,服务模块zk-server首先创建一个根目录,做为任务节点,入队操作就是在这个根目录下创建子节点,然后计算子节点的总数,分析子节点的总数是否和任务队列的目标数量相同。如果相同,再创建根目录start节点,由于根目录start这个节点有了状态变化,服务模块zk-server就会通知执行机的客户端zk-client:任务队列已经到齐。同时,服务模块zk-server还新建一个任务锁节点,供执行机新建节点来取任务。Among them, when the server receives the test task, the service module zk-server first creates a root directory as a task node, and the enqueue operation is to create child nodes under this root directory, and then calculate the total number of child nodes and analyze the child nodes. Whether the total number is the same as the target number of the task queue. If it is the same, then create the root directory start node. Due to the state change of the root directory start node, the service module zk-server will notify the client zk-client of the execution machine: the task queue has been completed. At the same time, the service module zk-server also creates a new task lock node for the executive to create a new node to fetch tasks.
此外,注册任务节点的属性信息包括任务节点的ID码、执行机数量、 脚本库系统名称,脚本库系统名称用于从对应的脚本库中下载脚本。In addition, the attribute information of the registered task node includes the ID code of the task node, the number of execution machines, and the script library system name. The script library system name is used to download the script from the corresponding script library.
步骤S2,执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;In step S2, the execution machine controls the client zk-client to listen to the server. After monitoring the server, the client zk-client notifies the agent module on the execution machine to control the agent module to use a predetermined lock mechanism. A new executor node under the task lock node registered by the server to obtain a test task;
其中,各个代理模块在接到客户端zk-client的通知后,会去任务锁节点下尝试新建执行机节点,其中,利用预定的锁机制新建执行机节点,新建执行机节点成功的执行机能够获取到测试任务。在该过程中,宕机的执行机是不会去新建执行机节点来取任务的,所以无需关心执行机状态是否处于空闲可用状态,无需监控执行机的状态,简化流程。Among them, after receiving the notification from the client zk-client, each agent module will go to the task lock node to try to create a new execution node. Among them, a predetermined lock mechanism is used to create a new execution node. The successful execution of the new execution node can Get the test task. In this process, the executor that is down will not go to the new executor node to take the task, so there is no need to worry about whether the status of the executor is idle or available, there is no need to monitor the status of the executor, and simplify the process.
在一实施例中,可以使用乐观锁机制取测试任务,假设执行机的数量为2台:In one embodiment, the optimistic locking mechanism can be used to take the test task, assuming that the number of execution machines is two:
首先,第一台执行机的代理模块在任务锁节点下尝试新建执行机节点slave1,新建成功,则分配执行机成功;First, the agent module of the first executor attempts to create a new executor node slave1 under the task lock node. If the new executor is successfully created, the executor is assigned successfully.
第二台执行机的代理模块在任务锁节点下尝试新建执行机节点slave1,新建不成功,则分配执行机失败;The agent module of the second executor tries to create a new executor node slave1 under the task lock node. If the new executor is unsuccessful, the allocation of the executor fails;
然后,第二台执行机的代理模块在任务锁节点下尝试新建执行机节点slave2,新建成功,则分配执行机成功。Then, the agent module of the second executor attempts to create a new executor node slave2 under the task lock node. If the new executor is successfully created, the executor allocation is successful.
在另一实施例中,可以使用并发锁机制取测试任务:In another embodiment, a test task may be fetched using a concurrent lock mechanism:
控制该代理模块在该任务锁节点下创建临时顺序节点,同一时刻只会有一台执行机获取到任务的并发锁;Control the agent module to create a temporary sequence node under the task lock node. Only one executor can acquire the concurrent lock of the task at the same time.
若该临时顺序节点的数字编号是最小的数字编号,即排在第一位的是最先创建的临时顺序节点,则该代理模块获取到并发锁,该代理模块获取测试任务;If the number of the temporary sequence node is the lowest number, that is, the first created temporary sequence node is the first, the proxy module acquires a concurrent lock, and the proxy module acquires a test task;
若该临时顺序节点的数字编号不是最小的数字编号,则表示并发锁已经 被其他的执行机获取到,此时就通过监听最小的数字编号的临时顺序节点是否删除事件来获知是否已经释放了并发锁,在监听到并发锁被释放后,返回执行在该任务锁节点下创建临时顺序节点的步骤,直至该临时顺序节点的数字编号是最小的数字编号,此时表示获取到了并发锁,获取到并发锁后即可获取到测试任务。If the number of the temporary sequence node is not the lowest number, it means that the concurrency lock has been acquired by other executors. At this time, it is known whether the concurrency has been released by monitoring whether the lowest numbered temporary sequence node has deleted the event. The lock, after listening to the concurrent lock being released, returns to the step of creating a temporary sequence node under the task lock node until the numerical number of the temporary sequence node is the lowest number, which means that the concurrent lock is acquired, and the Test tasks can be obtained after concurrent locks.
上述实施例中预定的锁机制可以为乐观锁机制或者并发锁机制,使得本实施例支持高并发及超高并发测试任务的执行,有利于提高测试效率。The predetermined lock mechanism in the foregoing embodiment may be an optimistic lock mechanism or a concurrent lock mechanism, so that this embodiment supports the execution of high-concurrency and ultra-high-concurrency test tasks, which is conducive to improving test efficiency.
步骤S3,所述服务器在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;In step S3, after the execution machine obtains the test task, the server records the corresponding node name and status information under the execution machine node. If the status information is a newly created success state, it informs the execution machine to deploy the corresponding test task. script;
其中,节点名称为执行机的主机IP,状态信息包括新建成功、新建失败。服务器监测执行机节点下执行机的状态信息,如果状态信息均为新建成功,则通知执行机部署该测试任务对应的脚本。Among them, the node name is the host IP of the executor, and the status information includes the success of the new build and the failure of the new build. The server monitors the status information of the execution machine under the execution machine node. If the status information is successfully created, the server is notified to deploy the script corresponding to the test task.
此外,现有技术中需要将执行机的状态信息及数据等保存至数据库中,而本实施例服务模块zk-server保存所有的执行机的状态信息及数据,无需与数据库进行交互,更加方便。In addition, in the prior art, it is necessary to save the status information and data of the execution machines to the database, and the service module zk-server of this embodiment saves the status information and data of all the execution machines, which does not need to interact with the database, which is more convenient.
步骤S4,所述执行机在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;Step S4, after receiving the notification of the deployment script of the server, the executor obtains the script library system name in the attribute information corresponding to the task node registered by the server, and the script library corresponding to the script library system name Download the script, and after completing the script deployment, update its own deployment status information and send the corresponding deployment status information to the server;
其中,执行机从脚本库中下载脚本,完成脚本部署,更新自身的部署状态信息,该部署状态信息为“部署完成”,将部署状态信息发送给服务器。The execution machine downloads the script from the script library, completes the script deployment, and updates its deployment status information. The deployment status information is "deployment complete" and sends the deployment status information to the server.
步骤S5,所述服务器接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机;In step S5, after the server receives the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, it sends a message to perform a test task to the execution machine;
步骤S6,所述执行机在接收到所述服务器的执行测试任务的消息后, 进行测试构建并执行脚本,以对所述测试任务进行测试。Step S6: After receiving the message that the server executes a test task, the execution machine performs a test construction and executes a script to test the test task.
其中,如果本次测试任务构建需要的执行机的数量为一台,则该执行机在接收到服务器的执行测试任务的消息后,进行测试构建并执行脚本;Among them, if the number of execution machines required for this test task construction is one, the execution machine performs test construction and executes a script after receiving a message from the server to execute the test tasks;
如果若本次测试任务构建需要的执行机的数量为两台及两台以上,则每台执行机接收服务器的执行测试任务的消息,由于每台执行机收到消息的时间差较小,可忽略不计,因此可以认为是同时触发构建的,构建测试任务时会顺序提交N个相同的队列任务,抢到任务的执行机属于同一次构建,多台执行机上运行同一个测试脚本,实现并发调度,进一步提高测试效率。If the number of execution machines required for the construction of this test task is two or more, each execution machine receives messages from the server to execute the test task. Since the time difference between each execution machine receiving the message is small, it can be ignored. Not counting, so it can be considered that the build is triggered at the same time. When the test task is built, N identical queue tasks are submitted in sequence. The execution machine that grabs the task belongs to the same build. Multiple execution machines run the same test script to achieve concurrent scheduling. Further improve test efficiency.
本申请在架构上引入了zookeeper,各执行机上的客户端zk-client监听服务模块zk-server上的测试任务,服务模块zk-server上有测试任务则所有客户端zk-client会收到通知,客户端zk-client通知自身的代理模块slave-agent去获取测试任务,宕机的执行机不能去获取测试任务,实现执行机主动取测试任务,本申请由服务模块zk-server管理所有状态和运行数据,由客户端zk-client将执行机中的信息反馈至服务模块zk-server中,相比于现有技术的主仆模式master-slave模式,不需要监控执行机的状态,测试任务分配流程简单,提高了测试任务的执行效率。This application introduces zookeeper in architecture. The client zk-client on each execution machine listens to the test task on the service module zk-server. If there is a test task on the service module zk-server, all clients zk-client will receive a notification. The client zk-client notifies its agent module slave-agent to obtain the test task. The downtimed execution machine cannot obtain the test task, so that the execution machine can take the test task actively. In this application, the service module zk-server manages all states and operations. The data is fed back by the client zk-client to the service module zk-server. Compared with the master-slave mode of the prior art, there is no need to monitor the status of the execution machine and test the task allocation process. It is simple and improves the execution efficiency of test tasks.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有处理系统,所述处理系统被处理器执行时实现上述的服务器执行的基于分布式协调的测试方法的步骤,或者处理系统被处理器执行时实现上述的执行机执行的基于分布式协调的测试方法的步骤。The present application also provides a computer-readable storage medium on which a processing system is stored, and when the processing system is executed by a processor, the steps of the above-mentioned server-based distributed coordination testing method are implemented, Alternatively, when the processing system is executed by a processor, the steps of the test method based on distributed coordination performed by the above-mentioned execution machine are implemented.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are merely for description, and do not represent the superiority or inferiority of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式 体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods in the above embodiments can be implemented by means of software plus a necessary universal hardware platform, and of course, also by hardware, but in many cases the former is better. Implementation. Based on such an understanding, the technical solution of this application that is essentially or contributes to the existing technology can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, The optical disc) includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the embodiments of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the description and drawings of the present application, or directly or indirectly used in other related technical fields Are included in the scope of patent protection of this application.

Claims (20)

  1. 一种基于分布式协调的测试方法,其特征在于,所述基于分布式协调的测试方法包括:A testing method based on distributed coordination is characterized in that the testing method based on distributed coordination includes:
    S1,服务器在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;S1. When receiving a test task, the server registers the task node and the task lock node through the control service module zk-server, enqueues the test task, and saves the attribute information corresponding to the task node. The attribute information includes a script Library system name
    S2,执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;S2. The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine to control the agent module to use a predetermined locking mechanism in A new executor node under the task lock node registered by the server to obtain a test task;
    S3,所述服务器在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;S3. After the execution machine obtains the test task, the server records the corresponding node name and status information under the execution machine node. If the status information is a newly created success state, the server is notified to deploy the script corresponding to the test task. ;
    S4,所述执行机在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;S4. After receiving the notification of the deployment script of the server, the executor obtains the script library system name in the attribute information corresponding to the task node registered by the server, and in the script library corresponding to the script library system name Download the script, and after completing the script deployment, update its own deployment status information and send the corresponding deployment status information to the server;
    S5,所述服务器接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机;S5. After the server receives the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, it sends a message to perform a test task to the execution machine;
    S6,所述执行机在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。S6. After receiving the message that the server executes a test task, the execution machine performs test construction and executes a script to test the test task.
  2. 根据权利要求1所述的基于分布式协调的测试方法,其特征在于,所述预定的锁机制为乐观锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The testing method based on distributed coordination according to claim 1, wherein the predetermined lock mechanism is an optimistic lock mechanism, and the step of controlling the agent module to newly create an executive node under the task lock node, specifically include:
    控制该代理模块在该任务锁节点下尝试新建执行机节点;Control the agent module to try to create a new execution machine node under the task lock node;
    若新建执行机节点成功,则分配执行机成功,该代理模块获取测试任务;If the new execution of the execution node is successful, the execution of the execution of the execution node is successful, and the agent module obtains the test task;
    若新建执行机节点失败,则分配执行机失败,返回执行尝试新建执行机节点的步骤。If the execution of the new execution node fails, the allocation of the execution fails, and the execution returns to the step of trying to create a new execution node.
  3. 根据权利要求1所述的基于分布式协调的测试方法,其特征在于,所述预定的锁机制为并发锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The testing method based on distributed coordination according to claim 1, wherein the predetermined lock mechanism is a concurrent lock mechanism, and the step of controlling the agent module to newly create an executive node under the task lock node, specifically include:
    控制该代理模块在该任务锁节点下创建临时顺序节点;Control the agent module to create a temporary sequence node under the task lock node;
    若该临时顺序节点的数字编号是最小的数字编号,则该代理模块获取到锁,该代理模块获取测试任务;If the number of the temporary sequence node is the smallest number, the agent module obtains the lock, and the agent module obtains the test task;
    若该临时顺序节点的数字编号不是最小的数字编号,则在监听到锁被释放后,返回执行在该任务锁节点下创建临时顺序节点的步骤。If the number of the temporary sequence node is not the lowest number, then after listening to the lock being released, return to execute the step of creating a temporary sequence node under the task lock node.
  4. 根据权利要求1所述的基于分布式协调的测试方法,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The testing method based on distributed coordination according to claim 1, wherein the attribute information further includes a number of execution machines, and the steps of performing test construction and executing a script specifically include: The number of required execution machines is two or more, then two or more execution machines execute the same script at the same time for concurrent scheduling.
  5. 根据权利要求2所述的基于分布式协调的测试方法,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The testing method based on distributed coordination according to claim 2, wherein the attribute information further includes a number of execution machines, and the steps of performing test construction and executing a script specifically include: The number of required execution machines is two or more, then two or more execution machines execute the same script at the same time for concurrent scheduling.
  6. 根据权利要求3所述的基于分布式协调的测试方法,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The testing method based on distributed coordination according to claim 3, wherein the attribute information further includes a number of execution machines, and the steps of performing test construction and executing a script specifically include: The number of required execution machines is two or more, then two or more execution machines execute the same script at the same time for concurrent scheduling.
  7. 一种测试装置,其特征在于,所述测试装置为执行机,所述测试装置包括存储器及与所述存储器连接的处理器,所述存储器中存储有可在所述处 理器上运行的处理系统,所述处理系统被所述处理器执行时实现如下步骤:A test device, characterized in that the test device is an execution machine, the test device includes a memory and a processor connected to the memory, and the memory stores a processing system operable on the processor. , When the processing system is executed by the processor, the following steps are implemented:
    执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
    在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;After receiving the notification of the deployment script of the server, obtain the script library system name in the attribute information corresponding to the task node registered by the server, download the script from the script library corresponding to the script library system name, and complete the process. After the script is deployed, update its own deployment status information and send the corresponding deployment status information to the server;
    在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。After receiving the message that the server executes a test task, a test build is performed and a script is executed to test the test task.
  8. 根据权利要求7所述的测试装置,其特征在于,所述预定的锁机制为乐观锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The test device according to claim 7, wherein the predetermined lock mechanism is an optimistic lock mechanism, and the step of controlling the agent module to newly create an executive node under the task lock node specifically includes:
    控制该代理模块在该任务锁节点下尝试新建执行机节点;Control the agent module to try to create a new execution machine node under the task lock node;
    若新建执行机节点成功,则分配执行机成功,该代理模块获取测试任务;If the new execution of the execution node is successful, the execution of the execution of the execution node is successful, and the agent module obtains the test task;
    若新建执行机节点失败,则分配执行机失败,返回执行尝试新建执行机节点的步骤。If the execution of the new execution node fails, the allocation of the execution fails, and the execution returns to the step of trying to create a new execution node.
  9. 根据权利要求7所述的测试装置,其特征在于,所述预定的锁机制为并发锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The test device according to claim 7, wherein the predetermined lock mechanism is a concurrent lock mechanism, and the step of controlling the agent module to newly create an executive node under the task lock node specifically includes:
    控制该代理模块在该任务锁节点下创建临时顺序节点;Control the agent module to create a temporary sequence node under the task lock node;
    若该临时顺序节点的数字编号是最小的数字编号,则该代理模块获取到锁,该代理模块获取测试任务;If the number of the temporary sequence node is the smallest number, the agent module obtains the lock, and the agent module obtains the test task;
    若该临时顺序节点的数字编号不是最小的数字编号,则在监听到锁被释 放后,返回执行在该任务锁节点下创建临时顺序节点的步骤。If the number of the temporary sequence node is not the lowest number, after monitoring the release of the lock, return to the step of creating a temporary sequence node under the task lock node.
  10. 根据权利要求7所述的测试装置,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The test device according to claim 7, wherein the attribute information further includes a number of execution machines, and the step of performing test construction and executing a script specifically includes: if the execution machine required for the current test task construction If the number is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  11. 根据权利要求8所述的测试装置,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The testing device according to claim 8, wherein the attribute information further includes a number of execution machines, and the step of performing test construction and executing a script specifically includes: if the execution machine required for the current test task construction If the number is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  12. 根据权利要求9所述的测试装置,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The test device according to claim 9, wherein the attribute information further includes the number of execution machines, and the step of performing test construction and executing the script specifically includes: if the execution machine required for the current test task construction If the number is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  13. 一种服务器,其特征在于,所述服务器包括存储器及与所述存储器连接的处理器,所述存储器中存储有可在所述处理器上运行的处理系统,所述处理系统被所述处理器执行时实现如下步骤:A server, characterized in that the server includes a memory and a processor connected to the memory, the memory stores a processing system operable on the processor, and the processing system is processed by the processor Implement the following steps during execution:
    在接收到测试任务时,通过控制服务模块zk-server注册任务节点及任务锁节点,将测试任务进行入队操作,并保存所述任务节点对应的属性信息,所述属性信息包括脚本库系统名称;When receiving a test task, register the task node and task lock node through the control service module zk-server, enqueue the test task, and save the attribute information corresponding to the task node. The attribute information includes the script library system name ;
    在执行机获取测试任务后,在该执行机节点下记录相应的节点名称及状态信息,若该状态信息均为新建成功状态,则通知所述执行机部署测试任务对应的脚本;After the executor obtains the test task, the corresponding node name and status information are recorded under the executor node. If the status information is a new successful state, the executor is notified to deploy the script corresponding to the test task;
    接收到所述执行机的部署状态信息后,若所有的部署状态信息为部署完成状态,则发送执行测试任务的消息给所述执行机,以对测试任务进行测试。After receiving the deployment status information of the execution machine, if all the deployment status information is the deployment completion status, a message for executing a test task is sent to the execution machine to test the test task.
  14. 一种计算机可读存储介质,其特征在于,所述处理系统被处理器执行 时实现步骤:A computer-readable storage medium, characterized in that, when the processing system is executed by a processor, the steps are implemented:
    执行机通过控制客户端zk-client监听服务器,在监听到所述服务器上有测试任务后,由客户端zk-client通知该执行机上的代理模块,控制该代理模块利用预定的锁机制在所述服务器注册的任务锁节点下新建执行机节点,以获取测试任务;The execution machine controls the client zk-client to listen to the server. After listening to a test task on the server, the client zk-client notifies the agent module on the execution machine, and controls the agent module to use a predetermined locking mechanism in the server. Create a new execution node under the task lock node registered by the server to obtain the test task;
    在接收到所述服务器的部署脚本的通知后,获取所述服务器注册的任务节点对应的属性信息中的脚本库系统名称,在所述脚本库系统名称对应的脚本库中下载脚本,并在完成脚本部署后,更新自身的部署状态信息,将对应的部署状态信息发送给所述服务器;After receiving the notification of the deployment script of the server, obtain the script library system name in the attribute information corresponding to the task node registered by the server, download the script from the script library corresponding to the script library system name, and complete the process. After the script is deployed, update its own deployment status information and send the corresponding deployment status information to the server;
    在接收到所述服务器的执行测试任务的消息后,进行测试构建并执行脚本,以对所述测试任务进行测试。After receiving the message that the server executes a test task, a test build is performed and a script is executed to test the test task.
  15. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述预定的锁机制为乐观锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The computer-readable storage medium according to claim 14, wherein the predetermined lock mechanism is an optimistic lock mechanism, and the step of controlling the agent module to create a new execution machine node under the task lock node specifically includes:
    控制该代理模块在该任务锁节点下尝试新建执行机节点;Control the agent module to try to create a new execution machine node under the task lock node;
    若新建执行机节点成功,则分配执行机成功,该代理模块获取测试任务;If the new execution of the execution node is successful, the execution of the execution of the execution node is successful, and the agent module obtains the test task;
    若新建执行机节点失败,则分配执行机失败,返回执行尝试新建执行机节点的步骤。If the execution of the new execution node fails, the allocation of the execution fails, and the execution returns to the step of trying to create a new execution node.
  16. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述预定的锁机制为并发锁机制,所述控制该代理模块在该任务锁节点下新建执行机节点的步骤,具体包括:The computer-readable storage medium according to claim 14, wherein the predetermined lock mechanism is a concurrent lock mechanism, and the step of controlling the agent module to create a new execution machine node under the task lock node specifically includes:
    控制该代理模块在该任务锁节点下创建临时顺序节点;Control the agent module to create a temporary sequence node under the task lock node;
    若该临时顺序节点的数字编号是最小的数字编号,则该代理模块获取到锁,该代理模块获取测试任务;If the number of the temporary sequence node is the smallest number, the agent module obtains the lock, and the agent module obtains the test task;
    若该临时顺序节点的数字编号不是最小的数字编号,则在监听到锁被释 放后,返回执行在该任务锁节点下创建临时顺序节点的步骤。If the number of the temporary sequence node is not the lowest number, after monitoring the release of the lock, return to the step of creating a temporary sequence node under the task lock node.
  17. 根据权利要求14所述的计算机可读存储介质,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The computer-readable storage medium according to claim 14, wherein the attribute information further includes a number of execution machines, and the steps of performing test construction and executing a script specifically include: If the number of execution machines is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  18. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The computer-readable storage medium according to claim 15, wherein the attribute information further includes a number of execution machines, and the steps of performing test construction and executing a script specifically include: If the number of execution machines is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  19. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述属性信息还包括执行机的数量,所述进行测试构建并执行脚本的步骤,具体包括:若本次测试任务构建需要的执行机的数量为两台及两台以上,则两台及两台以上的执行机同时执行同一脚本,以进行并发调度。The computer-readable storage medium according to claim 16, wherein the attribute information further includes the number of execution machines, and the steps of performing test construction and executing a script specifically include: If the number of execution machines is two or more, two or more execution machines execute the same script at the same time for concurrent scheduling.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有处理系统,所述处理系统被处理器执行时实现如权利要求13所述的步骤。A computer-readable storage medium, characterized in that a processing system is stored on the computer-readable storage medium, and the step of claim 13 is implemented when the processing system is executed by a processor.
PCT/CN2018/107675 2018-08-03 2018-09-26 Test method, device, server and storage medium based on distributed coordination WO2020024405A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

Publication Number Publication Date
WO2020024405A1 true WO2020024405A1 (en) 2020-02-06

Family

ID=64920023

Family Applications (1)

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

Country Status (2)

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

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400192A (en) * 2020-04-02 2020-07-10 北京达佳互联信息技术有限公司 Service program performance testing method and device, electronic equipment and storage medium
CN111858047A (en) * 2020-07-14 2020-10-30 中国工商银行股份有限公司 File interaction method, device and system
CN112527489A (en) * 2020-12-22 2021-03-19 税友软件集团股份有限公司 Task scheduling method, device and equipment and computer readable storage medium
CN112671531A (en) * 2020-09-24 2021-04-16 紫光云技术有限公司 Cross-cloud persistence construction method based on Jenkins
CN112988343A (en) * 2021-02-05 2021-06-18 开店宝科技集团有限公司 Batch data fragmentation method, system, computer equipment and storage medium
CN113190425A (en) * 2021-04-28 2021-07-30 北京京东振世信息技术有限公司 Resource switching method and device
CN113220592A (en) * 2021-06-04 2021-08-06 中国农业银行股份有限公司 Processing method and device for automated testing resources, server and storage medium
CN114780217A (en) * 2022-04-19 2022-07-22 湖南长银五八消费金融股份有限公司 Task scheduling method and device, computer equipment and medium
CN116380149A (en) * 2023-04-07 2023-07-04 深圳市兴源智能仪表股份有限公司 Method and system for testing rotation of instrument code wheel
CN113220592B (en) * 2021-06-04 2024-04-30 中国农业银行股份有限公司 Processing method and device for automatic test resources, server and storage medium

Families Citing this family (5)

* 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 of vehicle controller
CN110768866B (en) * 2019-10-23 2022-04-19 通号城市轨道交通技术有限公司 Method and device for building distributed bottom layer framework
CN111045807A (en) * 2019-12-17 2020-04-21 深圳前海环融联易信息科技服务有限公司 Zookeeper task processing method and device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064742A (en) * 2012-12-25 2013-04-24 中国科学院深圳先进技术研究院 Automatic deployment system and method of hadoop cluster
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
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
US20160306772A1 (en) * 2015-04-17 2016-10-20 Microsoft Technology Licensing, Llc Systems and methods for executing software threads using soft processors
CN106452830A (en) * 2016-08-22 2017-02-22 平安科技(深圳)有限公司 Test task execution machine distribution method and device
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

Family Cites Families (5)

* 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
CN102420727A (en) * 2012-01-05 2012-04-18 北京邮电大学 Distributed protocol test system and method
CN104184823B (en) * 2014-09-05 2017-11-14 北京京东尚科信息技术有限公司 A kind of method and system for automating task scheduling
CN107766147A (en) * 2016-08-23 2018-03-06 上海宝信软件股份有限公司 Distributed data analysis task scheduling system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064742A (en) * 2012-12-25 2013-04-24 中国科学院深圳先进技术研究院 Automatic deployment system and method of hadoop cluster
CN103744724A (en) * 2014-02-19 2014-04-23 互联网域名系统北京市工程研究中心有限公司 Timed task clustering method and device thereof
CN104092591A (en) * 2014-08-04 2014-10-08 飞狐信息技术(天津)有限公司 Task monitoring method and system
US20160306772A1 (en) * 2015-04-17 2016-10-20 Microsoft Technology Licensing, Llc Systems and methods for executing software threads using soft processors
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
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

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400192A (en) * 2020-04-02 2020-07-10 北京达佳互联信息技术有限公司 Service program performance testing method and device, electronic equipment and storage medium
CN111858047A (en) * 2020-07-14 2020-10-30 中国工商银行股份有限公司 File interaction method, device and system
CN111858047B (en) * 2020-07-14 2024-03-22 中国工商银行股份有限公司 File interaction method, device and system
CN112671531A (en) * 2020-09-24 2021-04-16 紫光云技术有限公司 Cross-cloud persistence construction method based on Jenkins
CN112671531B (en) * 2020-09-24 2023-03-07 紫光云技术有限公司 Cross-cloud persistence construction method based on Jenkins
CN112527489A (en) * 2020-12-22 2021-03-19 税友软件集团股份有限公司 Task scheduling method, device and equipment and computer readable storage medium
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
CN113190425A (en) * 2021-04-28 2021-07-30 北京京东振世信息技术有限公司 Resource switching method and device
CN113220592A (en) * 2021-06-04 2021-08-06 中国农业银行股份有限公司 Processing method and device for automated testing resources, server and storage medium
CN113220592B (en) * 2021-06-04 2024-04-30 中国农业银行股份有限公司 Processing method and device for automatic test resources, server and storage medium
CN114780217A (en) * 2022-04-19 2022-07-22 湖南长银五八消费金融股份有限公司 Task scheduling method and device, computer equipment and medium
CN116380149A (en) * 2023-04-07 2023-07-04 深圳市兴源智能仪表股份有限公司 Method and system for testing rotation of instrument code wheel
CN116380149B (en) * 2023-04-07 2024-02-02 深圳市兴源智能仪表股份有限公司 Method and system for testing rotation of instrument code wheel

Also Published As

Publication number Publication date
CN109194538A (en) 2019-01-11
CN109194538B (en) 2022-03-25

Similar Documents

Publication Publication Date Title
WO2020024405A1 (en) Test method, device, server and storage medium based on distributed coordination
US10621005B2 (en) Systems and methods for providing zero down time and scalability in orchestration cloud services
CN108566290B (en) Service configuration management method, system, storage medium and server
US8196142B2 (en) Use of external services with clusters
WO2020024408A1 (en) Test device, test method and storage medium
CN108744504B (en) Game data processing method and device, game server and game system
US20160155131A1 (en) System and method for fully testing a system before and after an upgrade to verify full use case compliance
CN107197012B (en) Service publishing and monitoring system and method based on metadata management system
US10691501B1 (en) Command invocations for target computing resources
JP6832291B2 (en) Systems and methods for starting application servers in parallel
CN108733496B (en) Event processing method and device
US10412190B1 (en) Device multi-step state transitions
WO2009089746A1 (en) Method, device and system for realizing task in cluster environment
CN110955506A (en) Distributed job scheduling processing method
US9983988B1 (en) Resuming testing after a destructive event
CN106033422A (en) A database operation control method, device and system
US20190196864A1 (en) Process Processing Method and Apparatus
WO2016116013A1 (en) Software upgrade method and system
CN110991127B (en) Task execution method and device, computer equipment and storage medium
CN107463390B (en) Software upgrading method and upgrading server
CN112600842A (en) Cluster shell method and device, electronic equipment and computer readable storage medium
CN112711466B (en) Hanging affair inspection method and device, electronic equipment and storage medium
CN115268909A (en) Method, system and terminal for establishing and running construction task at web front end
CA2679021C (en) System and method for transactional application lifecycle management for mobile devices
CN111813501A (en) Data deleting method, device, equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18928259

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18928259

Country of ref document: EP

Kind code of ref document: A1