Test method, device, electronic device and storage medium based on multi-channel release

Through the test method based on multi-channel release, test call requests are automatically forwarded, which solves the problems of stuck test progress and high cost of resource isolation, and achieves an efficient test process and cost reduction effect.

CN117118880BActive Publication Date: 2024-08-27NANJING LINGXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310966333.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2024-08-27
Estimated Expiration
2043-08-01

AI Technical Summary

Technical Problem

With existing testing methods, when the testing progress is stuck in a certain process, the entire process is affected, and resource isolation and maintenance costs are high, affecting efficiency and cost control.

Method used

Using a testing method based on multi-channel publishing, by parsing the test call request, the target channel mark and service identifier are obtained, and based on the pre-released service node relationship, the test call request is automatically forwarded to the corresponding service node to realize automated execution of the test process.

Benefits of technology

It improves testing efficiency, reduces testing costs, and avoids the need to frequently configure the testing process. It only needs to perform service release and startup testing. The testing platform can automatically execute the testing process, reducing the need for redeployment of stable version services in the main channel, and reducing maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117118880B
    Figure CN117118880B
Patent Text Reader

Abstract

The present application discloses a test method and device based on multi-channel release, which belongs to the field of computer technology. The method includes: by responding to receiving a test call request, parsing the test call request, obtaining the target channel tag as the channel tag corresponding to the service to be tested and the target service identifier of the current service to be called; according to the corresponding relationship between the service identifier of the service node pre-released in the branch channel and the channel tag, determining the matching relationship between the target channel tag and the target service identifier; then, according to the matching relationship, determining to forward the test call request to the designated service node corresponding to the target service identifier in the corresponding channel. This method does not require testers to frequently configure the test process, only to execute service release and start the test, and the test platform can automatically execute the test process, thereby improving the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a test method, device, electronic device, and computer-readable storage medium based on multi-channel release. Background Art

[0002] During the testing phase, if the testing progress is stuck in a certain process, new testing tasks will be stuck before the problem is solved, affecting the normal operation of the entire process. The current mainstream solution is to create a completely isolated full-link environment through containers. The resource isolation is good, but with the increase in full-link environments, any full-link environment problem may require development to check, which not only takes up a lot of hardware resource costs, but also increases the maintenance and testing costs for development and testing.

[0003] It can be seen that the testing method in the prior art still needs to be improved. Summary of the invention

[0004] The embodiments of the present application provide a testing method and device, an electronic device and a storage medium based on multi-channel release, which can improve testing efficiency and reduce testing costs.

[0005] In a first aspect, an embodiment of the present application provides a testing method based on multi-channel release, including:

[0006] In response to receiving the test call request, the test call request is parsed to obtain a target channel mark and a target service identifier, wherein the target channel mark is: a channel mark corresponding to the service to be tested, and the target service identifier is: a service identifier of the current service to be called;

[0007] Determine the matching relationship between the target corridor mark and the target service mark according to the corresponding relationship between the service mark of the service node pre-published in the branch corridor and the corridor mark;

[0008] Based on whether the target corridor mark includes the corridor mark corresponding to the target service identifier as indicated by the matching relationship, the test call request is forwarded to the designated service node corresponding to the target service identifier in the corresponding corridor.

[0009] In a second aspect, an embodiment of the present application provides a testing device based on multi-channel release, including:

[0010] A channel mark and service identifier acquisition module, used for parsing the test call request in response to receiving the test call request, and obtaining a target channel mark and a target service identifier, wherein the target channel mark is: the channel mark corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called;

[0011] A matching module, used to determine the matching relationship between the target corridor mark and the target service mark according to the corresponding relationship between the service mark of the service node pre-published in the branch corridor and the corridor mark;

[0012] A call forwarding module is used to forward the test call request to a designated service node corresponding to the target service identifier in the corresponding channel based on whether the target channel tag includes the channel tag corresponding to the target service identifier as indicated by the matching relationship.

[0013] In a third aspect, an embodiment of the present application further discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the test method based on multi-channel release described in the embodiment of the present application is implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the test method based on multi-channel release disclosed in an embodiment of the present application.

[0015] The test method based on multi-channel release disclosed in the embodiment of the present application, in response to receiving a test call request, parses the test call request, obtains a target channel tag and a target service identifier, wherein the target channel tag is: the channel tag corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called; according to the corresponding relationship between the service identifier of the service node pre-published in the branch channel and the channel tag, determines the matching relationship between the target channel tag and the target service identifier; according to the indication of the matching relationship, whether the target channel tag includes the channel tag corresponding to the target service identifier, forwards the test call request to the designated service node corresponding to the target service identifier in the corresponding channel. This method does not require testers to frequently configure the test process, only needs to execute the service release and start the test, and the test platform can automatically execute the test process, thereby improving the test efficiency.

[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0018] Figure 1 It is a flow chart of a test method based on multi-channel release disclosed in an embodiment of the present application;

[0019] Figure 2 It is a schematic diagram of the system architecture for implementing the test method based on multi-channel release disclosed in the embodiment of the present application;

