A test environment switching method, device and system

By judging whether the callback request of the external project is consistent with the address and key attribute values ​​of the call request of the internal test environment, the automatic switching of the test environment service is realized, and the problem of not being able to identify and switch to the correct test environment in the existing technology is solved, ensuring that Implementation of parallel environment testing.

CN115842749BActive Publication Date: 2024-12-06CHINA TELECOM DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211485199.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-24
Publication Date
2024-12-06
Estimated Expiration
2042-11-24

AI Technical Summary

Technical Problem

When existing environmental testing services receive callback requests from external projects, they cannot automatically switch to the correct internal testing environment, resulting in the inability to implement parallel environmental testing.

Method used

By obtaining the callback request of the target external project and determining whether its destination address and source address are the same. If the same, further determine whether the key attribute values ​​are consistent. If they are consistent, the callback request will be reverse proxyed to the corresponding internal test environment, thereby identifying and Select the correct test environment for testing.

Benefits of technology

The test environment service can identify the callback request of external projects and select the correct internal testing environment based on the request, solving the problem of inability to implement parallel environment testing and avoiding the waste of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115842749B_ABST
    Figure CN115842749B_ABST
Patent Text Reader

Abstract

The present application provides a test environment switching method, device and system, in which the callback request of the external test environment and the first call request of the internal first test environment are separated independently, but the business messages of the two must have a same key attribute for association, so it is possible to judge whether the first test environment corresponding to the first call request is the test environment connected to the external test environment corresponding to the callback request based on whether the value of the key attribute is the same. When the test environment service is connected to the target external project service, after successfully calling the interface of the target external environment through the call request and waiting for the external environment callback method, the test service assigns a callback address to the target external project. After that, when receiving the callback request of the target external project, the test service can identify the callback request of the target external project, and select the correct internal test environment according to the callback request to test the external project and the internal project.
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 method, device and system for switching a test environment. Background Art

[0002] In current software testing, multiple environment tests (ie, parallel testing) are generally required to discover defects and various existing problems of software products as early as possible.

[0003] However, the test service usually has multiple test environments, while the external project only has one test environment. Therefore, when the test environment service is connected to the external project service, after successfully calling the external environment interface and waiting for the external environment callback, the test service will only assign one callback address to the external project. The connected external project usually does not customize the callback to different test environment addresses multiple times because there are multiple test environments internally. As a result, the test service cannot recognize the callback request of the external project, and cannot select the correct internal test environment to test the external project according to the callback request sent by the external project. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a test environment switching method, device and system to solve the problem in the existing environment testing service that when a set of test environments of an external project sends a callback request to multiple sets of internal test environments, the environment testing service only provides one callback address, resulting in the inability to automatically switch to the corresponding internal test environment for testing according to the callback address, and further unable to implement parallel environment testing.

[0005] A method for switching a test environment provided in an embodiment of the present application includes:

[0006] Get the callback request sent by the target external project;

[0007] Determine whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located; wherein the first call request includes: a call request sent by a first test environment in the intranet before receiving the callback request;

[0008] If it is determined that the target service is the same as the first service, then continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request;

[0009] If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse proxied to the first test environment.

[0010] In the above technical scheme, the callback request of the external test environment and the first call request of the internal first test environment are separated independently, but the business messages of the two must have a same key attribute to be associated, so whether the first test environment corresponding to the first call request is the test environment docked with the external test environment corresponding to the callback request can be judged according to whether the value of the key attribute is the same. Therefore, using the method of this embodiment, when the test environment service is docked with the target external project service, the interface of the target external environment is successfully called by the call request and the external environment callback method is waited for, the test service assigns a callback address to the target external project, and then, when receiving the callback request of the target external project, the test service can identify the callback request of the target external project, and select the correct internal test environment according to the callback request to test the external project and the internal project. In addition, the method first determines whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located. Only when the target service is the same as the first service, continue to determine whether the values ​​of the two key attributes are the same. If the target service is different from the first service, there is no need to perform the judgment step of the value of the key attribute, avoiding the waste of computing resources.

[0011] In some optional implementations, before obtaining the callback request sent by the target external project, the following steps are included:

[0012] Obtaining a first call request sent by a first test environment;

[0013] Determining whether the first call request is used to call an external test environment of an external project;

[0014] If it is determined that the first calling request is used to call an external test environment of an external project, a value of a key attribute of the first calling request is obtained.

