CN115794642A - Test environment deployment method, device, equipment and storage medium - Google Patents

Test environment deployment method, device, equipment and storage medium Download PDF

Info

Publication number
CN115794642A
CN115794642A CN202211558223.0A CN202211558223A CN115794642A CN 115794642 A CN115794642 A CN 115794642A CN 202211558223 A CN202211558223 A CN 202211558223A CN 115794642 A CN115794642 A CN 115794642A
Authority
CN
China
Prior art keywords
deployment
test environment
machine
information
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211558223.0A
Other languages
Chinese (zh)
Inventor
谢文浩
蓝洪波
李明琦
萧韵婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202211558223.0A priority Critical patent/CN115794642A/en
Publication of CN115794642A publication Critical patent/CN115794642A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a test environment deployment method, a test environment deployment device, test environment deployment equipment and a storage medium, and relates to the technical field of big data processing. The test environment deployment method comprises the following steps: acquiring task information of a test environment deployment task configured through Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines; executing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time; acquiring deployment result information of the test environment deployment task of each machine; and displaying the deployment result information of the test environment deployment task of each machine. By adopting the test environment deployment method provided by the application, the test environment deployment efficiency can be improved.

Description

Test environment deployment method, device, equipment and storage medium
Technical Field
The present application relates to the field of big data processing technologies, and in particular, to a test environment deployment method, apparatus, device, and storage medium.
Background
In the related art, the test environment requires developers to deploy one by one, and even for machines with the same test environment, the developers need to deploy one by one respectively; moreover, the deployment of the test environment has window time limitation, and developers can apply for temporary modification of the test environment, but if the developers often apply for temporary modification, errors are easily reported, so that the success of the deployment of each test environment cannot be ensured within limited time. Illustratively, in order to guarantee the test verification work of the channel platform group, dozens of daily test versions and online versions are provided every day, the test environment and the internal verification environment are large, wherein the test environment has window time limitation (for example, 1.5h and 0.5h after work), the test environment can apply for temporary modification rights, and developers with tight requirements often apply for modification, so that errors are easily reported. If the error types are too many and the steps of the deployment state are omitted, the normal application service of each environment in a limited time cannot be ensured, so that the test and verification work of the project group is influenced. Or, a pipeline test environment deployment scheme based on developments (a collective name of a combination word, a process, a method and a system of developments) also exists in the related art, the scheme requires developers to apply for other procedures such as confidentiality-free and related developments, packaging and compiling, deployment machine configuration columns are listed in scripts and are not easy to maintain, and execution result log results also need to be checked by the developers one by one without rollback operation. Both of the two methods require test environment deployment to be executed one by one machine, and the test environment deployment result also requires manual one by one inspection. Therefore, the test environment deployment scheme in the related art not only needs to consume more manpower, but also influences the deployment efficiency.
Disclosure of Invention
The application discloses a test environment deployment method, a test environment deployment device, test environment deployment equipment and a storage medium, and aims to solve the technical problems that more manpower needs to be consumed and deployment efficiency is low in the related technology. The technical scheme of the application is as follows:
in a first aspect, the present application discloses a test environment deployment method, including:
acquiring task information of a test environment deployment task configured through Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines;
executing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time;
acquiring deployment result information of the test environment deployment task of each machine;
and displaying the deployment result information of the test environment deployment task of each machine.
In one possible implementation, the executing, at the deployment time, the test environment deployment task for each of the machines based on the set of machine information and the test environment information includes:
and executing a test environment deployment task on each machine in a parallel or serial mode at the deployment time through Python based on the machine information set and the test environment information.
In a possible implementation manner, after obtaining the deployment result information of the test environment deployment task of each machine, the method further includes:
for the ith machine, when the deployment result information of the test environment deployment task of the ith machine is deployment failure, executing test environment rollback processing by the Python to enable the ith machine to rollback to a test environment before the test environment deployment task is executed; where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
In one possible implementation, the machine information includes a machine identification and a test environment deployment path.
In one possible embodiment, the displaying deployment result information of the test environment deployment task of each of the machines includes:
acquiring deployment result information of the test environment deployment task of each machine through the Python; the deployment result information comprises a deployment task state, a deployment log and a machine identifier;
rendering the deployment result information of the test environment deployment task of each machine to generate a hypertext markup language (HTML) file;
and displaying the HTML file.
In one possible embodiment, the displaying the HTML file includes:
unfolding and displaying the deployment task state and the machine identification of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
the method further comprises the following steps:
under the condition that a viewing instruction of a deployment log of a test environment deployment task of a target machine is received, the deployment log of the test environment deployment task of the target machine is unfolded and displayed; wherein the target machine is any one of the machines that need to deploy the test environment.
If the authentication result of the identity authentication is that the authentication is passed, the subsequent service operation is executed.
In a second aspect, the present application discloses a test environment deployment apparatus, comprising:
the first information acquisition module is used for acquiring task information of a test environment deployment task configured by Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines;
a deployment module for executing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time;
the second information acquisition module is used for acquiring the deployment result information of the test environment deployment task of each machine;
and the first information display module is used for displaying the deployment result information of the test environment deployment task of each machine.
In a possible implementation, the deployment module is specifically configured to:
and executing a test environment deployment task on each machine in a parallel or serial mode through Python based on the machine information set and the test environment information at the deployment time. .
In a possible embodiment, the apparatus further comprises:
a rollback module, configured to execute test environment rollback processing by the Python when deployment result information of an ith machine test environment deployment task is deployment failure for an ith machine, so that the ith machine is rolled back to a test environment before the test environment deployment task is executed; where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
In one possible implementation, the machine information includes a machine identification and a test environment deployment path.
In one possible implementation, the first information display module includes:
an information obtaining unit, configured to obtain, through the Python, deployment result information of the test environment deployment task of each machine; the deployment result information comprises a deployment task state, a deployment log and a machine identifier;
the file generation unit is used for rendering the deployment result information of the test environment deployment task of each machine to generate a hypertext markup language (HTML) file;
and the file display unit is used for displaying the HTML file.
In one possible embodiment, the file display unit includes:
the information display subunit is used for unfolding and displaying the deployment task state and the machine identifier of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
the device further comprises:
the second information display module is used for expanding and displaying the deployment log of the test environment deployment task of the target machine under the condition that a viewing instruction of the deployment log of the test environment deployment task of the target machine is received; wherein the target machine is any one of the machines that need to deploy the test environment.
In a third aspect, the present application discloses an electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of the first aspect.
In a fourth aspect, the present application discloses a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method of the first aspect.
In a fifth aspect, the present application discloses a computer program product comprising computer programs/instructions, characterized in that the computer programs/instructions, when executed by a processor, implement the method of the first aspect.
The technical scheme disclosed by the application at least brings the following beneficial effects:
in the technical scheme disclosed by the application, task information of a test environment deployment task is configured through Jenkins, wherein the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed, and the machine information set comprises machine information corresponding to a plurality of machines; executing a test environment deployment task for each machine based on the machine information set and the test environment information at the deployment time; acquiring deployment result information of the test environment deployment task of each machine; and displaying the deployment result information of the test environment deployment task of each machine. Therefore, on one hand, the timing deployment of the test environments of a plurality of machines can be automatically realized through Jenkins, developers do not need to deploy the test environments of each machine one by one, and the application of modification rights due to window time limitation is also not needed, so that the labor consumption can be effectively reduced, and the deployment efficiency of the test environments is improved; on the other hand, the test environment deployment result information of each machine can be displayed. Therefore, developers can intuitively and clearly know the test environment deployment result information of each machine.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application and are not to be construed as limiting the application.
Fig. 1 is a schematic flowchart of a test environment deployment method according to a first embodiment of the present application;
fig. 2 is a schematic flowchart of a test environment deployment method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a test environment deployment apparatus according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a test environment deployment method according to a first embodiment of the present application, which may be applied to an electronic device, where the electronic device may be installed with a test environment deployment tool, and the test environment deployment tool may be implemented based on Jenkins and Python. As shown in fig. 1, the test environment deployment method may include the following steps:
s101, acquiring task information of a test environment deployment task configured through Jenkins.
The task information may include a machine information set, deployment time, and test environment information of the test environment to be deployed, the machine information set includes machine information corresponding to each of the plurality of machines, and the machine information set may be in a list form, which is convenient for maintenance. The machine information may include a machine identifier and a test environment deployment path, the deployment time may be deployment time of a test environment deployment task, that is, timing deployment of a test environment of a plurality of machines may be implemented, and the test environment information may be specific information of the test environment to be deployed in the test environment deployment task. Jenkins is an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform so that the software project can be continuously integrated.
In the embodiment of the application, when test environment deployment is required, a developer can configure task information of a test environment deployment task through Jenkins, so that a test environment deployment tool can receive and acquire the task information of the test environment deployment task configured through Jenkins. For example, the task information configuration of the test environment deployment task may be performed on a timing configuration page, for example, the test environment deployment task may be created by using Jenkins on the timing configuration page, and the specific task information of the test environment deployment task may be configured, for example, the deployment time of the test environment deployment task may be configured to be specific to a specific time minute and second every day, so as to implement the timing execution of the test environment deployment task.
S102, executing a test environment deployment task for each machine based on the machine information set and the test environment information in the deployment time.
In the embodiment of the application, after the task information of the test environment deployment task configured by Jenkins is acquired, the test environment deployment task can be executed on each machine needing to deploy the test environment in the machine information set based on the machine information set and the test environment information at the deployment time. Illustratively, a machine identifier and a test environment deployment path corresponding to each machine in a machine information set and test environment information in task information of a test environment deployment task can be obtained through Jenkins, a machine needing to deploy a test environment is determined according to the machine identifier, and test environment deployment is automatically performed on each machine needing to deploy the test environment at a fixed time according to the test environment deployment path of each machine at deployment time. Thus, the timing deployment of the test environment of a plurality of machines can be realized.
S103, acquiring the deployment result information of the test environment deployment task of each machine.
In the embodiment of the present application, after executing the test environment deployment task for each machine by using Python based on the machine information set, the deployment time, and the test environment information, the deployment result information of the test environment deployment task for each machine may be obtained. For example, the deployment task status (which may be, for example, successful deployment and failed deployment), the deployment log, and the machine identifier of each machine of the test environment deployment task of each machine may be obtained through Python. It can be understood that the obtaining of the deployment result information of the test environment deployment task of each machine may be obtained uniformly after the test environment deployment tasks of all the machines are executed, or may be obtained separately after the test environment deployment tasks of each machine are executed.
And S104, displaying the deployment result information of the test environment deployment task of each machine.
In the embodiment of the present application, after the deployment result information of the test environment deployment task of each machine is obtained, the deployment result information of the test environment deployment task of each machine may be displayed on a page. For example, the deployment result information of the test environment deployment task of each machine may be visually displayed on the result presentation page. It can be understood that, when the deployment result information of the test environment deployment task of each machine is displayed, the deployment result information may be displayed in blocks according to the deployment state, for example, the deployment result information of the test environment deployment task of the machine that has successfully been deployed may be displayed in one block, and the deployment result information of the test environment deployment task of the machine that has failed to be deployed may be displayed in another block.
In the embodiment of the application, task information of a test environment deployment task is configured through Jenkins, wherein the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed, and the machine information set comprises machine information corresponding to a plurality of machines; executing a test environment deployment task on each machine based on the machine information set and the test environment information at the deployment time; acquiring deployment result information of the test environment deployment task of each machine; and displaying the deployment result information of the test environment deployment task of each machine. Therefore, on one hand, the timing deployment of the test environment of a plurality of machines can be automatically realized through Jenkins, developers do not need to deploy the test environment of each machine one by one, and the application of modification rights due to window time limitation is also not needed, so that the labor consumption can be effectively reduced, the deployment efficiency of the test environment is improved, and the test environment can be normally changed within limited time; on the other hand, the test environment deployment result information of each machine can be displayed. Therefore, developers can intuitively and clearly know the test environment deployment result information of each machine.
In some possible embodiments, the step of executing the test environment deployment task on each machine based on the machine information set and the test environment information at the deployment time may be implemented by:
and in the deployment time, executing a test environment deployment task on each machine in a parallel or serial mode on the basis of the machine information set and the test environment information through Python.
In the embodiment of the application, when the test environment deployment task is executed on each machine at the deployment time based on the machine information set and the test environment information, python can be called by Jenkins to obtain the machine identifier and the test environment deployment path corresponding to each machine in the machine information set and the test environment information in the task information of the test environment deployment task, the machine needing to deploy the test environment is determined according to the machine identifier, and the test environment deployment is automatically performed on each machine needing to deploy the test environment at the deployment time according to the test environment deployment path of each machine. When test environment deployment is performed on each machine needing to deploy the test environment, the test environment deployment may be performed on each machine sequentially in series, or multiple machines may be deployed in parallel. That is to say, the timing deployment of the test environment of multiple machines can be realized by combining Python on the basis of Jenkins, and the test environment deployment task can be configured to be executed serially or concurrently by multiple machines according to actual needs.
In some possible embodiments, after the above steps obtain the deployment result information of the test environment deployment task of each machine, the following processing may also be performed:
for the ith machine, when the deployment result information of the test environment deployment task of the ith machine is deployment failure, executing test environment rollback processing through Python to enable the ith machine to rollback to the test environment before the test environment deployment task is executed.
Where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
In the embodiment of the present application, after obtaining the deployment result information of the test environment deployment task of each machine, for the machine that fails to be deployed, version rollback processing may also be executed. For example, for an ith machine, the deployment state of the deployment result information of the deployment task of the test environment of the ith machine may be obtained, and when the deployment state of the deployment result information of the deployment task of the test environment of the ith machine is a deployment failure, the test environment rollback processing may be executed by Python, so that the ith machine may be rolled back to the test environment before the test environment deployment task is executed. It can be understood that i may take a value sequentially from 1 to n or may take a value randomly, and the execution of the rollback processing may also be based on a rollback task created by a developer, and the rollback task may also be configured by Jenkins. Therefore, the condition that the subsequent test is influenced due to the failed deployment of the test environment can be avoided, and the success rate of the test is improved.
In some possible embodiments, the displaying deployment result information of the test environment deployment task of each machine includes:
acquiring deployment result information of the test environment deployment task of each machine through Python;
rendering the deployment result information of the test environment deployment task of each machine to generate an HTML file;
the HTML file is displayed.
The deployment result information comprises a deployment task state, a deployment log and a machine identifier; it is understood that the deployment result information may also include a rollback log.
In the embodiment of the present application, when the deployment result information of the test environment deployment task of each machine is displayed, the deployment result information of the test environment deployment task of each machine may be obtained through Python, for example, information such as a deployment task state, a deployment log, and a machine identifier of the test environment deployment task of each machine may be obtained. Then, the deployment result information of the test environment deployment task of each machine may be rendered to obtain an HTML (Hyper Text Markup Language) file. The HTML file may then be displayed at the interface. Therefore, the deployment result information of the test environment deployment task of each machine can be visually displayed, so that the deployment result information is clear at a glance, is not easy to miss, and is convenient to check.
In some possible embodiments, the displaying the HTML file in the above step may include:
unfolding and displaying the deployment task state and the machine identification of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
under the condition that a viewing instruction of a deployment log of a test environment deployment task of a target machine is received, the deployment log of the test environment deployment task of the target machine is unfolded and displayed; the target machine is any one of machines needing to be deployed with a test environment.
In the embodiment of the application, the content of the execution log (which may be a deployment log or a rollback log) is considered to be generally more and thinner. Therefore, for the deployment result information, the deployment task state and the machine identifier of the test environment deployment task of each machine can be displayed in an expanded manner, and the deployment log of the test environment deployment task of each machine can be displayed in a folded manner, for example, the deployment information can be displayed in a label manner. It is to be understood that, in the case where the deployment result information includes a rollback log, the rollback log of each machine that performs the rollback processing may also be displayed in a collapsed manner. If a developer wants to view the deployment log of a certain machine (target machine), the developer can operate the electronic device, so that the electronic device can receive a view instruction of the deployment log of the test environment deployment task for the target machine. In response to the viewing instruction, a deployment log may be deployed that displays the test environment of the target machine. It is understood that in case of a collapsed display with a rollback log, the developer may also view the rollback log. Therefore, the developer can select to view the log to be viewed according to the requirement.
In order to make the test environment deployment method provided by the embodiment of the present application clearer, the test environment deployment method provided by the embodiment of the present application is described below with reference to fig. 2.
The test environment deployment method can be applied to electronic equipment provided with a test environment deployment tool, the tool can be realized based on Jenkins and python, timing deployment and backspacing are realized based on Jenkins, and remote deployment, backspacing, log output and result report visual display are realized based on python. The test environment deployment tool may comprise two parts, a front-end page and a Python handler. The front-end page is divided into a timing configuration page and a result display page; the Python processing program comprises three modules, namely a Python deployment processing program, a Python backspace processing program and a result file visualization display processing program. Wherein:
the timing configuration page may function as follows: (1) According to different test environment deployment requirements, creating a test environment deployment task and a test environment rollback task; (2) Configuring a machine information set, namely a machine information list, of an automatic test environment deployment task and a test environment rollback task; (3) Configuring the timing execution time of the tasks, wherein the timing execution time can be specific to time, minute and second every day, the deployment time is deployment time for the deployment tasks, and the backspacing time is backspacing time for the backspacing tasks; (4) The configuration tasks (e.g., deployment tasks, fallback tasks) are performed serially or concurrently. The timing configuration page can use Jenkins to create project timing tasks (such as test environment deployment tasks and backspacing tasks), the execution of the timing tasks needs to call corresponding Python deployment processing programs and Python backspacing processing programs to realize, serial execution of the same tasks is realized based on Jenkins multiJob, and parallel execution of the tasks is not compatible. The results presentation page may implement the following functions: and counting the task execution results (such as deployment result information and backspacing result information) visually and displaying the task execution results, and calling the log detail display. The task execution result may include: the method comprises the following steps of executing a task name, executing an error reporting machine ip address and a user name, executing a task state (success/failure), executing a task result state description and executing log details. And the detailed execution log uses a label, and the detailed execution log showing the corresponding machine ip/user name is developed. The page implementation can use python panda to output deployment log and rollback log details to HTML page in a visual arrangement mode.
The Python deployment handler may read a machine information set, i.e., a deployment file machine list, log in the remote machine in batch to execute a deployment script (i.e., test environment information), and write an execution log and a result into a result file (i.e., deployment result information). The program can be realized by using python fabric, the fabric is an ssh (Secure Shell) command line tool realized based on python, the application program deployment and the system management task of ssh are simplified, a system-based operation assembly is provided, and the functions of local or remote Shell command execution, including batch command execution, file uploading, downloading, complete execution log output and the like can be realized. The python rollback handler may read the list of rollback machines. The generation mode of the rollback machine list is selectable: a. matching the machine list according to the machine ip which fails to be deployed in the deployment result file and the user name to generate a backspacing machine list; b. because sometimes versions are needed, deployment without errors also needs to be rolled back, and then the list of machine files can be manually configured according to needs. The program can still use the fabric to realize remote login, execute the rollback script in batch and generate the rollback log and the result file. The result file visualization display processing program can realize visualization display of the deployment log, the rollback log and the result file, so that the operation result check is clear, and two blocks of success (such as successful deployment, successful rollback) and failure (such as successful rollback and failed rollback) are respectively listed in the visualization statistics: the system comprises an execution task name, an execution error reporting machine ip address and a user name, an execution task state (success/failure), an execution task result state description and execution log details. Wherein the execution log detail page can be presented with another jump. The program reads the data of each task execution result file, and the program searches the target file reading data by traversing the folder through the pathlib library. And the read data is formatted and rendered to generate HTML file page display.
Referring to fig. 2, when executing the test environment deployment method, task information of the test environment deployment task may be configured first, including configuring a machine information set, deployment time, and test environment information of the test environment to be deployed; the machine information set includes machine information corresponding to each of the plurality of machines, and the machine information set may be in the form of a machine list. Then, the Python deployment handler may be called to perform the deployment task. And then judging whether the deployment task of each machine is successfully deployed. If the deployment tasks for all machines are deployed successfully, the process may end. On the contrary, if the deployment of the machine fails, whether the rollback processing needs to be executed or not can be determined, for the machine needing to execute the rollback processing, a python rollback processing program can be called to execute the version rollback processing, and after the version rollback processing is finished, the processing is finished. It will be appreciated that the deployment tasks and the rollback tasks may be performed serially by each machine or in parallel by multiple machines.
Based on the same inventive concept, the embodiment of the application also provides a test environment deployment device. As shown in fig. 3, the test environment deployment apparatus 300 includes:
the first information obtaining module 310 is configured to obtain task information of a test environment deployment task configured by Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines;
a deployment module 320 configured to perform a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time;
a second information obtaining module 330, configured to obtain deployment result information of the test environment deployment task of each machine;
the first information display module 340 is configured to display deployment result information of the test environment deployment task of each machine.
In a possible implementation, the deployment module 320 is specifically configured to:
and executing a test environment deployment task on each machine in a parallel or serial mode through Python based on the machine information set and the test environment information at the deployment time.
In a possible implementation, the apparatus 300 further comprises:
a rollback module, configured to execute test environment rollback processing by the Python when deployment result information of an ith machine test environment deployment task is deployment failure for an ith machine, so that the ith machine is rolled back to a test environment before the test environment deployment task is executed; where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
In one possible implementation, the machine information includes a machine identification and a test environment deployment path.
In a possible implementation, the first information display module 340 includes:
the information acquisition unit is used for acquiring the deployment result information of the test environment deployment task of each machine through the Python; the deployment result information comprises a deployment task state, a deployment log and a machine identifier;
the file generation unit is used for rendering the deployment result information of the test environment deployment task of each machine to generate a hypertext markup language (HTML) file;
and the file display unit is used for displaying the HTML file.
In one possible embodiment, the file display unit includes:
the information display subunit is used for unfolding and displaying the deployment task state and the machine identifier of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
the apparatus 300 further comprises:
the second information display module is used for expanding and displaying the deployment log of the test environment deployment task of the target machine under the condition that a viewing instruction of the deployment log of the test environment deployment task of the target machine is received; wherein the target machine is any one of the machines that need to deploy the test environment.
The specific implementation manner and technical effects of the apparatus provided in the embodiment of the present application are similar to those of the method embodiment described above, and are not described herein again.
According to embodiments of the application, an electronic device, a computer-readable storage medium and a computer program product are also disclosed.
FIG. 4 shows a schematic block diagram of an example electronic device 400 that may be used to implement embodiments of the present application. The electronic device 400 is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 4, the electronic device 400 includes a computing unit 401 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 402 or a computer program loaded from a storage unit 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
A number of components in the electronic device 400 are connected to the I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, or the like; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408 such as a magnetic disk, optical disk, or the like; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Computing unit 401 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 401 executes the respective methods and processes described above, such as the test environment deployment method. For example, in some embodiments, the test environment deployment method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 400 via the ROM402 and/or the communication unit 409. When loaded into RAM403 and executed by computing unit 401, may perform one or more of the steps of the test environment deployment method described above. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the test environment deployment method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
The program code for a computer program product for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this application, a computer readable storage medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may be a machine readable signal medium or a machine readable storage medium. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a computer-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server may be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service extensibility in a traditional physical host and VPS service ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (15)