[0020] Figure 3 It is a schematic diagram of the execution scenario of the test method disclosed in the embodiment of the present application;

[0021] Figure 4 It is a structural schematic diagram of a test device based on multi-channel release disclosed in an embodiment of the present application;

[0022] Figure 5 A block diagram schematically shows an electronic device for executing the method according to the present application; and

[0023] Figure 6 A storage unit for holding or carrying a program code for implementing the method according to the present application is schematically shown. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] The present application discloses a test method based on multi-channel release, such as Figure 1 As shown, the method includes: steps 110 to 130.

[0026] Step 110, in response to receiving the test call request, parse the test call request to obtain the target channel mark and the target service identifier.

[0027] The embodiment of the present application discloses a test method based on multi-channel release, which is applied to a test platform, wherein the test platform is deployed with multiple traffic forwarding modules in a distributed manner. The traffic forwarding module is used to forward the test call request to a suitable service node for execution according to preset rules.

[0028] The target channel mark is: the channel mark corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called.

[0029] In the embodiment of the present application, in order to avoid the mutual influence between distributed development and multi-service testing, a multi-channel publishing technology is used to perform application testing. Figure 2 As shown, two service call branches are created in the embodiment of the present application, namely: the main channel and the branch channel, wherein the stable version service of each service of the target application is deployed in the main channel, and the test version service of the service to be tested of the target application is deployed in the branch channel. Through the service publishing system of the test platform, the service can be published to the corresponding service node in the corresponding channel.

[0030] Optionally, the stable version service in the main channel is updated regularly, or updated when the preset conditions are met. The test version service in the branch channel is released in containers according to the test needs.

[0031] For example, for the target application, the stable versions of service A, service B, service C, and service D that implement the target application functions are deployed in the main corridor. When the target application has new development requirements, and after the development is completed for the new development requirements, when the services involved in the requirements need to be tested, a branch corridor can be created, and the test version of the service to be tested can be deployed in the branch corridor.

[0032] In the embodiments of the present application, Figure 2 As shown, multiple traffic forwarding modules are pre-deployed in the test platform to forward the service calls in the service call link of the target application to the main channel or the branch channel.

[0033] Optionally, the traffic forwarding module is pre-deployed in the test entry gateway and the service node, such as Figure 2The route-plugin plug-in and rpc-route-plugin plug-in in . The traffic forwarding module forwards traffic according to the service identifier and / or corridor tag. For example, when the service identifier and corridor tag of the service to be called are specified in the current test call request, the traffic forwarding module can forward the service call corresponding to the test call request to the corresponding service node in the branch corridor. For another example, when the service identifier of the service to be called is specified in the current test call request, and the corridor tag of the service to be called is not specified, the traffic forwarding module can forward the service call corresponding to the test call request to the corresponding service node in the main corridor. Therefore, in the process of transmitting the test call request, the corridor tags of each service to be tested need to be transmitted at the same time.

[0034] Among them, the traffic forwarding module (such as route-plugin plug-in) deployed in the test entry gateway can control HTTP (Hypertext Transfer Protocol) requests to be forwarded to the specific service node of the service according to preset rules. The traffic forwarding module (such as rpc-route-plugin plug-in) deployed in the service node of the business application can control RPC (Remote Procedure Call Protocol) requests to be forwarded to a specific service node according to preset rules.

[0035] In an embodiment of the present application, by carrying a specific tag in the request header of an HTTP request or an RPC request, which is recorded as a "corridor tag" in the embodiment of the present application, the route-plugin plug-in and the rpc-route-plug-in plug-in can process according to the corridor tag carried in the request header and forward the request to a service node in the link that matches the corridor tag.

[0036] In the embodiments of the present application, Figure 2 As shown, the test platform also includes: a registration center. The services executed by the test platform need to be registered in the test center, so that the services running in the test platform can call each other.

[0037] In the prior art, in the process of calling a single-process service, the call parameters can be transferred through the request header. However, in the process of transmitting the test call request of the present application through the RPC protocol, in the case of multi-threaded calls, the request header may be discarded. In order to solve the situation where the request header is discarded and the corridor mark cannot be passed between service nodes, in some embodiments of the present application, by combining distributed link tracking technology, the corridor mark is passed between the test entry gateway and the service node of the business service, and between the service nodes of the business service.

[0038] Optionally, the request header in the test call request is generated by the following method: by tracking the transmission process of the test call request, obtaining the link tracking context of the current test call request, and adding the link tracking context to the request header of the test call request for the next hop service.

[0039] Optionally, the process of tracking the transmission of the test call request includes: during the service startup process, embedding a link data collection method in the code of the service; creating a link tracking context corresponding to the link data collection method, and transmitting the target corridor mark collected by the link data collection method through the link tracking context.

[0040] In an embodiment of the present application, a link data collection method can be embedded in the code of the started service during the service startup process. Afterwards, the transmission process of the test call request is tracked by the link data collection method, the link tracking context of the current test call request is obtained, and the link tracking context is added to the request header of the test call request for the next hop service.

