Method, device, equipment, storage medium and program product for function verification of distributed system
By automating the acquisition and verification of server information in a distributed system, assembling resource locators and parameters, and utilizing multi-threading for functional verification, the problem of low efficiency in traditional manual testing is solved, achieving fast and comprehensive verification results.
Patent Information
- Application Number
- CN202410437380.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-11
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-04-11
AI Technical Summary
Traditional distributed systems take a long time to verify new features through business validation or manual testing after they are launched, and cannot fully expose problems, especially when there are a large number of containers, resulting in low testing efficiency.
A method for functional verification of a distributed system is provided. The method obtains the service cluster name through the configuration file, pulls the server IP and port information, assembles the Uniform Resource Locator and upload parameters, and uses multi-threading to perform automated functional verification, including the use of hash tables in the cache server and the generation of assertion results.
It enables automated functional verification of distributed systems, significantly reducing verification time, improving testing efficiency, and enabling more comprehensive problem detection.
Smart Images

Figure CN118337783B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of distribution, in particular to the technical field of test automation, and more particularly to a function verification method, device, equipment, storage medium and program product of a distributed system. BACKGROUND
[0002] The traditional distributed system is tested by business verification or by test personnel manually after a new function is put online, and whether the function is normal is determined manually. In the related art, the function is verified by business verification and manual verification by test personnel. On the one hand, the verification time is relatively long, and if there is a problem, a relatively large impact may have been caused. At the same time, because the number of containers of the distributed system is large, the number of services actually verified is small, and the problem cannot be fully exposed.
[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0004] In view of the above problems, the present disclosure provides a function verification method, device, equipment, storage medium and program product of a distributed system capable of realizing automatic verification.
[0005] According to a first aspect of the present disclosure, a function verification method of a distributed system is provided, applied to a distributed application server, the application server providing a verification function interface, a configuration file in the application server being pre-configured with to-be-verified interface information, and the method comprising:
[0006] obtaining a full-service cluster name from the configuration file in response to a function verification instruction of the distributed system;
[0007] pulling all server IP port information under the service cluster from a cache server according to the service cluster name;
[0008] assembling a complete uniform resource locator and upload parameters according to the to-be-verified interface information and the server IP port information; and
[0009] verifying the function of the distributed system based on the to-be-verified interface information, the complete uniform resource locator and the upload parameters.
[0010] According to an embodiment of the present disclosure, the to-be-verified interface information comprises a service cluster name, a uniform resource locator, upload parameters and a successful assertion result, and assembling a complete uniform resource locator and upload parameters according to the to-be-verified interface information and the server IP port information comprises:
[0011] Splice the server IP port information and the uniform resource locator into a complete uniform resource locator; and
[0012] Assemble the uplink parameter based on a preset message format.
[0013] According to an embodiment of the present disclosure, before pulling all server IP port information under the service cluster from the cache server according to the service cluster name, the method further comprises:
[0014] Timing to obtain the service cluster name, server IP address and port information to which the current server belongs; and
[0015] Caching the service cluster name, server IP address and port information in the form of a hash table to a cache server.
[0016] According to an embodiment of the present disclosure, the caching the service cluster name, server IP address and port information in the form of a hash table to a cache server comprises:
[0017] Taking the service cluster name as a data key; and
[0018] Storing each of the server IP address and the port information under the service cluster in the cache server as a field name and a field value.
[0019] According to an embodiment of the present disclosure, the pulling all server IP port information under the service cluster from the cache server according to the service cluster name comprises:
[0020] Accessing the cache database according to the service cluster name; and
[0021] Taking the service cluster name as a data key, querying a key value corresponding to the data key, and the key value is all server IP addresses and port information under the service cluster.
[0022] According to an embodiment of the present disclosure, the performing function verification on the distributed system based on the to-be-verified interface information, the complete uniform resource locator and the uplink parameter comprises:
[0023] Initiating an http request to the complete uniform resource locator to send the uplink parameter in a multi-threaded manner;
[0024] Receiving a server response result; and
[0025] Asserting the server response result according to the to-be-verified interface information in the configuration file to generate a verification result.
[0026] According to an embodiment of the present disclosure, the asserting the server response result according to the interface information to be verified in the configuration file to generate a verification result comprises:
[0027] asserting the server response result according to a successful assertion result of a predetermined interface in the configuration file;
[0028] if it is determined that the assertion is successful, setting the interface verification state as successful; and
[0029] if it is determined that the assertion is identified, setting the interface verification state as failed.
[0030] A second aspect of the present disclosure provides a function verification device of a distributed system, applied to a distributed application server, wherein the application server provides a verification function interface, a configuration file in the application server is pre-configured with interface information to be verified, and the device comprises:
[0031] a first obtaining module, configured to obtain a full-service cluster name from the configuration file in response to a function verification instruction of the distributed system;
[0032] a second obtaining module, configured to pull all server IP port information under the service cluster from a cache server according to the service cluster name;
[0033] a generating module, configured to assemble a complete uniform resource locator and upload parameters according to the interface information to be verified and the server IP port information; and
[0034] a verification module, configured to perform function verification on the distributed system based on the interface information to be verified, the complete uniform resource locator and the upload parameters.
[0035] According to an embodiment of the present disclosure, the generating module comprises a splicing sub-module and an upload sub-module.
[0036] the splicing sub-module is configured to splice the server IP port information and the uniform resource locator into a complete uniform resource locator; and
[0037] the upload sub-module is configured to assemble upload parameters based on a preset message format.
[0038] According to an embodiment of the present disclosure, the device further comprises a third obtaining module and a cache module.
[0039] the third obtaining module is configured to obtain a service cluster name to which a current server belongs, a server IP address and port information at regular intervals; and
[0040] the cache module is configured to cache the service cluster name, the server IP address and the port information in the form of a hash table to a cache server.
[0041] According to an embodiment of the present disclosure, the cache module is further configured to store the service cluster name as a data key, and store each of the server IP addresses and the port information under the service cluster as a field name and a field value in a cache server.
[0042] According to an embodiment of the present disclosure, the second obtaining module comprises a first query sub-module and a second query sub-module.
[0043] The first query sub-module is configured to access a cache database according to the service cluster name.
[0044] The second query sub-module is configured to query a key value corresponding to the service cluster name as a data key, the key value being all server IP addresses and port information under the service cluster.
[0045] According to an embodiment of the present disclosure, the verification module comprises a request sub-module, a receiving sub-module and an assertion sub-module.
[0046] The request sub-module is configured to send the uploading parameter to the complete uniform resource locator by means of multi-threading.
[0047] The receiving sub-module is configured to receive a server response result.
[0048] The assertion sub-module is configured to perform assertion on the server response result according to to-be-verified interface information in a configuration file, to generate a verification result.
[0049] According to an embodiment of the present disclosure, the assertion sub-module comprises an assertion unit, a first determination unit and a second determination unit.
[0050] The assertion unit is configured to perform assertion on the server response result according to a successful assertion result of a predetermined interface in a configuration file.
[0051] The first determination unit is configured to set an interface verification state as successful if it is determined that the assertion is successful.
[0052] The second determination unit is configured to set the interface verification state as failed if it is determined that the assertion is failed.
[0053] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the function verification method of the distributed system.
[0054] The fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the function verification method of the distributed system.
[0055] The fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the function verification method of the distributed system.
[0056] The function verification method of the distributed system provided by the embodiments of the present disclosure responds to a function verification instruction of the distributed system, obtains a full-service cluster name from a configuration file, pulls all server IP port information under the service cluster from a cache server according to the service cluster name, assembles a complete uniform resource locator and upload parameters according to the to-be-verified interface information and the server IP port information, and performs function verification on the distributed system based on the to-be-verified interface information, the complete uniform resource locator and the upload parameters. Compared with the related art, the function verification method of the distributed system provided by the embodiments of the present disclosure acquires IP port information of an application server of the distributed system at a timing, calls a trigger interface of the application server to realize self-verification in an automated manner, greatly reduces verification time, and improves test efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0057] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:
[0058] Figure 1 An application scenario diagram of the function verification method, apparatus, device, storage medium and program product of the distributed system according to an embodiment of the present disclosure is schematically shown;
[0059] Figure 2 A system architecture diagram of the function verification apparatus of the distributed system according to an embodiment of the present disclosure is schematically shown
[0060] Figure 3 A flowchart of the function verification method of the distributed system according to an embodiment of the present disclosure is schematically shown;
[0061] Figure 4 A flowchart of the function verification method of the distributed system according to another embodiment of the present disclosure is schematically shown;
[0062] Figure 5 A flowchart of the function verification method of the distributed system according to still another embodiment of the present disclosure is schematically shown;
[0063] Figure 6A flowchart of a functional verification method of a distributed system according to an embodiment of the present disclosure is shown schematically;
[0064] Figure 7 A block diagram of a functional verification apparatus of a distributed system according to an embodiment of the present disclosure is shown schematically; and
[0065] Figure 8 A block diagram of an electronic device suitable for implementing a functional verification method of a distributed system according to an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION
[0066] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description which follows is merely illustrative and is not intended to limit the scope of the present disclosure. In the following detailed description of embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it would be apparent to one skilled in the art that the embodiments of the present disclosure can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present disclosure.
[0067] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include" and "have" and the like used herein indicate the presence of the described features, steps, operations, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
[0068] All terms used herein, including technical and scientific terms, have the same meanings as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present description, and should not be interpreted in an idealized or overly formal manner.
[0069] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include at least one of each item enumerated, but not necessarily one of each item enumerated only. In other words, it should be interpreted to mean that it is equivalent to "at least one of A or B; A or C; B or C; A, B, and C; etc." in a logical sense, and also be equivalent to "A, B, and / or C, etc." in a grammatical sense.
[0070] To address the aforementioned technical issues, embodiments of this disclosure provide a method for functional verification of a distributed system. The method is applied to a distributed application server, which provides a verification function interface. A configuration file in the application server pre-configures the interface information to be verified. The method includes: responding to a functional verification instruction from the distributed system by obtaining the full service cluster name from the configuration file; retrieving the IP and port information of all servers under the service cluster from a cache server based on the service cluster name; assembling a complete Uniform Resource Locator (URI) and upload parameters based on the interface information to be verified and the server IP and port information; and performing functional verification of the distributed system based on the interface information to be verified, the URI, and the upload parameters.
[0071] Figure 1 The illustration schematically depicts an application scenario of a functional verification method, apparatus, device, storage medium, and program product for a distributed system according to embodiments of the present disclosure.
[0072] like Figure 1 As shown, application scenario 100 according to this embodiment may include a functional verification scenario of a distributed system. Network 104 is used as a medium to provide a communication link between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired, wireless communication links or fiber optic cables, etc.
[0073] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).
[0074] Terminal devices 101, 102, and 103 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0075] Server 105 can be a backend server that can execute the functional verification method for a distributed system provided in this embodiment of the present disclosure. In response to the functional verification instruction of the distributed system, it obtains the full service cluster name from the configuration file; retrieves the IP and port information of all servers under the service cluster from the cache server according to the service cluster name; assembles a complete unified resource locator and upload parameters according to the interface information to be verified and the server IP and port information; and performs functional verification of the distributed system based on the interface information to be verified, the complete unified resource locator, and the upload parameters.
[0076] It should be noted that the function verification method of the distributed system provided in the embodiments of the present disclosure can be generally executed by the server 105. Accordingly, the function verification apparatus of the distributed system provided in the embodiments of the present disclosure can be generally arranged in the server 105. The function verification method of the distributed system provided in the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the function verification apparatus of the distributed system provided in the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.
[0077] It should be understood that Figure 1 the number of terminal devices, networks and servers in the above-mentioned application scenarios is only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.
[0078] It should be noted that the function verification method and apparatus of the distributed system determined in the embodiments of the present disclosure can be used in the field of Internet technology, and can also be used in the field of financial technology, and can also be used in any field other than the field of finance, and the application field of the function verification method and apparatus of the distributed system determined in the embodiments of the present disclosure is not limited.
[0079] Figure 2 The system architecture diagram of the function verification apparatus of the distributed system provided in the embodiments of the present disclosure is schematically shown as Figure 2 shown, including a distributed application server system and a cache system. The distributed application server system is composed of a group of independent servers, and a large distributed system is generally composed of dozens or hundreds of servers, which provides services as a unified whole. Each server runs independently and can access the distributed cache or database. The cache system is a technical platform for providing data caching services, mainly used for caching OLTP (online transaction processing) hot data, providing high availability, high performance, low cost, elastic expansion, centralized operation and maintenance of fast data caching services for applications. The application server periodically performs server self-registration by setting a timing task, and caches the server IP port information to the cache system. In the configuration file of all servers, the information of all interfaces to be verified is set, and each server provides an interface for triggering the verification function. The operation and maintenance personnel can request the verification function interface of any server through the local device to perform target function verification.
[0080] The function verification method of the distributed system provided in the embodiments of the present disclosure will be described in detail below based on Figure 1 the application scenarios described and Figure 2 the architecture diagram shown in Figures 3-6 .
[0081] Figure 3 A flowchart of a function verification method of a distributed system according to an embodiment of the present disclosure is shown schematically. As shown in the figure, the function verification method of the distributed system of this embodiment includes operations S210-S240, which can be executed by a server or other computing device. It can be applied to a distributed application server that provides a verification function interface, and a configuration file in the application server is pre-configured with interface information to be verified. Figure 3
[0082] In operation S210, in response to a function verification instruction of a distributed system, all service cluster names are obtained from a configuration file.
[0083] In operation S220, all server IP port information under the service cluster is pulled from a cache server according to the service cluster name.
[0084] In operation S230, a complete uniform resource locator and upload parameters are assembled according to the interface information to be verified and the server IP port information.
[0085] In operation S240, the distributed system is functionally verified based on the interface information to be verified, the complete uniform resource locator, and the upload parameters.
[0086] In one example, each application server is locally configured with a configuration file, which is pre-configured with interface information to be verified, including the service cluster name to which the server belongs, a uniform resource locator url, upload parameters, and a successful assertion result. The cluster name to which the server belongs is configured as a configuration item in the local server; the uniform resource locator url is used to assemble and splice a function verification request address, through which the upload parameters are sent to the corresponding server; and the details are shown in Table 1 as follows:
[0087] Table 1 Interface information to be verified
[0088]
[0089] In one example, in response to a function verification instruction of a distributed system, the instruction can be initiated by an operation and maintenance personnel through any terminal device to any application server in the service cluster. It is assumed that the server 1 is accessed, and all service cluster names are obtained from the configuration file in the server 1. According to the service cluster name, all server IP port information under the service cluster is pulled from the cache server, and the server IP port information is cached in the cache server redis at regular intervals.
[0090] In one example, a complete uniform resource locator and a sending parameter are assembled according to the to-be-verified interface information and the server IP port information of the application server. The distributed system is functionally verified based on the to-be-verified interface information, the complete uniform resource locator and the sending parameter. Specifically, an http request is initiated to the complete uniform resource locator and the sending parameter, a response result returned by the server is waited for, and a function verification result of the distributed system is determined according to the response result.
[0091] The method for functionally verifying a distributed system provided by an embodiment of the present disclosure comprises: in response to a function verification instruction of a distributed system, obtaining a full-service cluster name from a configuration file; pulling all server IP port information of the service cluster from a cache server according to the service cluster name; assembling a complete uniform resource locator and a sending parameter according to to-be-verified interface information and the server IP port information; and functionally verifying the distributed system based on the to-be-verified interface information, the complete uniform resource locator and the sending parameter. Compared with the related art, the method for functionally verifying a distributed system provided by the embodiment of the present disclosure acquires IP port information of an application server of the distributed system at a fixed time, and realizes self-verification in an automated manner by calling a trigger interface of the application server, thereby greatly reducing verification time and improving test efficiency.
[0092] Figure 4 A flowchart of a method for functionally verifying a distributed system according to another embodiment of the present disclosure is schematically shown. Figure 5 A flowchart of a method for functionally verifying a distributed system according to still another embodiment of the present disclosure is schematically shown. Figure 6 A flowchart of a method for functionally verifying a distributed system according to still another embodiment of the present disclosure is schematically shown.
[0093] As shown in Figure 4 The method comprises operations S310-S370.
[0094] In operation S310, in response to a function verification instruction of a distributed system, a full-service cluster name is obtained from a configuration file.
[0095] In operation S320, a current server belongs to a service cluster name, a server IP address and port information are acquired at a fixed time.
[0096] In operation S330, the service cluster name, the server IP address and the port information are cached in a hash table form to a cache server.
[0097] According to an embodiment of the present disclosure, the service cluster name is taken as a data key, and each server IP address and port information under the service cluster is stored in the cache server as a field name and field value.
[0098] In one example, since the servers corresponding to the distributed service cluster are dynamically allocated, the corresponding server IP and port may change after each restart. Therefore, a timing thread needs to be first set on each machine of each service cluster. Specifically, a timing task is added on all servers of all service clusters, and the current server cluster name is obtained once every preset time, for example, the current server cluster name can be obtained once every 2 minutes. The server cluster name is configured as a configuration item on the local server, and the current IP address and port information are obtained. In this way, the IP and port information of the server can be updated in real time, and the server IP and port can be automatically updated after self-restart of some servers.
[0099] In one example, the current server cluster name is taken as a data key key, the current server IP is taken as a field name filed, and the current server external service port is taken as a field value value. The IP and port information of the server is stored in the cache server in the format of a hash table, and the invalidation time is set to 2 minutes. When the data corresponding to the key is completely emptied after 2 minutes, the server timing task will re-register all server IP addresses and port information corresponding to the current service cluster. Through the hash data structure, the IP of the same service cluster can be stored in the same hash data set. When all servers of all clusters are started, the server IP and port are stored in the cache system in the following format, as shown in Table 2:
[0100] Table 2 Server IP address and port information
[0101]
[0102]
[0103] In operation S340, all server IP and port information under the service cluster is pulled from the cache server according to the service cluster name.
[0104] In one example, the cache database is accessed according to the service cluster name, the service cluster name is taken as a data key, and the key value corresponding to the data key is queried, which is all server IP addresses and port information under the service cluster.
[0105] In operation S350, a complete uniform resource locator is spliced according to the server IP and port information and the uniform resource locator.
[0106] At operation S360, the sending parameter is assembled based on the preset message format.
[0107] In one example, after pulling all server IP port information, the list of service interfaces to be verified in the configuration file is obtained. According to the cluster information of the interface in the list of verification service interfaces, the complete URL of the interface is spliced, and the sending parameter is assembled according to the preset message format:
[0108] 1xx.xxx.xxx.xx1:9080 / user / login.do;
[0109] 1xx.xxx.xxx.xx2:9080 / user / login.do;
[0110] 1xx.xxx.xxx.xxx:9080 / user / login.do;
[0111] 2xx.xxx.xxx.xx1:9080 / order / getorderlist.do;
[0112] 2xx.xxx.xxx.xx2:9080 / order / getorderlist.do;
[0113] 2xx.xxx.xxx.xxx:9080 / order / getorderlist.do;
[0114] 2xx.xxx.xxx.xx1:9080 / order / getorderinfo.do;
[0115] 2xx.xxx.xxx.xx2:9080 / order / getorderinfo.do;
[0116] 2xx.xxx.xxx.xxx:9080 / order / getorderinfo.do;
[0117] xxx.xxx.xxx.xx1:9080 / card / getcardinfo.do;
[0118] xxx.xxx.xxx.xx2:9080 / card / getcardinfo.do;
[0119] At operation S370, the distributed system is functionally verified based on the interface information to be verified, the complete uniform resource locator, and the sending parameter.
[0120] As Figure 5As shown, operation S370 includes operation S410-operation S430.
[0121] In operation S410, the http request is sent to the complete uniform resource locator by means of multi-threading to send the uploading parameter.
[0122] In operation S420, the server response result is received.
[0123] In operation S430, the server response result is asserted according to the interface information to be verified in the configuration file to generate a verification result.
[0124] As shown, operation S430 includes operation S431-operation S433. Figure 6
[0125] In operation S431, the server response result is asserted according to the success assertion result of the predetermined interface in the configuration file.
[0126] In operation S432, if it is determined that the assertion is successful, the interface verification state is set to success.
[0127] In operation S433, if it is determined that the assertion is identified, the interface verification state is set to failure.
[0128] In one example, after the url address and the uploading parameter are assembled, a thread pool is started, the http request is sent to the assembled url by means of multi-threading, and the corresponding server response result is received. The server response result is asserted according to the interface information to be verified in the configuration file to generate a verification result. Specifically, the assertion is performed according to the success assertion result of the predetermined interface in the configuration file. If the assertion is successful, the interface verification state of the server is set to success. If the assertion fails or there is no response, the interface verification state of the server is set to failure. After the interfaces of all servers are verified, the verification results are summarized and returned to the operation and maintenance personnel. The operation and maintenance personnel can perform the next action according to the verification results.
[0129] Based on the above-mentioned function verification method of the distributed system, the disclosure further provides a function verification device of a distributed system. The device will be described in detail below. Figure 7
[0130] Figure 7 A structural block diagram of a function verification device of a distributed system according to an embodiment of the disclosure is schematically shown. As shown, the function verification device 700 of the distributed system of this embodiment includes a first acquisition module 710, a second acquisition module 720, a generation module 730, and a verification module 740. Figure 7
[0131] The first obtaining module 710 is configured to obtain a full-service cluster name from a configuration file in response to a function verification instruction of a distributed system. In an embodiment, the first obtaining module 710 can be configured to perform operation S210 described above, and details are not repeated here.
[0132] The second obtaining module 720 is configured to pull all server IP port information under the service cluster from a cache server according to the service cluster name. In an embodiment, the second obtaining module 720 can be configured to perform operation S220 described above, and details are not repeated here.
[0133] The generating module 730 is configured to assemble a complete uniform resource locator and a sending parameter according to the interface information to be verified and the server IP port information. In an embodiment, the generating module 730 can be configured to perform operation S230 described above, and details are not repeated here.
[0134] The verification module 740 is configured to perform function verification on the distributed system based on the interface information to be verified, the complete uniform resource locator, and the sending parameter. In an embodiment, the verification module 740 can be configured to perform operation S240 described above, and details are not repeated here.
[0135] According to an embodiment of the present disclosure, the generating module includes a splicing sub-module and a sending sub-module.
[0136] The splicing sub-module is configured to splice the server IP port information and the uniform resource locator into a complete uniform resource locator. In an embodiment, the splicing sub-module can be configured to perform operation S350 described above, and details are not repeated here.
[0137] The sending sub-module is configured to assemble a sending parameter based on a preset message format. In an embodiment, the sending sub-module can be configured to perform operation S360 described above, and details are not repeated here.
[0138] According to an embodiment of the present disclosure, a third obtaining module and a cache module are further included.
[0139] The third obtaining module is configured to obtain a service cluster name to which a current server belongs, a server IP address, and port information at a timing. In an embodiment, the third obtaining module can be configured to perform operation S320 described above, and details are not repeated here.
[0140] The cache module is configured to cache the service cluster name, the server IP address, and the port information in the form of a hash table to a cache server. In an embodiment, the cache module 740 can be configured to perform operation S330 described above, and details are not repeated here.
[0141] According to an embodiment of the present disclosure, the cache module is further configured to store the service cluster name as a data key, and store each of the server IP addresses and the port information under the service cluster as a field name and a field value in a cache server.
[0142] According to an embodiment of the present disclosure, the second obtaining module comprises a first querying sub-module and a second querying sub-module.
[0143] The first querying sub-module is configured to access the cache database according to the service cluster name. In an embodiment, the first querying sub-module can be configured to perform the operation S340 described above, and details are not repeated here.
[0144] The second querying sub-module is configured to query a key value corresponding to the service cluster name as a data key, the key value being all server IP addresses and port information under the service cluster. In an embodiment, the second querying sub-module can be configured to perform the operation S340 described above, and details are not repeated here.
[0145] According to an embodiment of the present disclosure, the verifying module comprises a requesting sub-module, a receiving sub-module and an asserting sub-module.
[0146] The requesting sub-module is configured to send the uploading parameter to the complete uniform resource locator by means of multi-threading. In an embodiment, the requesting sub-module can be configured to perform the operation S410 described above, and details are not repeated here.
[0147] The receiving sub-module is configured to receive a server response result. In an embodiment, the receiving sub-module can be configured to perform the operation S420 described above, and details are not repeated here.
[0148] The asserting sub-module is configured to assert the server response result according to the interface information to be verified in the configuration file to generate a verification result. In an embodiment, the asserting sub-module can be configured to perform the operation S430 described above, and details are not repeated here.
[0149] According to an embodiment of the present disclosure, the asserting sub-module comprises an asserting unit, a first determining unit and a second determining unit.
[0150] The asserting unit is configured to assert the server response result according to a successful assertion result of a predetermined interface in the configuration file. In an embodiment, the asserting unit can be configured to perform the operation S431 described above, and details are not repeated here.
[0151] The first determining unit is configured to set an interface verification state to success if it is determined that the assertion is successful. In an embodiment, the first determining unit can be configured to perform the operation S432 described above, and details are not repeated here.
[0152] The second determining unit is configured to set the interface verification status to failure if the assertion is determined to be identified. In one embodiment, the second determining unit may be configured to perform the operation S433 described above, which will not be repeated here.
[0153] According to embodiments of this disclosure, any plurality of modules among the first acquisition module 710, the second acquisition module 720, the generation module 730, and the verification module 740 may be combined into one module, or any one of these modules may be split into multiple modules. Alternatively, at least a portion of the functionality of one or more of these modules may be combined with at least a portion of the functionality of other modules and implemented in one module. According to embodiments of this disclosure, at least one of the first acquisition module 710, the second acquisition module 720, the generation module 730, and the verification module 740 may be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging the circuitry, or implemented in any one of software, hardware, and firmware methods, or in a suitable combination of any of these methods. Alternatively, at least one of the first acquisition module 710, the second acquisition module 720, the generation module 730, and the verification module 740 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0154] Figure 8 A block diagram of an electronic device suitable for implementing a functional verification method for a distributed system, according to an embodiment of the present disclosure, is shown schematically.
[0155] like Figure 8 As shown, an electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage portion 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0156] In the RAM 903, various programs and data required for the operation of the electronic device 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other via the bus 904. The processor 901 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 902 and / or the RAM 903. It should be noted that the programs can also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 can also perform various operations of the method flow according to the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0157] According to an embodiment of the present disclosure, the electronic device 900 can further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 can further include one or more of the following components connected to the I / O interface 905: an input part 906 including a keyboard, a mouse, etc.; an output part 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 908 including a hard disk, etc.; and a communication part 909 including a network interface card such as a LAN card, a modem, etc. The communication part 909 performs communication processing via a network such as the Internet. The drive 909 is also connected to the I / O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is mounted on the drive 909 as necessary, so that a computer program read therefrom is installed in the storage part 908 as necessary.
[0158] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments; or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, when the one or more programs are executed, the function verification method of the distributed system according to the embodiments of the present disclosure is implemented.
[0159] According to an embodiment of the present disclosure, the computer readable storage medium can be a nonvolatile computer readable storage medium, for example, can include, but is not limited to, 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), a portable compact disc read only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more memories such as the ROM 902 and / or the RAM 903 described above and / or one or more memory other than the ROM 902 and the RAM 903.
[0160] Embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the function verification method of the distributed system provided by the embodiments of the present disclosure.
[0161] The above functions defined in the system / apparatus / module / unit of the embodiments of the present disclosure are performed when the computer program is executed by the processor 901. According to an embodiment of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0162] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal on a network medium, and be downloaded and installed through the communication part 909 and / or installed from the detachable medium 911. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.
[0163] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909 and / or installed from the detachable medium 911. When the computer program is executed by the processor 901, the above functions defined in the system of the embodiments of the present disclosure are performed. According to an embodiment of the present disclosure, the system, device, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0164] According to embodiments of the present disclosure, program code of the computer program for performing the methods provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and can be implemented in a computer program product. Specifically, the computer program can be implemented in a high-level procedural and / or object-oriented programming language, and / or in assembly / machine language. The programming language includes, but is not limited to, Java, C++, python, “C” language, or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, and partly on a remote computing device, or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider (ISP).
[0165] The computer program product of the present disclosure can be a computer program product, which is a machine-readable medium (or computer readable medium) having stored therein a sequence of instructions readable by a machine (e.g., a computer). The instructions in the machine-readable medium focus on the function of the computer program (e.g., in the form of a computer program product). The instructions can be executed by one or more processors to produce a computer-implemented process, such as the one(s) described above. The instructions can be stored in a computer memory, which can be a single memory or spread out over multiple memories. The machine-readable medium can be a magnetic or optical disk, a magnetic tape, a semiconductor memory, a computer disk, or any other suitable medium. The machine-readable medium can be loaded into the computer memory, or the computer memory can access the machine-readable medium through a connection, such as a communication network. The instructions represent examples of the program code means adapted to carry out the steps of the disclosed methods.
[0166] Those skilled in the art will understand that features of the various embodiments and / or claims of the present disclosure can be combined or / and integrated with one another, even though such a combination or integration is not expressly disclosed in the present disclosure. In particular, the features of the various embodiments and / or claims of the present disclosure can be combined or / and integrated with one another, without departing from the spirit and teachings of the present disclosure. All such combinations and / or integrations are within the scope of the present disclosure.
[0167] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and these substitutions and modifications should all fall within the scope of the present disclosure.
Claims
1. A method for verifying functions of a distributed system, applied to a distributed application server, characterized in that, The application server provides a verification function interface, a configuration file in the application server is pre-configured with to-be-verified interface information, and the method comprises the following steps: In response to a function verification instruction of a distributed system, obtaining a full-service cluster name from a configuration file; Pulling all server IP port information under the service cluster from a cache server according to the service cluster name; Assembling a complete uniform resource locator and a sending parameter according to the to-be-verified interface information and the server IP port information; and Based on the to-be-verified interface information, the complete uniform resource locator and the sending parameter, performing function verification on the distributed system.
2. The method of claim 1, wherein, The to-be-verified interface information comprises a service cluster name, a uniform resource locator, a sending parameter and a successful assertion result, and the assembling of the complete uniform resource locator and the sending parameter according to the to-be-verified interface information and the server IP port information comprises: Splicing the complete uniform resource locator according to the server IP port information and the uniform resource locator; and Assembling the sending parameter based on a preset message format.
3. The method of claim 1, wherein, Before the all server IP port information under the service cluster is pulled from the cache server according to the service cluster name, the method further comprises the following steps: Obtaining a service cluster name, a server IP address and port information of a current server in a timing manner; and Caching the service cluster name, the server IP address and the port information in the form of a hash table to a cache server.
4. The method of claim 3, wherein, The caching of the service cluster name, the server IP address and the port information in the form of a hash table to the cache server comprises: Taking the service cluster name as a data key; and Storing each server IP address and port information under the service cluster as a field name and a field value in the cache server.
5. The method of claim 3, wherein, The pulling of the all server IP port information under the service cluster from the cache server according to the service cluster name comprises: Accessing a cache database according to the service cluster name; and Taking the service cluster name as a data key, querying a key value corresponding to the data key, and the key value is all server IP addresses and port information under the service cluster.
6. The method according to any one of claims 1 to 5, characterized in that, The function verification on the distributed system based on the to-be-verified interface information, the complete uniform resource locator and the sending parameter comprises: Initiating an http request to the complete uniform resource locator to send the sending parameter in a multi-threaded manner; Receiving a server response result; and Asserting the server response result according to the to-be-verified interface information in the configuration file to generate a verification result.
7. The method of claim 6, wherein, The assertion of the server response result according to the to-be-verified interface information in the configuration file to generate a verification result comprises: Asserting the server response result according to a successful assertion result of a predetermined interface in the configuration file; If it is determined that the assertion is successful, setting an interface verification state as successful; and If it is determined that the assertion is identified, setting the interface verification state as failed.
8. A functional verification apparatus of a distributed system, applied to a distributed application server, the application server providing a verification function interface, a configuration file in the application server being preconfigured with interface information to be verified, characterized in that, The device comprises: A first obtaining module for obtaining a full-service cluster name from a configuration file in response to a function verification instruction of a distributed system; a second obtaining module, configured to pull all server IP port information under the service cluster from a cache server according to the service cluster name; a generating module, configured to assemble a complete uniform resource locator and a sending parameter according to the interface information to be verified and the server IP port information; and a verifying module, configured to perform function verification on a distributed system based on the interface information to be verified, the complete uniform resource locator and the sending parameter. 9.An electronic device, comprising: one or more processors; a storage device for storing one or more computer programs, characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-7.
11. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-7. The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-7.
Citation Information
Patent Citations
Application system, data processing method, computer system and storage medium
CN111831947A
Distributed system architecture verification method and device, electronic equipment and storage medium
CN113626795A