[0015] In the above technical solution, if the first test environment is a test environment used to connect with the external test environment of the target external project, then before obtaining the callback request, the first call request sent by the first test environment will be obtained, and the value of the key attribute therein will be obtained according to the first call request, and the value will be used to compare with the value of the same key attribute of the callback request. In addition, if the first call request is not used to call the external test environment of any external project, then there is no need to obtain the value of the key attribute therein, so as to avoid the waste of computing resources.

[0016] In some optional implementations, before obtaining the callback request sent by the target external project, the method further includes:

[0017] Obtain a second call request sent by a second test environment in the intranet;

[0018] After determining that the second call request is used to call the external test environment of the external project, obtaining the value of the key attribute of the second call request;

[0019] After determining whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located, the method further includes:

[0020] If it is determined that the target service is different from the first service, determining whether the target service is the same as the second service where the source address of the second call request is located;

[0021] If it is determined that the target service is different from the second service, the callback request is reverse proxied to a preset internal test environment;

[0022] If it is determined that the target service is the same as the second service, continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request: If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request, reverse proxy the callback request to the second test environment.

[0023] In the above technical scheme, there are usually multiple test environments in the intranet. If it is determined that the first test environment is not a test environment connected to the target external test environment, then it is determined whether the second test environment is a test environment connected to the target external environment. The judgment of the second test environment is similar to that of the first test environment until all test environments in the intranet have been judged once. If none of the test environments in the intranet are test environments connected to the target external test environment, then the callback request is reverse proxied to the preset internal test environment to implement the test.

[0024] In some optional implementations, after determining whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the method further includes:

[0025] If it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, the callback request is reverse proxied to a preset internal test environment.

[0026] In the above technical solution, the callback request of the external test environment and the first call request of the internal first test environment are independently separated, but the business messages of the two must have a same key attribute for association. Therefore, it is possible to ultimately determine whether the first test environment corresponding to the first call request is the test environment connected to the external test environment corresponding to the callback request based on whether the value of the key attribute is the same.

[0027] An embodiment of the present application provides a test environment switching device, including:

[0028] The acquisition module is used to obtain the callback request sent by the target external project;

[0029] A first determination module is used to determine whether a target service at a destination address of a callback request is the same as a first service at a source address of a first call request; wherein the first call request includes: a call request sent by a first test environment of an intranet before receiving the callback request;

[0030] The second judgment module is used to judge whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request when the target service is the same as the first service: if it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse proxied to the first test environment.

[0031] In the above technical scheme, the callback request of the external test environment and the first call request of the internal first test environment are separated independently, but the business messages of the two must have a same key attribute to be associated, so whether the first test environment corresponding to the first call request is the test environment docked with the external test environment corresponding to the callback request can be judged according to whether the value of the key attribute is the same. Therefore, using the method of this embodiment, when the test environment service is docked with the target external project service, the interface of the target external environment is successfully called by the call request and the external environment callback method is waited for, the test service assigns a callback address to the target external project, and then, when receiving the callback request of the target external project, the test service can identify the callback request of the target external project, and select the correct internal test environment according to the callback request to test the external project and the internal project. In addition, the method first determines whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located. Only when the target service is the same as the first service, continue to determine whether the values ​​of the two key attributes are the same. If the target service is different from the first service, there is no need to perform the judgment step of the value of the key attribute, avoiding the waste of computing resources.

[0032] In some optional implementations, the switching device for the test environment further includes a third judgment module;

[0033] The acquisition module is further used to acquire the first call request sent by the first test environment;

[0034] The third judgment module is used to judge whether the first calling request is used to call the external test environment of the external project: if it is determined that the first calling request is used to call the external test environment of the external project, the value of the key attribute of the first calling request is obtained.

[0035] In some optional implementations, the acquisition module is further used to acquire a second call request sent by a second test environment in the intranet;

[0036] The third judgment module is further used to obtain the value of the key attribute of the second calling request after determining that the second calling request is used to call the external test environment of the external project;

[0037] The first judgment module is also used for: when it is determined that the target service is different from the first service, continuing to judge whether the target service is the same as the second service where the source address of the second call request is located: if it is determined that the target service is different from the second service, the callback request is reversely proxied to a preset internal test environment.

[0038] In some optional implementations, the second determination module is further configured to:

[0039] If it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, the callback request is reverse proxied to a preset internal test environment.

[0040] A test environment switching system provided in an embodiment of the present application is used to select a test environment for docking with an external test environment of a target external project from multiple test environments in an intranet;