[0041] For example, you can add code to the application to create a Span. Span is the smallest unit of link data collection in SkyWalking (a full-link tracing system) and can be understood as a method. Represents an operation on a service. In an embodiment of the present application, Span can be used to track the delivery of test call requests. Furthermore, the Spans of different services are linked using TraceContext (link tracing context). TraceContext is a context object used to pass tracing information between services. When passing a request, the TraceContext of the current Span is added to the request header so that downstream services can obtain and create the corresponding Span. Optionally, the link tracing context can be a global object.

[0042] In the process of passing the test call request, TraceContext can be passed across processes. For example, if the current service needs to call other services, the TraceContext of the current Span needs to be added to the request header and the request is sent to the downstream service. After receiving the request, the downstream service can extract the TraceContext from the request header and use it to create the corresponding Span, thereby realizing the tracking of the test call traffic forwarding information such as the corridor mark in the test call request.

[0043] Among them, the link data collection method is an operation method of the distributed tracking system pre-deployed for the traffic forwarding module.

[0044] Optionally, the test method based on multi-channel release disclosed in the embodiment of the present application further includes: in response to service startup, a link data collection method embedded in the service code of the service.

[0045] For example, an agent (a bytecode arrangement technology provided by Java) access method can be adopted, and the agent can be embedded into the service code during the service startup process. Among them, the agent can execute the link data collection method.

[0046] The link data collection method is used to track the transfer of the test call request, obtain the link tracking context of the current service, and add the link tracking context to the request header of the test call request for the next hop service.

[0047] In the embodiment of the present application, the test entry gateway and the service node of the business service are both service nodes.

[0048] In some embodiments of the present application, it is also possible to set a global environment variable and pass the corridor mark through the global environment variable.

[0049] The following describes the process of receiving a test call request in conjunction with a specific application scenario.

[0050] For example, for a target application, it is necessary to call services A, B, C, and D in sequence to complete the function of the target application. When service A needs to be updated, after the R&D personnel complete the development of service A, they need to release a service for this demand.

[0051] The tester submits the release of service A to the test platform. The test platform will generate a tag for service A (i.e., the service to be tested) according to the information of service A and the preset rules, which is used to uniquely identify the service, which is recorded as "corridor tag" in the embodiment of the present application. Next, the tester can start the test operation of service A based on the preset test case by inputting the tag into the test platform.

[0052] In an embodiment of the present application, the service to be tested is published through a container, and the container sets environment variables in the publishing POD (i.e., service node), such as the corridor mark of the service. A service can have multiple PODs. During the startup process, the service POD will read the environment variables and mark the POD according to the value of the environment variables. For example, if there are multiple requirements and multiple people are developing at the same time, after the development of requirement A is completed, the development environment is published, and the published POD will be marked with requirement A, such as the aforementioned corridor mark. Similarly, when requirement B is published, the published POD will be marked with requirement B. In this way, each POD will be marked with the corresponding requirement, that is, the corridor mark of the corresponding service.

[0053] In the embodiment of the present application, the POD is equivalent to a service node, and the mark marked on each service node corresponds to the corridor mark corresponding to the service node.

[0054] After the service release is completed, the tester can obtain the corridor mark of the service to be tested, such as the corridor version number. The corridor mark corresponds to the service to be tested one by one. In the embodiment of the present application, the service node deployed in the main corridor is the node of the stable version service, and the service node deployed in the branch corridor is the node of the test version service. That is, the service node in the main corridor provides the stable version service, and the service node in the branch corridor provides the service to be tested.

[0055] Optionally, the test call request may be issued through a test portal such as a web page or an application program, or may be transmitted between service nodes. The following describes the processing of the test call request with examples for these two situations.

[0056] (I) Processed by the traffic forwarding module in the test entry gateway

[0057] For example, the tester can input the channel tag of the service to be tested through the test client entrance of the target application. After that, the test client generates a test call request based on the service identifier of the first-hop service in the service call link of the target application and the channel tag of the service to be tested, and sends the test call request to the test platform. The test platform will receive the test call request through the pre-deployed traffic forwarding module.

[0058] For example, the traffic forwarding module deployed in the test entry gateway of the test platform is responsible for forwarding HTTP traffic.

[0059] Optionally, the traffic forwarding module deployed in the test entry gateway may be, for example, a Kong gateway (an open source traffic gateway). In the embodiment of the present application, traffic gateways implemented by other technologies may also be used, which are not listed one by one here.

[0060] Optionally, the service identifier includes but is not limited to: a service name.

[0061] For example, after the tester inputs the service to be tested through the test client of the target application, the test client can generate a test call request based on the HTTP protocol according to the service identifier matched by itself or the service identifier configured by the tester, as well as the channel mark (such as the channel version number) of the service to be tested input by the tester. The service identifier can be a computer-recognizable symbol that can uniquely identify the service, such as the service name of the target application.

[0062] Optionally, the tunnel marker may be encapsulated into a request header of an HTTP request so as to be transmitted to a traffic forwarding module through a test call request.

[0063] Optionally, parsing the test call request to obtain a target channel tag and a target service identifier includes: parsing the test call request to obtain a request header and a target service identifier; parsing the request header to obtain a target channel tag.