1. A test environment deployment method, comprising:
acquiring task information of a test environment deployment task configured by Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines;
executing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time;
acquiring deployment result information of the test environment deployment task of each machine;
and displaying the deployment result information of the test environment deployment task of each machine.
2. The method of claim 1, wherein performing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time comprises:
and executing a test environment deployment task on each machine in a parallel or serial mode at the deployment time through Python based on the machine information set and the test environment information.
3. The method of claim 1, wherein after obtaining deployment result information for the test environment deployment task for each of the machines, the method further comprises:
for the ith machine, when the deployment result information of the test environment deployment task of the ith machine is deployment failure, executing test environment rollback processing by the Python to enable the ith machine to rollback to a test environment before the test environment deployment task is executed; where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
4. The method of claim 1, wherein the machine information comprises machine identification and test environment deployment path.
5. The method of claim 4, wherein the displaying deployment result information for the test environment deployment task for each of the machines comprises:
acquiring deployment result information of the test environment deployment task of each machine through Python; the deployment result information comprises a deployment task state, a deployment log and a machine identifier;
rendering the deployment result information of the test environment deployment task of each machine to generate a hypertext markup language (HTML) file;
and displaying the HTML file.
6. The method of claim 5, wherein the displaying the HTML file comprises:
unfolding and displaying the deployment task state and the machine identification of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
the method further comprises the following steps:
under the condition that a viewing instruction of a deployment log of a test environment deployment task of a target machine is received, the deployment log of the test environment deployment task of the target machine is unfolded and displayed; wherein the target machine is any one of the machines that need to deploy the test environment.
7. A test environment deployment device is characterized by comprising
The first information acquisition module is used for acquiring task information of a test environment deployment task configured by Jenkins; the task information comprises a machine information set, deployment time and test environment information of a test environment to be deployed; the machine information set comprises machine information corresponding to a plurality of machines;
a deployment module for executing a test environment deployment task for each of the machines based on the set of machine information and the test environment information at the deployment time;
the second information acquisition module is used for acquiring the deployment result information of the test environment deployment task of each machine;
and the first information display module is used for displaying the deployment result information of the test environment deployment task of each machine.
8. The apparatus according to claim 7, wherein the deployment module is specifically configured to:
and executing a test environment deployment task on each machine in a parallel or serial mode at the deployment time through Python based on the machine information set and the test environment information.
9. The apparatus of claim 7, further comprising:
a rollback module, configured to execute test environment rollback processing by using the Python when deployment result information of an ith machine test environment deployment task is deployment failure, for an ith machine, so that the ith machine is rolled back to a test environment before the test environment deployment task is executed; where i ∈ (1, n), n is the total number of machines that need to deploy the test environment.
10. The apparatus of claim 7, wherein the machine information comprises a machine identification and a test environment deployment path.
11. The apparatus of claim 10, wherein the first information display module comprises:
the information acquisition unit is used for acquiring the deployment result information of the test environment deployment task of each machine through the Python; the deployment result information comprises a deployment task state, a deployment log and a machine identifier;
the file generation unit is used for rendering the deployment result information of the test environment deployment task of each machine to generate a hypertext markup language (HTML) file;
and the file display unit is used for displaying the HTML file.
12. The apparatus of claim 11, wherein the document display unit comprises:
the information display subunit is used for unfolding and displaying the deployment task state and the machine identifier of the test environment deployment task of each machine, and folding and displaying the deployment log of the test environment deployment task of each machine;
the device further comprises:
the second information display module is used for expanding and displaying the deployment log of the test environment deployment task of the target machine under the condition that a viewing instruction of the deployment log of the test environment deployment task of the target machine is received; wherein the target machine is any one of the machines that need to deploy the test environment.
13. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the test environment deployment method of any of claims 1-6.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the test environment deployment method of any one of claims 1 to 6.
15. A computer program product comprising computer programs/instructions, characterized in that said computer programs/instructions, when executed by a processor, implement the test environment deployment method of any of claims 1-6.
CN202211558223.0A 2022-12-06 2022-12-06 Test environment deployment method, device, equipment and storage medium Pending CN115794642A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211558223.0A CN115794642A (en) 2022-12-06 2022-12-06 Test environment deployment method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211558223.0A CN115794642A (en) 2022-12-06 2022-12-06 Test environment deployment method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115794642A true CN115794642A (en) 2023-03-14