[0041] The system includes:

[0042] A network proxy module, used to obtain a callback request sent by a target external project, and to obtain a first call request sent by a first test environment;

[0043] A calculation module, used to: determine whether a target service where a destination address of a callback request is located is the same as a first service where a source address of a first call request is located; wherein the first call request includes: a call request sent by a first test environment of an intranet before receiving the callback request;

[0044] If it is determined that the target service is the same as the first service, then continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request;

[0045] If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse proxied to the first test environment.

[0046] In some optional implementations, the test environment switching system further includes:

[0047] The storage module is used to store the value of the key attribute of the first call request.

[0048] An electronic device provided in an embodiment of the present application includes: a processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, any of the above methods is performed.

[0049] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, any of the above methods is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A schematic diagram of a switching system for a test environment provided in an embodiment of the present application;

[0052] Figure 2 A schematic diagram of a workflow diagram of a switching system provided in an embodiment of the present application;

[0053] Figure 3 A flow chart of the steps of a test environment switching method provided in an embodiment of the present application;

[0054] Figure 4 A functional module diagram of a switching device for a test environment provided in an embodiment of the present application;

[0055] Figure 5 A possible structural diagram of an electronic device provided in an embodiment of the present application.

[0056] Icons: 1-network agent module, 2-computing module, 3-storage module, 4-first test environment, 5-second test environment, 6-external test environment, 7-switching system, 8-acquisition module, 9-first judgment module, 10-second judgment module, 11-third judgment module, 12-processor, 13-memory, 14-communication interface, 15-communication bus. DETAILED DESCRIPTION

[0057] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0058] Please refer to Figure 1 , Figure 1 A schematic diagram of a test environment switching system 7 provided in an embodiment of the present application, wherein the switching system 7 is used to select a test environment for docking with an external test environment 6 of a target external project from multiple test environments in an intranet;

[0059] Specifically, the switching system 7 includes a network proxy module 1, a calculation module 2 and a storage module 3. The network proxy module 1 is used to obtain the callback request sent by the target external project and the first call request sent by the first test environment 4. The calculation module 2 is used to determine whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located; the first call request includes: the call request sent by the first test environment 4 of the intranet before receiving the callback request; if it is determined that the target service is the same as the first service, then continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request; if it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, then reverse proxy the callback request to the first test environment 4. The storage module 3 is used to store the value of the key attribute of the first call request.

[0060] In some optional implementations, the workflow of the switching system 7 is as follows: Figure 2 As shown, Figure 2 This is a schematic diagram of a work flow diagram of a switching system 7 provided in an embodiment of the present application. In this embodiment, the internal test environment only includes the first test environment 4.

[0061] First, the network proxy module 1 of the switching system 7 monitors the first call request sent by the first test environment 4 of the intranet. The first call request includes a request line and a request header, and the request line includes a request method, a request resource path, and an http protocol version, and the request header includes an environment description of the client, a host address requested by the client, and other information.

[0062] If the first call request calls the test environment of the external project, proceed to the next step, otherwise return the call request to the first test environment 4.

[0063] For the first call request that calls the external project test environment, the computing module 2 of the switching system 7 analyzes the first call request, analyzes the key attributes, obtains the values ​​of the key attributes in the first call request, and stores the values ​​of the key attributes in the first call request in the storage module 3.

[0064] Afterwards, the network proxy module 1 of the switching system 7 monitors the callback request sent by the external test environment 6, and the computing module 2 of the switching system 7 determines whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located. If so, proceed to the next step; if not, reverse proxy the callback request to the preset internal test environment.

[0065] For the callback request corresponding to the target service that is the same as the first service where the source address of the first call request is located, continue to determine whether the value of the key attribute in the callback request is the same as the value of the key attribute in the first call request stored in the storage module 3. If so, proceed to the next step; if not, reverse proxy the callback request to the preset internal test environment.

[0066] For a callback request whose key attribute value can match the key attribute value in the first call request in the storage module 3 , the callback request is reverse proxied to the first test environment 4 .

[0067] The key attributes are illustrated as follows:

[0068] Company A has business that requires payment and needs to connect with Alipay. That is, when users pay with Company A, they pay through Alipay. When Company A sends an order payment request, Alipay sends this request to the user. After the user pays, Alipay calls back the user's payment completion request to Company A. If the callback request shows that the order payment is successful, Company A will send the goods to the user.