[0064] When the traffic forwarding module deployed in the test entry gateway receives the test call request sent based on the HTTP protocol, it can obtain the request header and the service identifier carried in the test call request by parsing the test call request. The service identifier is the service identifier (such as the service name) of the current service to be called.

[0065] Optionally, parsing the request header to obtain the target corridor tag includes: parsing the request header to obtain a link tracking context; and obtaining the target corridor tag through the link tracking context.

[0066] Furthermore, a traffic forwarding module deployed at the test entry gateway parses the request header to obtain other information carried in the request header.

[0067] In an embodiment of the present application, the test call request received by the traffic forwarding module deployed in the test entry gateway is sent by the test client of the test platform. The test client can add a corridor mark of the service to be tested in the request header of the test call request according to the test needs, which is recorded as "target corridor mark" in the embodiment of the present application. Optionally, the request header of the test call request can include one or more target corridor marks.

[0068] For example, when the service call chain of the target application is service A, service B, service C, and service D, if service B and service C need to be redeveloped and released due to demand changes, service B and service C can be tested at the same time. In this case, the test client can add the corridor mark of service B and service C in the request header of the test call request according to the configuration of the tester. Alternatively, a service can be selected for testing. In this case, the corridor mark of a service to be tested is added in the request header of the test call request.

[0069] (II) Processing by the traffic forwarding module in the service node of the business application

[0070] During the test, the target application needs to call multiple services in sequence. Taking the target application's service call chain as service A, service B, service C, and service D as an example, after the test entry gateway forwards the test call request to the designated service node of service A, service A needs to further call service B after executing the corresponding test case. At this time, service A needs to send a test call request to service B and pass the corridor mark of the service to be tested to service B.

[0071] In an embodiment of the present application, a distributed traffic forwarding module, such as an rpc-route-plugin plug-in, is pre-deployed at a service node of a business service. The rpc-route-plugin plug-in can control the forwarding of rpc requests to a specific node of the service according to rules.

[0072] As mentioned above, when service A sends a test call request to service B, the link data collection method embedded in service A can obtain the link tracking context of the current service and add the link tracking context to the request header of the test call request to service B. Accordingly, the traffic forwarding module deployed at the service node of the business service, for example, the rpc-route-plugin plug-in deployed at the current service node of service A, will forward the test call request to the designated service node of service B according to the service identifier and corridor mark carried in the request header.

[0073] Correspondingly, parsing the test call request to obtain a target channel tag and a target service identifier includes: parsing the test call request to obtain a request header and a target service identifier; parsing the request header to obtain a target channel tag.

[0074] For example, after receiving the test call request sent based on the RPC protocol, the rpc-route-plugin plug-in (i.e., the traffic forwarding module) can obtain the request header and the service identifier carried in the test call request by parsing the test call request. The service identifier is the service identifier (such as the service name) of the current service to be called.

[0075] Furthermore, the rpc-route-plugin parses the request header to obtain a link trace context TraceContext, wherein the link trace context TraceContext is used to transfer a target corridor mark, and the target corridor mark can be obtained through the link trace context.

[0076] When the tunnel tag is passed through the global environment variable, the tunnel tag can be read from the global environment variable when sending a service call request to the downstream service node, and the tunnel tag can be added to the test call request.

[0077] Step 120, determining the matching relationship between the target corridor mark and the target service mark according to the corresponding relationship between the service mark of the service node pre-published in the branch corridor and the corridor mark.

[0078] Next, the traffic forwarding module determines whether there is a test version service of the current service to be called (ie, the service corresponding to the target service identifier) ​​in the branch channel, and the target channel tag includes the channel tag of the test version service.

[0079] Optionally, determining the matching relationship between the target corridor tag and the target service identifier based on the correspondence between the service identifier of the service node pre-published in the branch corridor and the corridor tag includes: obtaining the correspondence between the service identifier of the service node pre-published in the branch corridor and the corridor tag; searching for the correspondence between the target service identifier and the target corridor tag in the correspondence to obtain a search result; in response to the search result indicating that the correspondence between the target service identifier and the target corridor tag is found, determining that the target corridor tag and the target service identifier match; in response to the search result indicating that the correspondence between the target service identifier and the target corridor tag is not found, determining that the target corridor tag and the target service identifier do not match.

[0080] In some embodiments of the present application, when a service node is published in a branch corridor, the service identifier and corridor mark of each published service node can be recorded at the same time as a set of correspondences between the service identifier and corridor mark corresponding to the service node.

[0081] In some other embodiments of the present application, the service nodes published in the branch corridor and the service nodes published in the main corridor need to be called by the traffic forwarding module or the business service node. Therefore, when the service is started, it must first be registered in the service registration center. For example, the HTTP service can be registered through the first registration center, and the RPC service can be registered through the second registration center. Among them, the first registration center includes but is not limited to any of the following distributed components: Consul, nacos, etcd; the second registration center includes but is not limited to any of the following distributed components: zookeeper, nacos, etcd, etc.

[0082] Accordingly, the registration information of the service can be obtained through the first registration center and the second registration center. The service includes a stable version service and a test version service. Through the preset registration center, the correspondence between the service identifier of the service node (i.e., the service node corresponding to the test version service) pre-published in the branch channel and the channel mark can be obtained.

