Multi-test environment management method, device, equipment and medium for microservices
By assigning key-value pair identifiers to microservices and registering them with the service discovery center, the service coverage problem caused by shared test environments in microservice architecture is solved, achieving efficient multi-environment test management, reducing management costs and improving test speed.
Patent Information
- Application Number
- CN202211531566.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-01
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-12-01
AI Technical Summary
In a microservice architecture, multiple users sharing a single testing environment leads to service overlap, making it impossible to meet the needs of parallel testing. Deploying multiple testing environments increases management costs.
By assigning key-value pairs to the microservices under test, recording and registering them with the preset service discovery center, and using the identifiers to forward test request traffic, isolation between new and old services and environment testing can be achieved.
It reduced the management cost of multiple testing environments, increased the speed of iteration and testing, and enabled the isolation and parallel testing of new and old services.
Smart Images

Figure CN115729762B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of identifier resolution technology, and in particular to a method, apparatus, device and medium for managing multiple test environments for microservices. Background Technology
[0002] As the system's business has grown, the early monolithic architecture has become insufficient to meet the demands of rapid development and deployment. Therefore, the system architecture has continuously evolved, culminating in the current mainstream microservice architecture. In microservice architecture, a business module is broken down into functionally independent microservices with the finest possible granularity, significantly reducing the overall system coupling and meeting the needs of rapid business iteration and continuous development. However, as the business expands and functional iterations increase, sharing a single testing environment often leads to service overlap, making it impossible to meet the needs of parallel testing.
[0003] To address the aforementioned issues, existing methods might deploy multiple test environments, but this incurs high management costs. Therefore, to save costs, traditional methods typically deploy a limited number of test environments, which developers and testers then use alternately by agreement. However, this alternating use of test environments limits the speed of development iterations and testing, impacting development efficiency. Summary of the Invention
[0004] To address the aforementioned technical problems, this specification provides one or more embodiments of a method, apparatus, device, and medium for managing multiple testing environments for microservices.
[0005] One or more embodiments of this specification employ the following technical solutions:
[0006] This specification provides one or more embodiments of a method for managing multiple testing environments for microservices, the method comprising:
[0007] Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested;
[0008] Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0009] If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center;
[0010] The key-value pairs are added to the test request traffic of the microservice under test to perform environmental testing on the microservice under test based on the test request traffic.
[0011] Furthermore, in one or more embodiments of this specification, determining the microservice to be tested specifically includes:
[0012] Get the name of the current microservice in the current microservice architecture and the name of the current microservice architecture;
[0013] Based on the preset program and the name of the current microservice architecture, call the historical microservice architecture of the previous iteration cycle corresponding to the current microservice architecture in the preset database;
[0014] The historical microservices in the historical microservice architecture are obtained, and the current microservices are compared with the historical microservices to determine the current iteration microservices in the current microservice architecture, so as to use the current iteration microservices as the microservices to be tested.
[0015] Optionally, in one or more embodiments of this specification, the step of registering the service based on the key-value pair identifier to register the key-value pair identifier to a preset service discovery center specifically includes:
[0016] The registration request for the microservice to be tested is sent to the pre-built service discovery center; wherein, the registration request includes: service information, key-value pair identifier and callback URL;
[0017] The microservice is registered based on the registration request information, and the key-value pair identifier is registered as metadata to the microservice discovery center and stored in the microservice discovery center's preset service registry.
[0018] Optionally, in one or more embodiments of this specification, adding the key-value pair to the test request traffic of the microservice to be tested specifically includes:
[0019] Obtain the packet format information corresponding to the test request traffic, and determine the packet format corresponding to the test request traffic based on the packet format information; determine the character length of the header packet to be added based on the key-value pair identifier length, and write the key-value pair identifier into the header packet;
[0020] The header message is added to the header of the message format to include the key-value pair in the test request traffic of the microservice to be tested.
[0021] Optionally, in one or more embodiments of this specification, the environmental testing of the microservice under test based on the test request traffic specifically includes:
[0022] Based on the test request traffic, obtain the key-value pair identifier of the microservice to be tested;
[0023] If there are inter-service calls during the environment test, obtain the service identity identifier corresponding to the service to be called;
[0024] Based on the key-value pair identifier and the service identity identifier, the service information in the service registry of the preset service discovery center is searched to realize environment testing between specified microservices.
[0025] Optionally, in one or more embodiments of this specification, the step of searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier to realize environment testing between specified microservices specifically includes:
[0026] Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the preset service discovery center;
[0027] If service information corresponding to the key-value pair identifier is obtained based on the service registry, the service address in the service information is returned.
[0028] Optionally, in one or more embodiments of this specification, after searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the method further includes:
[0029] Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
[0030] This specification provides one or more embodiments of a multi-environment testing management device for microservices, the device comprising:
[0031] The determination module is used to determine the microservice to be tested in order to obtain the key-value pair identifier of the microservice to be tested;
[0032] A binding module is used to record the key-value pair identifier and write the key-value pair identifier into a container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0033] The registration unit is used to register the service based on the key-value pair identifier if the service to be tested is published, so as to register the key-value pair identifier to a preset service discovery center.
[0034] The testing unit is used to add the key-value pairs to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic.
[0035] This specification provides one or more embodiments of a communication acquisition device for a programmable controller, the device comprising:
[0036] At least one processor; and,
[0037] A memory communicatively connected to the at least one processor; wherein,
[0038] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to:
[0039] Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested;
[0040] Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0041] If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center;
[0042] The key-value pairs are added to the test request traffic of the microservice under test to perform environmental testing on the microservice under test based on the test request traffic.
[0043] This specification provides one or more embodiments of a non-volatile computer storage medium storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:
[0044] Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested;
[0045] Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0046] If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center;
[0047] The key-value pairs are added to the test request traffic of the microservice under test to perform environmental testing on the microservice under test based on the test request traffic.
[0048] The above-described at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects:
[0049] By identifying the microservices to be tested and assigning them key-value pairs, testing only requires deploying the microservices that have undergone modifications and incremental changes, thus reducing the management costs of multiple testing environments. After writing the key-value pairs into the test request traffic, each microservice forwards the traffic to a specific microservice within the entire microservice network based on the identifier, achieving isolation between old and new services within a single overall environment and improving the speed of iteration and testing. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In the drawings:
[0051] Figure 1 This specification provides a flowchart illustrating a multi-environment test management method for microservices, as illustrated in an embodiment of the present invention.
[0052] Figure 2 This is a schematic diagram of a multi-environment test management process for microservices, provided as an embodiment of this specification.
[0053] Figure 3 A schematic diagram of the internal structure of a multi-environment test management device for microservices provided in the embodiments of this specification;
[0054] Figure 4 A schematic diagram of the internal structure of a multi-environment test management device for microservices, provided as an embodiment of this specification;
[0055] Figure 5 This is a schematic diagram of the internal structure of a non-volatile storage medium provided in the embodiments of this specification. Detailed Implementation
[0056] This specification provides an embodiment of a multi-environment test management method, apparatus, device, and medium for microservices.
[0057] In a microservice architecture, as business expands and feature iterations increase, sharing a single testing environment often leads to service overlap, making it impossible to meet the needs of parallel testing. To address the need for parallel testing, the first thought is to deploy multiple testing environments, but this incurs significant management costs. The usual approach is to deploy a limited number of testing environments, which developers and testers then use alternately through agreements. The speed of development iterations and testing is limited by the number of testing environments.
[0058] To address the aforementioned technical issues, this embodiment of the specification employs a traffic tagging method, enabling testing of new iterations to deploy only the microservices that have undergone modifications and increments. Each microservice forwards traffic to a specific microservice within the entire microservice network based on its identifier, achieving isolation between new and old services within a unified environment.
[0059] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0060] like Figure 1 As shown in the figure, this specification provides a flowchart illustrating a multi-environment test management method for microservices. Figure 1 It can be seen that the method includes the following steps:
[0061] S101: Determine the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested.
[0062] Firstly, when a new iteration of a microservice to be tested is developed and needs to be deployed for testing, this specification's embodiments first identify the microservice to be tested and obtain its key-value pair identifier. It should be noted that the key-value pair identifier of the microservice to be tested is a key-value pair identifier specified by the developers on the deployment platform. For example, color=red can be used as the key-value pair identifier for a certain microservice to be tested.
[0063] To avoid the impact on test speed when alternating test environments, this specification only requires deploying the modified and incremental microservices when testing new iterations, reducing the cost of managing multiple test environments. Specifically, in one or more embodiments of this specification, determining the microservice to be tested includes the following steps:
[0064] First, the names of the current microservices and the current microservice architecture are obtained. Then, based on the pre-set program and the names of the current microservice architecture, the historical microservice architecture from the previous iteration corresponding to the current microservice architecture is retrieved from the pre-set database. Next, the historical microservices in the historical microservice architecture are retrieved, and by comparing the current microservice with the historical microservices, the current iteration microservice in the current microservice architecture is determined. The current iteration microservice is then selected as the microservice to be tested, achieving the goal of testing and deploying only the incremental part of the microservice network.
[0065] S102: Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested.
[0066] After obtaining the key-value pair identifier of the microservice to be tested through the above steps, the deployment platform records this key-value pair identifier when deploying the microservice. It then writes the key-value pair identifier into the container corresponding to the microservice to be tested, thereby binding the key-value pair identifier to the microservice. This allows for subsequent environment testing based on the key-value pair identifier.
[0067] S103: If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center.
[0068] In order to call the corresponding service based on the preset service discovery center, in this embodiment of the specification, if it is determined that the service to be tested is to be published, then the service is registered according to the key value of the identifier, thereby registering the construction team identifier to the preset service discovery center.
[0069] Specifically, in one or more embodiments of this specification, service registration based on key-value pair identifiers, in order to register the key-value pair identifiers to a preset service discovery center, specifically includes the following steps:
[0070] First, the registration request for the microservice to be tested is sent to the pre-built service discovery center. It should be noted that the registration request includes: service information, key-value pair identifiers, and callback URLs. Then, the microservice is registered based on the registration request information, thereby registering the key-value pair identifiers as metadata to the microservice discovery center and storing them in the pre-built service registry of the microservice discovery center.
[0071] S104: Add the key-value pair to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic.
[0072] To achieve isolation between different sub-environments within a unified testing environment, reducing the cost of managing multiple testing environments and improving iteration and testing speed, this embodiment adds key-value pairs to the test request traffic of the microservice under test. This allows for environment testing of the microservice under test based on the test request traffic, enabling forwarding of traffic between specific services in the call chain based on the tags it carries, thus achieving isolation of the sub-environments.
[0073] Specifically, in one or more embodiments of this specification, adding key-value pairs to the test request traffic of the microservice to be tested includes the following steps:
[0074] First, the message format information corresponding to the test request traffic is obtained to determine the message format of the test request traffic. Then, the character length of the header message to be added is determined according to the key-value pair identifier length, and the key-value pair identifier is written into the header message. The header message is then added to the header of the message format to add the key-value pair to the test request traffic of the microservice under test. In a certain application scenario of this specification, the process of adding the key-value pair to the test request traffic of the service under test is as follows: When testers start testing and verifying new functions, they need to carry the key-value pair identifier corresponding to the microservice under test in the test traffic sent by the client. Continuing with the above example, for instance, header:color=red is carried in the HTTP request header.
[0075] Specifically, in one or more embodiments of this specification, environmental testing of the microservice to be tested based on test request traffic includes the following steps:
[0076] First, the key-value pair identifier of the microservice to be tested is obtained based on the test request traffic. If there are inter-service calls in the environment test, the service identity identifier corresponding to the service to be called is obtained. Then, based on the key-value pair identifier and the microservice identity identifier, the service information in the service registry in the pre-built service discovery center mentioned above is searched, thereby realizing the environment test between the specified microservices.
[0077] Furthermore, in one or more embodiments of this specification, service information is searched in the service registry of a pre-configured service discovery center based on key-value pairs and service identity identifiers to achieve environment testing between specified microservices. This specifically includes the following steps:
[0078] Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the pre-built service discovery center. If service information corresponding to the key-value pair identifier is obtained from the service registry, the service address in the service information is returned.
[0079] Furthermore, in one or more embodiments of this specification, after searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if the service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the method further includes:
[0080] Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
[0081] In other words, in a certain application scenario of this specification's embodiments, when a tester initiates a test, the client carries a specified marker in the test request traffic. When an inter-service call occurs, the client obtains the service address from the service discovery center based on the service's unique identifier and the marker in the traffic. If the service is found, the new iteration's service address is returned. If the service discovery center does not find a service's registration address based on the marker, it returns the service's registration address in the baseline environment, thus forwarding the traffic to that service in the baseline environment. For example... Figure 2 As shown, when managing tests in this way, traffic in the entire call chain is forwarded between specified microservices according to the tags carried in it, which realizes the isolation between new and old services, reduces the cost of managing multiple test environments, and improves the speed of iteration and testing.
[0082] like Figure 3 As shown, this specification provides a schematic diagram of the internal structure of a multi-environment test management device for microservices in one or more embodiments. Figure 3 It is known that a multi-environment test management device for microservices includes:
[0083] The determination module 301 is used to determine the microservice to be tested in order to obtain the key-value pair identifier of the microservice to be tested;
[0084] The binding module 302 is used to record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0085] Registration unit 303 is used to register the service based on the key-value pair identifier if the service to be tested is published, so as to register the key-value pair identifier to a preset service discovery center;
[0086] The test unit 304 is used to add the key-value pair to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic.
[0087] like Figure 4 As shown, this specification provides a schematic diagram of the internal structure of a multi-environment test management device for microservices in one or more embodiments. Figure 4 It can be seen that a multi-environment test management device for microservices includes:
[0088] At least one processor 401; and,
[0089] The memory 402 is communicatively connected to the at least one processor 401; wherein,
[0090] The memory 402 stores instructions that can be executed by the at least one processor 401, the instructions being executed by the at least one processor 401 to enable the at least one processor 401 to:
[0091] Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested;
[0092] Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0093] If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center;
[0094] The key-value pairs are added to the test request traffic of the microservice under test to perform environmental testing on the microservice under test based on the test request traffic.
[0095] like Figure 5 As shown, this specification provides a schematic diagram of the internal structure of a non-volatile storage medium in one or more embodiments. Figure 5 It is known that a non-volatile storage medium stores computer-executable instructions 501, which are capable of:
[0096] Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested;
[0097] Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested;
[0098] If the service to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center;
[0099] The key-value pairs are added to the test request traffic of the microservice under test to perform environmental testing on the microservice under test based on the test request traffic.
[0100] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and non-volatile computer storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0101] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0102] The above description is merely one or more embodiments of this specification and is not intended to limit this specification. Various modifications and variations can be made to the one or more embodiments of this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of one or more embodiments of this specification should be included within the scope of the claims of this specification.
Claims
1. A method for managing multiple testing environments for microservices, characterized in that, The method includes: Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested; Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested; If the microservice to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center; The key-value pairs are added to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic; Adding the key-value pairs to the test request traffic of the microservice under test specifically includes: Obtain the packet format information corresponding to the test request traffic, and determine the packet format corresponding to the test request traffic based on the packet format information; determine the character length of the header packet to be added based on the key-value pair identifier length, and write the key-value pair identifier into the header packet; Add the header message to the header of the message format to include the key-value pair in the test request traffic of the microservice to be tested; Environmental testing of the microservice under test is performed based on the test request traffic, specifically including: Based on the test request traffic, obtain the key-value pair identifier of the microservice to be tested; If there are inter-service calls during the environment test, obtain the service identity identifier corresponding to the service to be called; Based on the key-value pair identifier and the service identity identifier, the service information in the service registry in the preset service discovery center is searched to realize the environment testing between specified microservices; The step of searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier to realize environment testing between specified microservices specifically includes: Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the preset service discovery center; If service information corresponding to the key-value pair identifier is obtained based on the service registry, the service address in the service information is returned. After searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the method further includes: Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
2. The method for managing multiple testing environments for microservices according to claim 1, characterized in that, The determination of the microservice to be tested specifically includes: Get the name of the current microservice in the current microservice architecture and the name of the current microservice architecture; Based on the preset program and the name of the current microservice architecture, call the historical microservice architecture of the previous iteration cycle corresponding to the current microservice architecture in the preset database; Obtain the historical microservices in the historical microservice architecture, compare the current microservices with the historical microservices, determine the current iteration microservices in the current microservice architecture, and use the current iteration microservices as the microservices to be tested.
3. The method for managing multiple testing environments for microservices according to claim 1, characterized in that, The service registration based on the key-value pair identifier, to register the key-value pair identifier to a preset service discovery center, specifically includes: The registration request for the microservice to be tested is sent to the preset service discovery center; wherein, the registration request includes: service information, key-value pair identifier and callback URL; Based on the information in the registration request, the microservice is registered as a service, and the key-value pair identifier is registered as metadata to the microservice discovery center and stored in the service registry of the microservice discovery center.
4. A multi-testing environment management device for microservices, characterized in that, The device includes: The determination module is used to determine the microservice to be tested in order to obtain the key-value pair identifier of the microservice to be tested; A binding module is used to record the key-value pair identifier and write the key-value pair identifier into a container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested; The registration unit is used to register the service based on the key-value pair identifier if the microservice to be tested is published, so as to register the key-value pair identifier to a preset service discovery center. The testing unit is used to add the key-value pairs to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic; Adding the key-value pairs to the test request traffic of the microservice under test specifically includes: Obtain the packet format information corresponding to the test request traffic, and determine the packet format corresponding to the test request traffic based on the packet format information; determine the character length of the header packet to be added based on the key-value pair identifier length, and write the key-value pair identifier into the header packet; Add the header message to the header of the message format to include the key-value pair in the test request traffic of the microservice to be tested; Environmental testing of the microservice under test is performed based on the test request traffic, specifically including: Based on the test request traffic, obtain the key-value pair identifier of the microservice to be tested; If there are inter-service calls during the environment test, obtain the service identity identifier corresponding to the service to be called; Based on the key-value pair identifier and the service identity identifier, the service information in the service registry in the preset service discovery center is searched to realize the environment testing between specified microservices; The step of searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier to realize environment testing between specified microservices specifically includes: Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the preset service discovery center; If service information corresponding to the key-value pair identifier is obtained based on the service registry, the service address in the service information is returned. After searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the process further includes: Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
5. A multi-testing environment management device for microservices, characterized in that, The device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested; Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested; If the microservice to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center; The key-value pairs are added to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic; Adding the key-value pairs to the test request traffic of the microservice under test specifically includes: Obtain the packet format information corresponding to the test request traffic, and determine the packet format corresponding to the test request traffic based on the packet format information; determine the character length of the header packet to be added based on the key-value pair identifier length, and write the key-value pair identifier into the header packet; Add the header message to the header of the message format to include the key-value pair in the test request traffic of the microservice to be tested; Environmental testing of the microservice under test is performed based on the test request traffic, specifically including: Based on the test request traffic, obtain the key-value pair identifier of the microservice to be tested; If there are inter-service calls during the environment test, obtain the service identity identifier corresponding to the service to be called; Based on the key-value pair identifier and the service identity identifier, the service information in the service registry in the preset service discovery center is searched to realize the environment testing between specified microservices; The step of searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier to realize environment testing between specified microservices specifically includes: Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the preset service discovery center; If service information corresponding to the key-value pair identifier is obtained based on the service registry, the service address in the service information is returned. After searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the process further includes: Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
6. A non-volatile storage medium storing computer-executable instructions, characterized in that, The computer-executable instructions are capable of: Identify the microservice to be tested, and obtain the key-value pair identifier of the microservice to be tested; Record the key-value pair identifier and write the key-value pair identifier into the container corresponding to the microservice to be tested, so as to bind the key-value pair identifier to the microservice to be tested; If the microservice to be tested is published, service registration is performed based on the key-value pair identifier to register the key-value pair identifier to the preset service discovery center; The key-value pairs are added to the test request traffic of the microservice under test, so as to perform environmental testing on the microservice under test based on the test request traffic; Adding the key-value pairs to the test request traffic of the microservice under test specifically includes: Obtain the packet format information corresponding to the test request traffic, and determine the packet format corresponding to the test request traffic based on the packet format information; determine the character length of the header packet to be added based on the key-value pair identifier length, and write the key-value pair identifier into the header packet; Add the header message to the header of the message format to include the key-value pair in the test request traffic of the microservice to be tested; Environmental testing of the microservice under test is performed based on the test request traffic, specifically including: Based on the test request traffic, obtain the key-value pair identifier of the microservice to be tested; If there are inter-service calls during the environment test, obtain the service identity identifier corresponding to the service to be called; Based on the key-value pair identifier and the service identity identifier, the service information in the service registry in the preset service discovery center is searched to realize environment testing between specified microservices; The step of searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier to realize environment testing between specified microservices specifically includes: Based on the key-value pair identifier and the service identity identifier, search for service information in the service registry of the preset service discovery center; If service information corresponding to the key-value pair identifier is obtained based on the service registry, the service address in the service information is returned. After searching for service information in the service registry of the preset service discovery center based on the key-value pair identifier and the service identity identifier, if service information corresponding to the key-value pair identifier cannot be obtained based on the service registry, the process further includes: Obtain the registration address of the service corresponding to the microservice to be tested in the benchmark environment, and forward the test request traffic of the microservice to be tested to the registration address of the benchmark environment, so as to realize the forwarding of the test request traffic of the microservice to be tested to the microservice in the benchmark environment.
Citation Information
Patent Citations
Micro-service gray release method and device, computer equipment and storage medium
CN109739552A
Parallel test method, device and equipment based on kubernetes
CN114385318A