[0069] In the message that Company A sends an order request to Alipay, an order ID parameter must be passed. If this order ID parameter is not present, when the user completes the payment and Alipay calls back the payment completion request, since there is no order ID parameter, Company A cannot identify which user has successfully paid after receiving the callback request from Alipay, and thus cannot ship the goods. Therefore, the key attribute in the message request must exist. It is the only path to associate the call request and the callback request, and is used to accurately identify the source of the callback request during the callback. It exists in any message request, so the key attribute is not an additionally configured parameter.

[0070] It should be noted that before analyzing the key attributes in the message in the request, the message needs to be deserialized because when two processes are communicating remotely, they can send various types of data to each other. Regardless of the type of data, it will be transmitted on the network in the form of a binary sequence. The sender needs to convert this object into a byte sequence before it can be transmitted on the network. The message deserialization operation is an obvious step before analyzing the message request, and this embodiment will not be described in detail here.

[0071] Please refer to Figure 3 , Figure 3 A flow chart of the steps of a test environment switching method provided in an embodiment of the present application includes:

[0072] Step 100: Obtain a callback request sent by a target external project; specifically, configure a corresponding intranet address for the callback request.

[0073] Step 200, determining whether the target service at the destination address of the callback request is the same as the first service at the source address of the first call request; wherein the first call request includes: a call request sent by the first test environment 4 of the intranet before receiving the callback request;

[0074] If it is determined that the target service is the same as the first service, proceed to step 300;

[0075] Step 300: determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request;

[0076] If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, then proceed to step 400;

[0077] Step 400: reverse proxy the callback request to the first test environment 4.

[0078] In the embodiment of the present application, the callback request of the external test environment and the first call request of the internal first test environment are separated independently, but the business messages of the two must have a same key attribute for association, so it can be determined whether the first test environment 4 corresponding to the first call request is the test environment docked with the external test environment 6 corresponding to the callback request according to whether the value of the key attribute is the same. Therefore, using the method of this embodiment, when the test environment service is docked with the target external project service, the interface of the target external environment is successfully called by the call request and the external environment callback method is waited for, the test service assigns a callback address to the target external project, and then, when the callback request of the target external project is received, the test service can identify the callback request of the target external project, and select the correct internal test environment according to the callback request to test the external project and the internal project. In addition, the method first determines whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located. Only when the target service is the same as the first service, continue to determine whether the values ​​of the two key attributes are the same. If the target service is different from the first service, there is no need to perform the judgment step of the value of the key attribute, avoiding the waste of computing resources.

[0079] In some optional implementations, before obtaining the callback request sent by the target external project, the following steps are included:

[0080] Step 11, obtaining a first call request sent by the first test environment 4;

[0081] Step 12, determining whether the first calling request is used to call the external test environment 6 of the external project;

[0082] If it is determined that the first call request is used to call the external test environment 6 of the external project, then proceed to step 13;

[0083] If it is determined that the first call request is not for calling the external test environment 6 of the external project, proceed to step 14;

[0084] Step 13: Obtain the value of the key attribute of the first call request.

[0085] Step 14: Return the first call request to the first test environment 4.

[0086] In the embodiment of the present application, if the first test environment 4 is a test environment used to connect with the external test environment 6 of the target external project, then before obtaining the callback request, the first call request sent by the first test environment 4 will be obtained, and the value of the key attribute therein will be obtained according to the first call request, and the value will be used to compare with the value of the same key attribute of the callback request. In addition, if the first call request is not used to call the external test environment 6 of any external project, then there is no need to obtain the value of the key attribute therein, so as to avoid the waste of computing resources.

[0087] In some optional implementations, before obtaining the callback request sent by the target external project, the method further includes:

[0088] Step 21, obtaining a second call request sent by the second test environment 5 in the intranet;

[0089] Step 22: After determining that the second calling request is used to call the external test environment 6 of the external project, obtain the value of the key attribute of the second calling request.

[0090] Correspondingly, after determining whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located, the method further includes:

[0091] If it is determined that the target service is different from the first service, determining whether the target service is the same as the second service where the source address of the second call request is located;

[0092] If it is determined that the target service is different from the second service, the callback request is reverse proxied to a preset internal test environment;

[0093] If it is determined that the target service is the same as the second service, continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request: If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request, reverse proxy the callback request to the second test environment 5.