[0083] Next, the target service identifier can be matched with the service identifier in the obtained correspondence relationship to find the service identifier that successfully matches the target service identifier. After that, the corridor mark corresponding to the successfully matched service identifier is further obtained according to the above correspondence relationship as the matching corridor mark. Among them, the matching corridor mark can include one corridor mark or multiple corridor marks. The matching corridor mark is the corridor mark of the current service to be tested.

[0084] Then, each matching corridor mark is matched with the target corridor mark one by one. If a matching corridor mark matches a target corridor mark, a search result indicating that the corresponding relationship between the target service identifier and the target corridor mark is found is obtained; if all matching corridor marks do not match all target corridor marks, a search result indicating that the corresponding relationship between the target service identifier and the target corridor mark is not found is obtained.

[0085] For example, if the test call request carries the channel tag X of service A, service node 1 of service A is pre-published in the branch channel, and channel tag X is set for service node 1, when the current service to be called is service A, a search result indicating that the correspondence between the target service identifier and the target channel tag has been found can be obtained; when the current service to be called is service B, a search result indicating that the correspondence between the target service identifier and the target channel tag has not been found can be obtained.

[0086] Step 130, based on whether the target corridor mark includes the corridor mark corresponding to the target service identifier as indicated by the matching relationship, forward the test call request to the designated service node corresponding to the target service identifier in the corresponding corridor.

[0087] Optionally, based on the indication of the matching relationship, whether the target corridor mark includes the corridor mark corresponding to the target service identifier, the test call request is forwarded to the designated service node corresponding to the target service identifier in the corresponding corridor, including: in response to the matching relationship indication: the target corridor mark includes the corridor mark corresponding to the target service identifier, the test call request is forwarded to the service node corresponding to the target service identifier in the branch corridor and is provided with the target corridor mark.

[0088] If the above steps are executed and the correspondence between the target service identifier and the target channel mark is found, it means that the test version service of the service to be called has been released in the branch channel, and the current test call request needs to test a service on a service system node with a specified channel mark set. The traffic forwarding module will forward the test call request to the service node with the specified channel mark set in the branch channel corresponding to the target service identifier.

[0089] Optionally, the test call request is forwarded to the designated service node corresponding to the target service identifier in the corresponding channel based on whether the target channel tag includes the channel tag corresponding to the target service identifier as indicated by the matching relationship, and also includes: in response to the matching relationship indication: the target channel tag does not include the channel tag corresponding to the target service identifier, the test call request is forwarded to the service node corresponding to the target service identifier in the main channel.

[0090] If the above steps are executed and the correspondence between the target service identifier and the target channel mark is not found, it means that the test version service of the current service to be called has not been published in the branch channel, or the test service version of the current service to be called does not need to be tested at present. In this case, the traffic forwarding module forwards the test call request to the service node corresponding to the target service identifier in the main channel.

[0091] Combine the following Figure 3 The specific implementation of the test method based on multi-channel release disclosed in the embodiment of the present application is further illustrated by examples.

[0092] For example, the target application needs to call services A, B, C, and D in sequence during its execution. The service link corresponding to the test call request of the target application is: test entry gateway->service A->service B->service C->service D. Assuming that service B needs to be tested, the test version of service B needs to be published to a service node serviceB' in the branch channel first, and the service node serviceB' is marked with the pre-acquired channel mark X.

[0093] On the other hand, before executing the test on the target application, each service called by the target application in sequence needs to be registered in the preset registration center. Optionally, the preset registration center may include: a first registration center for registering HTTP services (such as Figure 3 The consul registry in the RPC service registry) and the second registry for registering RPC services (such as Figure 3 The zookeeper registration center in ).

[0094] Afterwards, the tester initiates a test operation through the test client of the test platform and enters the identifier of the target application and the channel mark X of the test service B. The test client generates a test call request based on the tester's test operation and adds the channel mark X to the request header of the test call request. Optionally, the generated test call request carries the call entry of the target application (such as the service identifier of the first-hop service of the target application—service A) and the channel mark of the service to be tested (such as channel mark X). Afterwards, the test client sends the test call request to the test entry gateway of the test platform (such as Figure 3 kong gateway in ).

[0095] like Figure 3 As shown, the traffic forwarding module route-plugin is pre-set in the kong gateway. After receiving the test call request, the traffic forwarding module route-plugin parses the test call request to obtain the call entry of the target application and the corridor mark X corresponding to the service B to be tested. The kong gateway can obtain the service identifier of the first hop service of the target application (such as the service identifier of service A) through the first registration center or the second registration center as the target service identifier.