Family

ID=85418795

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211558223.0A Pending CN115794642A (en) 2022-12-06 2022-12-06 Test environment deployment method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115794642A (en)

Similar Documents

Publication Publication Date Title
CN108108297B (en) Method and device for automatic testing
EP3916560A1 (en) Fault injection method and apparatus, electronic device and storage medium to test microservices in the cloud
CN111522738A (en) Test method and device of micro-service system, storage medium and electronic equipment
CN109901985B (en) Distributed test apparatus and method, storage medium, and electronic device
CN111258913A (en) Automatic algorithm testing method and device, computer system and readable storage medium
KR102488582B1 (en) Method and apparatus for verifying operation state of application
CN114064208A (en) Method and device for detecting application service state, electronic equipment and storage medium
CN113014445A (en) Operation and maintenance method, device and platform for server and electronic equipment
CN110795332A (en) Automatic testing method and device
CN112925583B (en) Host application capability extension method, device, equipment and storage medium
CN110362416B (en) Page component loading method and device, electronic equipment and storage medium
CN113778849A (en) Method, apparatus, device and storage medium for testing code
JP7211228B2 (en) Analysis device, analysis method, and program
CN115794642A (en) Test environment deployment method, device, equipment and storage medium
CN110347409B (en) Automatic control method, client and server
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN114741294A (en) Page debugging method, device, equipment and storage medium
CN113238953A (en) UI automation test method and device, electronic equipment and storage medium
CN111881025A (en) Automatic test task scheduling method, device and system
CN110990209A (en) Storage stability test method, test device, test equipment and storage medium
CN112560041B (en) Method, apparatus and computer storage medium for automated quality verification detection
CN113626332B (en) Debugging method, device, equipment, storage medium and computer program product
EP4227796A1 (en) Service deployment processing method and apparatus, electronic device, and storage medium
CN115629977A (en) Operating system test method, operating system test system, electronic device, and storage medium
CN115543807A (en) Automatic regression testing method and device, computer equipment and storage medium

Legal Events

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