[0094] In an embodiment of the present application, there are usually multiple test environments in the intranet. If it is determined that the first test environment 4 is not a test environment connected to the target external test environment 6, then it is determined whether the second test environment 5 is a test environment connected to the target external environment. The judgment of the second test environment 5 is similar to that of the first test environment 4, until all test environments in the intranet have been judged once. If none of the test environments in the intranet are test environments connected to the target external test environment 6, then the callback request is reverse proxied to the preset internal test environment to implement the test.

[0095] In some optional implementations, after determining whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the method further includes:

[0096] If it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, the callback request is reverse proxied to a preset internal test environment.

[0097] In an embodiment of the present application, the callback request and the first call request are separated independently, but their business messages must have a same key attribute for association. Therefore, it is possible to ultimately determine whether the first test environment 4 corresponding to the first call request is the test environment connected to the external test environment 6 corresponding to the callback request based on whether the value of the key attribute is the same.

[0098] Please refer to Figure 4 , Figure 4 A functional module diagram of a switching device for a test environment provided in an embodiment of the present application, specifically comprising an acquisition module 8, a first judgment module 9 and a second judgment module 10.

[0099] Wherein, the acquisition module 8 is used to obtain the callback request sent by the target external project. The first judgment module 9 is used to judge whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located; wherein the first call request includes: a call request sent by the first test environment 4 of the intranet before receiving the callback request. The second judgment module 10 is used to judge whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request when the target service is the same as the first service: if it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reversely proxied to the first test environment 4.

[0100] In the embodiment of the present application, the callback request and the first call request are separated independently, but the business messages of the two must have a same key attribute for association, so whether the first test environment 4 corresponding to the first call request is the test environment docked with the external test environment 6 corresponding to the callback request can be judged according to whether the value of the key attribute is the same. Therefore, using the method of this embodiment, when the test environment service is docked with the target external project service, the interface of the target external environment is successfully called by the call request and the external environment callback method is waited for, the test service assigns a callback address to the target external project, and then, when receiving the callback request of the target external project, the test service can identify the callback request of the target external project, and select the correct internal test environment according to the callback request to test the external project and the internal project. In addition, the method first determines whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located. Only when the target service is the same as the first service, continue to determine whether the values ​​of the two key attributes are the same. If the target service is different from the first service, there is no need to perform the judgment step of the value of the key attribute, avoiding the waste of computing resources.

[0101] In some optional implementations, a third judgment module 11 is further included.

[0102] The acquisition module 8 is further used to acquire the first call request sent by the first test environment 4. The third judgment module 11 is used to judge whether the first call request is used to call the external test environment 6 of the external project: if it is determined that the first call request is used to call the external test environment 6 of the external project, the value of the key attribute of the first call request is acquired.

[0103] In some optional implementations, the acquisition module 8 is further used to acquire a second call request sent by the second test environment 5 of the intranet. The third judgment module 11 is further used to acquire the value of the key attribute of the second call request after determining that the second call request is used to call the external test environment 6 of the external project.

[0104] The first judgment module 9 is also used for: when it is determined that the target service is different from the first service, it continues to determine whether the target service is the same as the second service where the source address of the second call request is located: if it is determined that the target service is different from the second service, the callback request is reversely proxied to the preset internal test environment.

[0105] In some optional implementations, the second determination module 10 is further configured to: if it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, reverse proxy the callback request to a preset internal test environment.

[0106] Figure 5A possible structure of an electronic device provided by an embodiment of the present application is shown. Figure 5 The electronic device includes: a processor 12, a memory 13 and a communication interface 14. These components are interconnected and communicate with each other through a communication bus 15 and / or other forms of connection mechanisms (not shown).

[0107] The memory 13 includes one or more (only one is shown in the figure), which may be, but not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The processor 12 and other possible components can access the memory 13 and read and / or write data therein.