[0096] Then, the traffic forwarding module route-plugin determines whether there is a corridor tag matching the target service identifier in the target corridor tag based on the correspondence between the service identifier of the service node pre-published in the branch corridor and the corridor tag (such as the correspondence between the service node serviceB' of service B and the corridor tag X). That is, it determines whether the service to be called currently is a service that needs to be tested. In this test scenario, the target service identifier (such as the service identifier of service A) has no service node deployed in the branch corridor, so there is no corridor tag registered, and the traffic forwarding module route-plugin cannot find a corridor tag matching the service identifier of service A in the target corridor tag. In this case, the traffic forwarding module route-plugin believes that the service to be called currently is not a service that needs to be tested, so it forwards the test call request to the service node of the stable version service of service A deployed in the main corridor (such as Figure 3 serviceA) in is executed.

[0097] When service node serviceA executes the current test case according to the program code of service A, it needs to call service B. The program code of service A executed in service node serviceA generates a test call request according to the built-in service call link, wherein the test call request carries the service identifier of the next-hop service (such as service B).

[0098] In some embodiments of the present application, the service sends the test call request to the next-hop service through a traffic forwarding module (such as an rpc-route-plugin plug-in) deployed on the service node. In order to avoid the target corridor mark being discarded during the test call process, the traffic forwarding module needs to uniformly add the target corridor mark to the request header of the test call request to be sent before sending the test call request. For example, the traffic forwarding module obtains the link tracking context TraceContext of the current service through the link data collection method Span pre-embedded in each service, and adds the link tracking context to the request header of the test call request to be sent. Among them, the link tracking context TraceContext is used to pass the target corridor mark.

[0099] After obtaining the above test call request, the distributed traffic forwarding module (such as the rpc-route-plugin plug-in) parses the test call request to obtain the service identifier of service B. Further, by parsing the request header, the target corridor mark passed by the link tracking context TraceContext is obtained.

[0100] The traffic forwarding module matches the target channel tag with the channel tag set by the service node serviceB' of service B deployed in the branch channel according to the matching method described above, and determines that the target channel tag includes the channel tag X of the service node serviceB', then forwards the test call request to the service node serviceB', and the test version service B in the service node serviceB' executes the current test case.

[0101] According to this method, the stable version service of service A, the test version service of service B, the stable version service of service C, and the stable version service of service D are called in sequence to complete a round of testing of the target application.

[0102] After testing, if the test version of service B of the target application passes the test, the next step of production release verification can be carried out. If the test version of service B passes the production release verification, the service node serviceB' of service B can be released to achieve resource recycling, thereby saving the occupation of test resources. If the test fails or the production release verification fails, retesting is required.

[0103] The test method based on multi-channel release disclosed in the embodiment of the present application, in response to receiving a test call request, parses the test call request, obtains a target channel tag and a target service identifier, wherein the target channel tag is: the channel tag corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called; according to the corresponding relationship between the service identifier of the service node pre-published in the branch channel and the channel tag, the matching relationship between the target channel tag and the target service identifier is determined; according to the indication of the matching relationship, whether the target channel tag includes the channel tag corresponding to the target service identifier, the test call request is forwarded to the designated service node corresponding to the target service identifier in the corresponding channel. This method does not require testers to frequently configure the test process, only needs to execute service release and start the test, and the test platform can automatically execute the test process, thereby improving the test efficiency. On the other hand, the stable version service deployed in the main channel does not need to be redeployed for each test, but only needs to be updated regularly, which further reduces the maintenance cost of the test system.

[0104] On the other hand, the test method based on multi-channel release disclosed in the embodiment can automatically search for the test version service of the service to be tested of the target application according to the configured rules, and execute the test case in combination with the stable version service, so that multiple services can be tested simultaneously without affecting each other, further improving the test efficiency. For example, there are three requirements for service A, service B, and service C, which are developed by different developers and released to the test environment for verification by testers. If there are defects or errors after the service A requirement is released, resulting in service A being unavailable, the stability of the entire test environment will be affected. After using the test method based on multi-channel release disclosed in the embodiment of the present application, a new service node will be created for the test demand of service A. This service node is marked with a specific channel mark, for example, X. When verifying the demand for service A, the tester only needs to carry the channel mark X in the request header, and the request will be forwarded to the service node of service A in the branch channel. The defects or errors of service A will only affect the execution of the service node of service A in the branch channel, and the main channel will not be affected in any way, thereby ensuring the stability of the test environment and avoiding the preemption of test resources by service A.

[0105] On the other hand, the stable version service in the main channel can also be used for production verification and release, which improves the utilization rate of stable version service nodes.

[0106] The present application also discloses a test device based on multi-channel release, such as Figure 4 As shown, the device comprises:

[0107] The channel mark and service identifier acquisition module 410 is used to parse the test call request in response to receiving the test call request, and obtain the target channel mark and target service identifier, wherein the target channel mark is: the channel mark corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called;

[0108] A matching module 420, configured to determine a matching relationship between the target corridor mark and the target service mark according to a corresponding relationship between a service mark of a service node pre-published in a branch corridor and a corridor mark;

[0109] The call forwarding module 430 is used to forward the test call request to the designated service node corresponding to the target service identifier in the corresponding channel based on whether the target channel tag includes the channel tag corresponding to the target service identifier as indicated by the matching relationship.

[0110] Optionally, the call forwarding module 430 is further configured to respond to the matching relationship indication: the target corridor mark includes the corridor mark corresponding to the target service identifier, and forward the test call request to the service node in the branch corridor corresponding to the target service identifier and having the target corridor mark set therein;

[0111] The call forwarding module 430 is further used to respond to the matching relationship indication: the target channel tag does not include the channel tag corresponding to the target service identifier, and forward the test call request to the service node corresponding to the target service identifier in the main channel.

[0112] Optionally, the corridor mark and service identification acquisition module 410 is further used to:

[0113] Parse the test call request to obtain the request header and the target service identifier;

[0114] Parse the request header to obtain the target channel tag.

[0115] Optionally, parsing the request header to obtain a target channel tag includes:

[0116] Parsing the request header to obtain a link tracking context;

[0117] The target corridor label is obtained through the link tracking context.

[0118] Optionally, the request header in the test call request is generated by the following method:

[0119] By tracking the transfer process of the test call request, the link tracking context of the current test call request is obtained, and the link tracking context is added to the request header of the test call request for the next hop service.

[0120] Optionally, the tracking of the transfer process of the test call request includes:

[0121] During the service startup process, a link data collection method embedded in the code of the service;

[0122] A link tracking context corresponding to the link data collection method is created, and the target corridor tag collected by the link data collection method is transferred through the link tracking context.

[0123] Optionally, the matching module 420 is further configured to:

[0124] Obtaining the correspondence between the service identifier of the service node pre-published in the branch tunnel and the tunnel tag;

[0125] Searching for a correspondence between the target service identifier and the target corridor mark in the correspondence to obtain a search result;

[0126] In response to the search result indication: finding a correspondence between the target service identifier and the target corridor mark, determining that the target corridor mark matches the target service identifier;

[0127] In response to the search result indicating that no corresponding relationship between the target service identifier and the target corridor mark is found, it is determined that the target corridor mark and the target service identifier do not match.

[0128] The test device based on multi-channel release disclosed in the embodiment of the present application is used to implement the test method based on multi-channel release described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here, and the specific implementation methods of the corresponding steps in the method embodiment can be referred to.

[0129] The test device based on multi-channel release disclosed in the embodiment of the present application, in response to receiving a test call request, parses the test call request, obtains a target channel tag and a target service identifier, wherein the target channel tag is: the channel tag corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called; according to the corresponding relationship between the service identifier of the service node pre-published in the branch channel and the channel tag, the matching relationship between the target channel tag and the target service identifier is determined; according to the indication of the matching relationship, whether the target channel tag includes the channel tag corresponding to the target service identifier, the test call request is forwarded to the designated service node corresponding to the target service identifier in the corresponding channel. This method does not require testers to frequently configure the test process, only needs to execute service release and start the test, and the test platform can automatically execute the test process, thereby improving the test efficiency. On the other hand, the stable version service deployed in the main channel does not need to be redeployed for each test, but only needs to be updated regularly, further reducing the maintenance cost of the test system.

[0130] On the other hand, the test device based on multi-channel release disclosed in the embodiment can automatically search for the test version service of the service to be tested of the target application according to the configured rules, and execute the test case in combination with the stable version service, so that multiple services can be tested simultaneously without affecting each other, further improving the test efficiency. For example, there are three requirements for service A, service B, and service C, which are developed by different developers and released to the test environment for verification by testers. If there are defects or errors after the service A requirement is released, resulting in service A being unavailable, the stability of the entire test environment will be affected. After using the test method based on multi-channel release disclosed in the embodiment of the present application, a new service node will be created for the test demand of service A. This service node is marked with a specific channel mark, for example, X. When verifying the demand for service A, the tester only needs to carry the channel mark X in the request header, and the request will be forwarded to the service node of service A in the branch channel. The defects or errors of service A will only affect the execution of the service node of service A in the branch channel, and the main channel will not be affected in any way, thereby ensuring the stability of the test environment and avoiding the preemption of test resources by service A.

[0131] On the other hand, the stable version service in the main channel can also be used for production verification and release, which improves the utilization rate of stable version service nodes.

[0132] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0133] The above is a detailed introduction to a test method and device based on multi-channel release provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and a core idea. At the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0134] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0135] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiment of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0136] For example, Figure 5An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device traditionally includes a processor 510 and a memory 520 and a program code 530 stored on the memory 520 and can be run on the processor 510, and the processor 510 implements the method described in the above embodiment when executing the program code 530. The memory 520 can be a computer program product or a computer-readable medium. The memory 520 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 520 has a storage space 5201 for the program code 530 of the computer program for executing any method step in the above method. For example, the storage space 5201 for the program code 530 can include various computer programs for implementing the various steps in the above method respectively. The program code 530 is a computer-readable code. These computer programs can be read from one or more computer program products or written into the one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. The computer program includes a computer readable code, and when the computer readable code is executed on an electronic device, the electronic device is caused to execute the method according to the above embodiment.