[0108] The processor 12 includes one or more (only one is shown in the figure), which can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 12 can be a general-purpose processor, including a central processing unit (CPU), a micro control unit (MCU), a network processor (NP) or other conventional processors; it can also be a special-purpose processor, including a neural network processor (NPU), a graphics processor (GPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. In addition, when there are multiple processors 12, some of them can be general-purpose processors and the other part can be special-purpose processors.

[0109] The communication interface 14 includes one or more (only one is shown in the figure), which can be used to communicate directly or indirectly with other devices to exchange data. The communication interface 14 can include an interface for wired and / or wireless communication.

[0110] One or more computer program instructions may be stored in the memory 13, and the processor 12 may read and execute these computer program instructions to implement the method provided in the embodiment of the present application.

[0111] Understandably, Figure 5 The structure shown is for illustration only. The electronic device may also include Figure 5 More or fewer components as shown, or with Figure 5 Different structures are shown. Figure 5 The components shown in the figure can be implemented by hardware, software or a combination thereof. The electronic device may be a physical device, such as a PC, a laptop, a tablet computer, a mobile phone, a server, an embedded device, etc., or a virtual device, such as a virtual machine, a virtualized container, etc. Moreover, the electronic device is not limited to a single device, but may also be a combination of multiple devices or a cluster consisting of a large number of devices.

[0112] The present application also provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are read and executed by a computer processor, the method provided by the present application is executed. For example, the computer-readable storage medium can be implemented as Figure 5 A memory 13 in an electronic device.

[0113] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0114] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0115] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0116] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0117] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for switching a test environment, characterized in that: include: Get the callback request sent by the target external project; Determine whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located; wherein the first call request includes: a call request sent by a first test environment in the intranet before receiving the callback request; If it is determined that the target service is the same as the first service, then continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request; If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse proxied to the first test environment.

2. The method according to claim 1, characterized in that Before obtaining the callback request sent by the target external project, the following steps are included: Obtaining the first call request sent by the first test environment; Determining whether the first calling request is used to call an external test environment of an external project; If it is determined that the first calling request is used to call an external test environment of an external project, a value of a key attribute of the first calling request is obtained.

3. The method according to claim 1, characterized in that Before obtaining the callback request sent by the target external project, the method further includes: Obtain a second call request sent by a second test environment in the intranet; After determining that the second calling request is used to call the external test environment of the external project, obtaining a value of a key attribute of the second calling request; After determining whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located, the method further includes: If it is determined that the target service is different from the first service, determining whether the target service is the same as the second service where the source address of the second call request is located; If it is determined that the target service is different from the second service, the callback request is reversely proxied to a preset internal test environment; If it is determined that the target service is the same as the second service, continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request: If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the second call request, reverse proxy the callback request to the second test environment.

4. The method according to claim 1, characterized in that After determining whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the method further includes: If it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, the callback request is reverse proxied to a preset internal test environment.

5. A switching device for a test environment, characterized in that: include: The acquisition module is used to obtain the callback request sent by the target external project; A first judgment module is used to judge whether the target service where the destination address of the callback request is located is the same as the first service where the source address of the first call request is located; wherein the first call request includes: a call request sent by a first test environment of the intranet before receiving the callback request; The second judgment module is used to judge whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request when the target service is the same as the first service: if it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse-proxied to the first test environment.

6. The device according to claim 5, characterized in that Also includes a third judgment module; The acquisition module is further used to acquire the first call request sent by the first test environment; The third judgment module is used to judge whether the first calling request is used to call the external test environment of the external project: if it is determined that the first calling request is used to call the external test environment of the external project, the value of the key attribute of the first calling request is obtained.

7. The device according to claim 6, characterized in that The acquisition module is further used to acquire a second call request sent by a second test environment in the intranet; The third judgment module is further configured to obtain a value of a key attribute of the second calling request after determining that the second calling request is used to call an external test environment of an external project; The first judgment module is also used to: when it is determined that the target service is different from the first service, continue to determine whether the target service is the same as the second service where the source address of the second call request is located: if it is determined that the target service is different from the second service, reverse proxy the callback request to a preset internal test environment.

8. The device according to claim 5, characterized in that The second judgment module is also used for: If it is determined that the value of the key attribute of the callback request is different from the value of the same key attribute of the first call request, the callback request is reverse proxied to a preset internal test environment.

9. A test environment switching system, characterized in that: The system is used to select a test environment from multiple test environments in the intranet for docking with an external test environment of a target external project; The system comprises: A network proxy module, used to obtain a callback request sent by the target external project, and to obtain a first call request sent by the first test environment; A calculation module, used to: determine whether a target service at a destination address of the callback request is the same as a first service at a source address of a first call request; wherein the first call request includes: a call request sent by a first test environment of an intranet before receiving the callback request; If it is determined that the target service is the same as the first service, then continue to determine whether the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request; If it is determined that the value of the key attribute of the callback request is the same as the value of the same key attribute of the first call request, the callback request is reverse proxied to the first test environment.

10. The system according to claim 9, characterized in that Also includes: The storage module is used to store the value of the key attribute of the first call request.