[0137] The embodiment of the present application further discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the test method based on multi-channel release as described in the embodiment of the present application are implemented.

[0138] Such a computer program product may be a computer-readable storage medium, which may have a computer-readable storage medium having a Figure 5 The memory 520 in the electronic device shown in the figure is similar to the storage segment, storage space, etc. The program code can be compressed and stored in the computer-readable storage medium in an appropriate form. The computer-readable storage medium is generally as shown in the reference Figure 6 The portable or fixed storage unit. Generally, the storage unit includes computer readable code 530', which is a code read by a processor. When the code is executed by the processor, each step in the method described above is implemented.

[0139] The term "one embodiment", "embodiment" or "one or more embodiments" herein means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. In addition, please note that the examples of the term "in one embodiment" here do not necessarily all refer to the same embodiment.

[0140] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0141] In the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A test method based on multi-channel release, characterized in that: The method is applied to a service node, comprising: In response to receiving the test call request, the test call request is parsed to obtain a target channel mark and a target service identifier, wherein the target channel mark is: a channel mark corresponding to the service to be tested, and the target service identifier is: a service identifier of the current service to be called; Determine the matching relationship between the target corridor mark and the target service mark according to the corresponding relationship between the service mark of the service node pre-published in the branch corridor and the corridor mark; According to the indication of the matching relationship, whether the target corridor mark includes the corridor mark corresponding to the target service identifier, forwarding the test call request to the designated service node corresponding to the target service identifier in the corresponding corridor; Wherein, according to the indication of the matching relationship, whether the target corridor mark includes the corridor mark corresponding to the target service identifier, forwarding the test call request to the designated service node corresponding to the target service identifier in the corresponding corridor includes: In response to the matching relationship indication: the target corridor mark includes the corridor mark corresponding to the target service identifier, forwarding the test call request to the service node in the branch corridor corresponding to the target service identifier and having the target corridor mark set therein; In response to the matching relationship indication: the target corridor mark does not include the corridor mark corresponding to the target service identifier, forwarding the test call request to the service node corresponding to the target service identifier in the main corridor; The test call request includes a request header, and the request header is generated by the following method: By tracking the transmission process of the test call request, the link tracking context of the current test call request is obtained, and the link tracking context is added to the request header of the test call request for the next hop service; the link tracking context is used to transmit the target corridor tag.

2. The method according to claim 1, characterized in that The step of parsing the test call request to obtain a target channel mark and a target service identifier includes: Parse the test call request to obtain the request header and the target service identifier; Parse the request header to obtain the target channel tag.

3. The method according to claim 2, characterized in that The step of parsing the request header to obtain a target channel tag includes: Parsing the request header to obtain a link tracking context; The target corridor label is obtained through the link tracking context.

4. The method according to claim 1, characterized in that The tracking of the transmission process of the test call request includes: During the service startup process, a link data collection method embedded in the code of the service; A link tracking context corresponding to the link data collection method is created, and the target corridor tag collected by the link data collection method is transferred through the link tracking context.

5. The method according to claim 1, characterized in that Determining the matching relationship between the target corridor mark and the target service identifier according to the corresponding relationship between the service identifier of the service node pre-published in the branch corridor and the corridor mark includes: Obtaining the correspondence between the service identifier of the service node pre-published in the branch tunnel and the tunnel tag; Searching for a correspondence between the target service identifier and the target corridor mark in the correspondence to obtain a search result; In response to the search result indication: finding a correspondence between the target service identifier and the target corridor mark, determining that the target corridor mark matches the target service identifier; In response to the search result indicating that no corresponding relationship between the target service identifier and the target corridor mark is found, it is determined that the target corridor mark and the target service identifier do not match.

6. A test device based on multi-channel release, characterized in that Applied to a service node, the device comprises: A channel mark and service identifier acquisition module, used for parsing the test call request in response to receiving the test call request, and obtaining a target channel mark and a target service identifier, wherein the target channel mark is: the channel mark corresponding to the service to be tested, and the target service identifier is: the service identifier of the current service to be called; A matching module, used to determine the matching relationship between the target corridor mark and the target service mark according to the corresponding relationship between the service mark of the service node pre-published in the branch corridor and the corridor mark; A call forwarding module, configured to forward the test call request to a designated service node corresponding to the target service identifier in a corresponding corridor according to whether the target corridor tag includes the corridor tag corresponding to the target service identifier as indicated by the matching relationship; Wherein, according to the indication of the matching relationship, whether the target corridor mark includes the corridor mark corresponding to the target service identifier, forwarding the test call request to the designated service node corresponding to the target service identifier in the corresponding corridor includes: In response to the matching relationship indication: the target corridor mark includes the corridor mark corresponding to the target service identifier, forwarding the test call request to the service node in the branch corridor corresponding to the target service identifier and having the target corridor mark set therein; In response to the matching relationship indication: the target corridor mark does not include the corridor mark corresponding to the target service identifier, forwarding the test call request to the service node corresponding to the target service identifier in the main corridor; The test call request includes a request header, and the request header is generated by the following method: By tracking the transmission process of the test call request, the link tracking context of the current test call request is obtained, and the link tracking context is added to the request header of the test call request for the next hop service; the link tracking context is used to transmit the target corridor tag.

7. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, characterized in that: When the processor executes the program code, it implements the test method based on multi-channel release as described in any one of claims 1 to 5.

8. A computer-readable storage medium having program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the test method based on multi-channel release described in any one of claims 1 to 5 are implemented.