An interface consistency verification method, device, equipment and storage medium
By inserting log identifiers into service requests and using a unified random operator and algorithm, the complexity and cost of consistency verification between new and old service APIs are resolved, achieving end-to-end interface consistency verification and ensuring comprehensive coverage of interface data and anomaly location.
Patent Information
- Application Number
- CN202210249437.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-14
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-03-14
AI Technical Summary
During service reconstruction and migration, existing technologies cannot effectively ensure the consistency of APIs between new and old services, resulting in complex and costly interface consistency verification, difficulty in covering all types of interface data, and inability to accurately locate abnormal scenarios.
By inserting log identifiers (logid) into service requests, using a unified random operator and algorithm, the service results of new and old services are obtained and compared in the access service to ensure the consistency of random results. A caching service is used to handle random feedback from downstream services, and the DIFF tool is used for data comparison to achieve end-to-end interface consistency verification.
It enables comprehensive comparison of interface data even with minimal business code intrusion, reducing development and testing costs, improving the efficiency and accuracy of interface consistency verification, supporting various forms of service request verification, and ensuring the alignment of random results between new and old services.
Smart Images

Figure CN114661590B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to the field of data processing technology. Background Technology
[0002] In the process of internet business development, software or services generally go through initial, optimization, maturity, aging, and eventual demise or reconstruction phases. As the original service architecture becomes incompatible with business development and technology iterates, the original service inevitably struggles to support the ever-expanding business scale, leading to high development and maintenance costs. This necessitates refactoring the original service to achieve a rebirth. During refactoring and service migration, it is crucial to ensure that the new service's external API (Application Programming Interface) remains consistent with the original service's API. Summary of the Invention
[0003] This disclosure provides an interface consistency verification method, apparatus, device, and storage medium.
[0004] According to one aspect of this disclosure, an interface consistency verification method is provided, comprising:
[0005] The access service obtains traffic from the services to be injected, including new services and old services; converts the traffic into Uniform Resource Identifier (URI) requests, the URI requests including the log identifier corresponding to the URI request and the URI of the traffic; and inputs the URI requests into the new service and the old service respectively.
[0006] The new service and the old service respectively use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service;
[0007] The access service compares the first service results returned by the new service and the old service respectively to obtain the consistency verification result of the service to be injected.
[0008] According to another aspect of this disclosure, an interface consistency verification method is provided, applied to a device accessing a service in performing the above-described interface consistency verification method, comprising:
[0009] Obtain the traffic of the service to be injected, which includes new services and old services;
[0010] The traffic is converted into a Uniform Resource Identifier (URI) request, the URI request including the log identifier corresponding to the URI request and the URI of the traffic;
[0011] The URI request is input into the new service and the old service respectively; so that the new service and the old service use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service;
[0012] The consistency verification result corresponding to the service to be injected is obtained by comparing the first service results returned by the new service and the old service respectively.
[0013] According to another aspect of this disclosure, an interface consistency verification method is provided, applied to a device performing the above-described interface consistency verification method for injecting a service, comprising:
[0014] Receive a Uniform Resource Identifier (URI) request sent by the access service, wherein the URI request is obtained by converting the traffic, and the URI request includes the log identifier corresponding to the URI request and the URI of the traffic;
[0015] Use the log identifier in the URI request as a random operator;
[0016] Using the random operator, the first service result corresponding to the URI in the URI request is obtained, and the first service result is fed back to the access service.
[0017] According to another aspect of this disclosure, an interface consistency verification device is provided, comprising:
[0018] An acquisition module is used to provide access services to acquire traffic of services to be injected, including new services and old services; convert the traffic into Uniform Resource Identifier (URI) requests, the URI requests including the log identifier corresponding to the URI request and the URI of the traffic; and input the URI requests into the new service and the old service respectively.
[0019] The feedback module is used to provide the new service and the old service, respectively using the log identifier in the URI request as a random operator, using the random operator to obtain the first service result corresponding to the URI in the URI request, and feeding back the first service result to the access service;
[0020] The comparison module is used to provide the access service to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result of the service to be injected.
[0021] According to another aspect of this disclosure, an interface consistency verification device is provided, applied to a device that includes the above-described interface consistency verification device for accessing services, comprising:
[0022] The acquisition module is used to acquire the traffic of the service to be injected, which includes new services and old services.
[0023] A conversion module is used to convert the traffic into a Uniform Resource Identifier (URI) request, wherein the URI request includes a log identifier corresponding to the URI request and the URI of the traffic;
[0024] The feedback module is used to input the URI request into the new service and the old service respectively; so that the new service and the old service respectively use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service;
[0025] The comparison module is used to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0026] According to another aspect of this disclosure, an interface consistency verification device is provided, applied to a device including the service to be injected in the above-described interface consistency verification device, comprising:
[0027] The receiving module is used to receive a Uniform Resource Identifier (URI) request sent by the access service. The URI request is obtained by converting the traffic, and the URI request includes the log identifier corresponding to the URI request and the URI of the traffic.
[0028] The processing module is used to use the log identifier in the URI request as a random operator;
[0029] The feedback module is used to obtain the first service result corresponding to the URI in the URI request using the random operator, and to feed back the first service result to the access service.
[0030] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0031] At least one processor; and
[0032] A memory communicatively connected to the at least one processor; wherein,
[0033] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the aforementioned interface consistency verification method.
[0034] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the interface consistency verification method described above.
[0035] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the interface consistency verification method described above.
[0036] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0037] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0038] Figure 1 This is a schematic diagram of the first type of interface consistency verification method provided in this embodiment;
[0039] Figure 2 This is a schematic diagram of the second type of interface consistency verification method provided in this embodiment of the disclosure;
[0040] Figure 3 This is a schematic diagram of the third type of interface consistency verification method provided in this embodiment of the disclosure;
[0041] Figure 4 This is a schematic diagram of the fourth process of the interface consistency verification method provided in this embodiment of the disclosure;
[0042] Figure 5 This is a schematic diagram of the fifth type of interface consistency verification method provided in this disclosure embodiment;
[0043] Figure 6 This is a schematic diagram of the first structure of the interface consistency verification device provided in this embodiment of the disclosure;
[0044] Figure 7 This is a schematic diagram of a second structure of the interface consistency verification device provided in this embodiment of the present disclosure;
[0045] Figure 8 This is a schematic diagram of a third structure of the interface consistency verification device provided in this embodiment of the disclosure;
[0046] Figure 9 This is a schematic diagram of the fourth structure of the interface consistency verification device provided in this embodiment;
[0047] Figure 10This is a first schematic block diagram of an electronic device used to implement the interface consistency verification method of the embodiments of this disclosure;
[0048] Figure 11 This is a second schematic block diagram of an electronic device used to implement the interface consistency verification method of the embodiments of this disclosure. Detailed Implementation
[0049] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0050] In the process of internet business development, software or services generally go through initial, optimization, maturity, aging, and eventual demise or reconstruction phases. As the original service architecture becomes incompatible with business development and technology iterates, the original service inevitably struggles to support the ever-expanding business scale, leading to high development and maintenance costs. This necessitates refactoring the original service to achieve a rebirth. During refactoring and service migration, it is crucial to ensure that the new service's external API remains consistent with the original service's API.
[0051] Currently, during refactoring and service migration, developers inject service requests into both the old and new services to compare their interface data and functionality. Before migration, tools like go-replay are used to compare the interface data. This results in a simplistic approach to service request injection and insufficient comprehensiveness in interface consistency checks. Consequently, development and testing require customized solutions, leading to a complex and costly process.
[0052] In addition, the interface data fed back by downstream services or other non-reproducible services with random strategies is random and difficult to compare, making it impossible to verify whether the current interface consistency check covers all types of interface data. Furthermore, since the interface data fed back by downstream services or other non-reproducible services with random strategies is random, this makes it difficult to reproduce the interface data, thus making it impossible to accurately locate abnormal scenarios and hindering the location analysis of both new and old services.
[0053] To complete interface consistency verification and solve the problem of verification difficulty, during business development, for interface data returned due to random strategies in the business or random interface data returned by downstream services, it is necessary to embed points in the old and new services corresponding to the business, or to highly intrude into the old and new services through business code, which makes the business code intrusion significant.
[0054] Furthermore, the aforementioned interface consistency verification architecture lacks the concept of a system platform, requiring the setup and development of interface consistency verification devices each time based on actual business characteristics, making the process complex and inefficient.
[0055] To address the aforementioned issues, this disclosure provides an interface consistency verification method, such as... Figure 1 As shown, it includes the following steps:
[0056] Step S11: The access service obtains the traffic of the service to be injected, which includes the new service and the old service; the traffic is converted into URI requests, which include the log identifier corresponding to the URI request and the URI of the traffic; the URI requests are then input into the new service and the old service respectively.
[0057] In step S12, the new service and the old service respectively use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service.
[0058] Step S13: The access service compares the first service results returned by the new service and the old service respectively to obtain the consistency verification result of the service to be injected.
[0059] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0060] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0061] In this embodiment of the disclosure, traffic can be understood as service requests, access service is the access layer, such as Nginx server, and the service to be injected is the service that needs to be injected with service requests, including new services and old services. The old service can be understood as the service before migration, and the new service can be understood as the service after migration, that is, the service after the old service has been redeveloped.
[0062] Log identifiers can be represented by `logid`, which is a random number. In this embodiment, the access service can generate the `logid` based on LUA or other scripting languages. Optionally, the access service can generate the `logid` based on LUA, which can reduce the development cost, deployment difficulty, and maintenance cost of the access service. The `logid` is used throughout the entire interface consistency verification chain; for example, during inter-service interaction, the `logid` is carried in the URI request and transparently transmitted between services. Here, the algorithm for generating the `logid` is not limited.
[0063] During interface consistency verification, the access service, acting as the access layer, acquires the traffic for both the new and existing services that need to be injected. It analyzes the acquired traffic to obtain URI information and generates a URI request. This URI request includes the login ID, which can be located in the header or payload of the URI request; there is no restriction on this.
[0064] In this embodiment of the disclosure, the access service uniformly converts the acquired traffic into URI requests. This enables the technical solution provided by this embodiment to support various forms of traffic access, such as online traffic redirection, log replay, and single-interface specified URI, enriching the forms of service request injection. Consequently, the interface consistency verification device provided by this embodiment can meet the verification of various forms of service requests. That is, a single platform can meet the needs of various scenarios such as development, testing, and regression, eliminating the need to build and develop a verification system architecture based on business characteristics each time interface consistency verification is performed. This improves the efficiency of interface consistency verification and saves verification costs.
[0065] Furthermore, the platform built in this embodiment can meet the needs of various scenarios such as development, testing, and regression testing, making the platform stable and highly available. In addition, the platform can rely on containerized deployment tools to package and deploy the modules included in the interface consistency verification device, and can elastically scale up and down based on the amount of incoming traffic, QPS (Queries Per Second), service pressure, etc.
[0066] After receiving the URI request, the access service inputs the URI request into the new service and the old service. Here, the access service can input the URI request into the new service and the old service in a specified order, or it can input the URI request into the new service and the old service concurrently; there is no limitation on this.
[0067] Optionally, the access service can use coroutine injection to concurrently send URI requests to both the new and old services, ensuring low latency in the interface consistency verification system and supporting high-concurrency responses. Coroutine injection allows for simple and quick implementation of concurrent service requests, achieving high performance, high concurrency, and non-blocking operation.
[0068] Both new and old services employ logical strategies that rely on random algorithms, such as the random logic in ad styles and ad resource providers in novel advertising scenarios. In this embodiment, such a logical strategy relying on random algorithms can be implemented by calling a random operator library.
[0069] After receiving the URI request, the new service extracts the logid from the URI request. Using this logid as a random operator, it retrieves the service result (i.e., interface data) corresponding to the URI in the URI request from the lib library. For ease of understanding, the first service result is used as an example. The new service then feeds back the first service result to the access service.
[0070] The principle for obtaining the first service result is the same for both old and new services, so the method for old services to obtain the first service result will not be elaborated here.
[0071] In this embodiment, the new service and the old service use the same logid as the random operator to ensure that the random results of the new and old services are aligned. This solves the problem that it is difficult to compare the interface data of services with random strategies, and thus solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0072] The access service receives two first service results: one from the new service and one from the old service. The access service compares these two first service results to obtain the consistency check result for the service to be injected.
[0073] In this embodiment of the disclosure, the access service can connect to a UI (User Interface). After obtaining the consistency verification result, the access service can transmit the consistency verification result to the UI, which will then display the consistency verification result uniformly, making it easier for users to intuitively understand the consistency verification result.
[0074] In addition, the access service can record random results such as the first service result to facilitate subsequent random result test case coverage testing.
[0075] In one optional embodiment, the feedback of service results depends on downstream services. In this case, the new service and the old service can each transmit the URI request to the downstream service. After receiving the URI request, the downstream service obtains the second service result corresponding to the URI in the URI request and feeds back the second service result to the new service and the old service, respectively. The new service and the old service can each feed back the second service result to the access service. The access service can also compare the second service results fed back by the new service and the old service to obtain the consistency verification result corresponding to the service to be injected.
[0076] After receiving a URI request, the new service, if it determines the downstream service corresponding to that URI request, will forward the URI request to that downstream service. Similarly, the old service will also forward the URI request to its downstream service. Since the new and old services receive the same URI request, the downstream services will obtain the same service results. For ease of understanding, the second service result will be used as an example here.
[0077] The processing flow for new and old services after obtaining the second service result, as well as the processing flow for subsequent access services to the second service result, can be found in the processing flow after the first service result mentioned above, and will not be repeated here.
[0078] The technical solution provided in this disclosure supports the verification of feedback results from downstream services, ensuring that interface consistency verification can cover all types of interface data and ensuring the comprehensiveness of interface consistency verification.
[0079] In one optional embodiment, the feedback of the service result depends on downstream services, and the results returned by downstream services are random, such as service results returned by recommendation services, advertising services, or other random services. In this case, embodiments of this disclosure also provide an interface consistency verification method, such as... Figure 2 As shown, in this method, the interface consistency verification device may also include a caching service. This caching service is a proxy layer, such as an nginx cache server, which supports a data caching mechanism based on logid+URI. The method includes steps S21-S25, where step S21 is the same as step S11 and will not be described again here.
[0080] In step S22, the new service and the old service respectively transmit the URI request to the cache service.
[0081] Step S23: The caching service obtains the third service result corresponding to the logid and URI stored in the caching service; and feeds back the third service result to the new service and the old service respectively.
[0082] In step S24, the new service and the old service respectively feed back the results of the third service to the access service.
[0083] Step S25: The access service compares the third service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0084] In this embodiment of the disclosure, after receiving a URI request, the new service, if it determines the downstream service corresponding to the URI request, transmits the URI request to the caching service. The caching service searches for the service result corresponding to the logid and URI in the cached data. If a third service result is found, it feeds back the third service result to the new service. Similarly, the old service obtains the third service result from the caching service.
[0085] The processing flow for new and old services after obtaining the third service result, as well as the processing flow for subsequent access services to the third service result, can be found in the processing flow after the first service result mentioned above, and will not be repeated here.
[0086] In the technical solution provided by this disclosure, a caching service is added between the new service, the old service, and the downstream service. With the caching service supporting a data caching mechanism based on logid+URI, it ensures that the new service and the old service obtain the same downstream data under URI requests with the same logid. This solves the problem of difficulty in comparing interface data reported by downstream services, and further resolves the issue of not being able to verify whether the current interface consistency check covers all types of interface data.
[0087] In an optional embodiment, the caching service may also transmit the URI request to the downstream service if it does not obtain the third service result, so that the downstream service can obtain the fourth service result corresponding to the URI in the URI request and feed back the fourth service result to the caching service; the caching service feeds back the fourth service result to the new service and the old service respectively; the new service and the old service feed back the fourth service result to the access service respectively; the access service compares the fourth service results fed back by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0088] The caching service searches its cached data for the service result corresponding to the logid and URI. If no result is found, it forwards the URI request to the downstream service. Upon receiving the request, the downstream service retrieves the service result corresponding to the URI (e.g., the fourth service result) and sends it back to the caching service. The caching service, upon receiving the fourth service result, can then forward it to both the new and existing services.
[0089] Here, the logid and URI carried in the URI requests sent by the new service and the old service are the same. Therefore, after the caching service obtains the fourth service result from the downstream service, the fourth service result returned to the new service and the old service is also the same based on the logid and URI.
[0090] In this embodiment of the disclosure, in order to facilitate traffic replay, the caching service can cache the correspondence between the logid, URI and the fourth service result upon receiving the fourth service result.
[0091] The processing flow for new and old services after obtaining the fourth service result, as well as the processing flow for subsequent access services to the fourth service result, can be found in the processing flow after the first service result mentioned above, and will not be repeated here.
[0092] In the technical solution provided by this disclosure, a caching service is added between the new service, the old service, and the downstream service. With the caching service supporting a data caching mechanism based on logid+URI, it ensures that the new service and the old service obtain the same downstream data under URI requests with the same logid. This solves the problem of difficulty in comparing interface data reported by downstream services, and further resolves the issue of not being able to verify whether the current interface consistency check covers all types of interface data.
[0093] In addition, the technical solution provided in this disclosure uses the data caching mechanism based on logid+URI in the caching service to realize interface consistency verification. There is no business code intrusion for new services and old services. That is, in the case of zero business code intrusion, the comparison of service results randomly fed back by downstream services is realized, and the interface consistency verification is completed.
[0094] In one embodiment of this disclosure, the fourth service result includes a logid and a URI; if the third service result is not obtained, the caching service can lock one of the two URI requests and send the other URI request to the downstream service; the caching service can also receive and store the fourth service result fed back by the downstream service and feed the fourth service result back to the service corresponding to the other URI request; in response to obtaining the fourth service result corresponding to the log identifier and URI stored in the caching service based on the log identifier and URI in the locked URI request, the fourth service result is fed back to the service corresponding to the locked URI request.
[0095] In this embodiment of the disclosure, the caching service receives two identical URI requests, one from a new service and the other from an old service. The caching service can either forward the first received URI request to a downstream service and lock the second received URI request. Alternatively, after receiving both URI requests, the caching service can randomly select one and lock it. Other methods can also be used in this embodiment to determine the URI request to be locked; no limitation is imposed on this method.
[0096] After the caching service sends a URI request to the downstream service, it continuously scans the cached data for the login ID and the corresponding fourth service result of the locked URI request. When a fourth service result is detected, meaning the caching service receives the fourth service result from the downstream service, it sends the fourth service result back to the service corresponding to the locked URI request. For example, if the locked URI request corresponds to a new service, the fourth service result is sent to the new service; if the locked URI request corresponds to an old service, the fourth service result is sent to the old service.
[0097] In the technical solution provided in this disclosure, the caching service locks a single URI request, implementing an exclusive lock based on the logid to ensure the reuse of service results. Furthermore, the caching service only sends one URI request to the downstream service, and the downstream service only processes one URI request and returns a service result to the caching service. This saves network resources, reduces the burden on downstream services, and improves processing efficiency. Simultaneously, it ensures that the caching service caches a copy of the service result corresponding to the logid and URI, reducing cache space and deployment costs.
[0098] In one embodiment of this disclosure, an interface consistency verification method is also provided, such as... Figure 3 As shown, in this method, the interface consistency verification device may further include a comparison tool. The method includes steps S31-S34, where steps S31-S32 are the same as steps S11-S12 and will not be described again here. Steps S33-S34 are one implementation of step S13.
[0099] Step S33: The access service sends the first service result to the comparison tool.
[0100] Step S34: The comparison tool compares the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0101] In this embodiment, after the access service obtains the first service result, it can package the first service result and push (e.g., via POST) the packaged first service result to the comparison tool. The comparison tool can be a DIFF tool, which supports comparison of common data types such as JSON, HTML, XML, Mcpack, and Protobuf. Furthermore, the DIFF tool can exempt fields or customize comparison logic according to business needs. Additionally, the DIFF tool supports strong comparison of values and types, meaning it can choose between strong and weak comparisons based on business requirements. The DIFF tool supports a rich variety of types, meeting the data comparison needs of various scenarios.
[0102] Optionally, the comparison tool can also configure comparison fields according to configuration instructions; compare the comparison fields in the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0103] In this embodiment of the disclosure, the service result comparison (i.e., data comparison) can support more user-friendly settings, diversify the presentation style of the data comparison results, and improve the flexibility of data comparison.
[0104] In one embodiment of this disclosure, the access service can also obtain the URI request and replay the traffic based on the URI and logid.
[0105] In this embodiment of the disclosure, when the consistency check result indicates an anomaly, the access service can obtain the corresponding traffic based on the URI and logid corresponding to the consistency check result, and then realize the replay of traffic, such as the interaction between the access service, the new service, the old service, the cache service and the downstream service.
[0106] In the technical solution provided by this disclosure, the injected traffic and comparison interface are marked and located by utilizing the logging function of the access service, such as the logid, which facilitates data statistics and anomaly replay. Furthermore, in this disclosure, the logid is used throughout the entire link; therefore, replaying traffic based on the logid solves the problem of stable data reproduction.
[0107] The logid, which runs throughout the entire chain, can, on the one hand, enable the chaining of logs, making it convenient for users to test and debug each service during the traffic request process; on the other hand, the random algorithm based on logid and the caching service based on logid ensure that the traffic is replayable and reproducible, and ensure the consistency of random results between new and old services. This facilitates the replay of random scenario data, makes it easier for business to locate problems, and can detect and cover various random use cases.
[0108] This disclosure also provides an interface consistency verification method, which can be applied to devices accessing services in performing the above-described interface consistency verification method, such as... Figure 4 As shown, the method includes the following steps:
[0109] Step S41: Obtain the traffic of the service to be injected, which includes new services and old services.
[0110] Step S42: Convert the traffic into a URI request. The URI request includes the log identifier corresponding to the URI request and the URI of the traffic.
[0111] Step S43: Input the URI request into the new service and the old service respectively; so that the new service and the old service use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service.
[0112] Step S44: Compare the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0113] Optionally, the above interface consistency verification method may also include: comparing the service results returned by the new service and the old service through the downstream service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0114] Optionally, step S44 above may include: sending the first service result to the comparison tool so that the comparison tool compares the first service results returned by the new service and the old service respectively, and obtains the consistency verification result corresponding to the service to be injected.
[0115] Optionally, the above interface consistency verification method may also include: obtaining traffic based on the URI and log identifier corresponding to the consistency verification result, and replaying the traffic.
[0116] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0117] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0118] This disclosure also provides an interface consistency verification method, which can be applied to a device executing the above-described interface consistency verification method for a service to be injected. The service to be injected can be either the new service or the old service described above. For example... Figure 5 As shown, the interface consistency verification method includes the following steps:
[0119] Step S51: Receive the URI request sent by the access service. The URI request is obtained by traffic conversion and includes the log identifier corresponding to the URI request and the URI of the traffic.
[0120] Step S52: Use the log identifier in the URI request as a random operator.
[0121] Step S53: Use a random operator to obtain the first service result corresponding to the URI in the URI request, and feed the first service result back to the access service.
[0122] Optionally, the above interface consistency verification method may further include: transmitting the URI request to the downstream service so that the downstream service obtains the second service result corresponding to the URI in the URI request and feeds back the second service result to the new service and the old service; and feeding back the second service result to the access service.
[0123] Optionally, the above interface consistency verification method may further include: transmitting the URI request to the caching service so that the caching service can obtain the log identifier and the service result corresponding to the URI stored in the caching service; feeding back the service results to the service to be injected; and feeding back the service results to the access service.
[0124] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0125] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0126] Based on the above interface consistency verification method, this disclosure also provides an interface consistency verification device, such as... Figure 6 As shown, it includes:
[0127] The acquisition module 61 is used to provide access services to obtain traffic of the services to be injected, including new services and old services; convert the traffic into Uniform Resource Identifier (URI) requests, the URI requests include the log identifier corresponding to the URI request and the URI of the traffic; and input the URI requests into the new service and the old service respectively.
[0128] Feedback module 62 is used to provide new services and old services, respectively using the log identifier in the URI request as a random operator, using the random operator to obtain the first service result corresponding to the URI in the URI request, and feeding back the first service result to the access service;
[0129] The comparison module 63 is used to provide access services to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result of the service to be injected.
[0130] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0131] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0132] Optionally, the feedback module 62 can also be used to provide new services and old services to transmit URI requests to downstream services respectively, so that the downstream services can obtain the second service result corresponding to the URI in the URI request, and feed back the second service result to the new service and the old service respectively, and feed back the second service result to the access service respectively.
[0133] The comparison module 63 can also be used to provide access services to compare the second service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0134] Optionally, the above-mentioned interface consistency verification device may further include a cache module.
[0135] Feedback module 62 can also be used to provide new and old services, respectively, to transmit URI requests to the cache service.
[0136] The caching module is used to provide caching services to obtain the third-party service results corresponding to the log identifiers and URIs stored in the cache service; and to feed back the third-party service results to the new service and the old service respectively.
[0137] Feedback module 62 can also be used to provide new and old services, so as to feed back the results of the third service to the access service respectively.
[0138] The comparison module 63 can also be used to provide access services to compare the third service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0139] Optionally, the caching module can also be used for:
[0140] Provide a caching service to transmit the URI request to the downstream service if the third service result is not obtained, so that the downstream service can obtain the fourth service result corresponding to the URI in the URI request and feed back the fourth service result to the caching service; and feed back the fourth service result to the new service and the old service respectively;
[0141] Feedback module 62 can also be used to provide new and old services, so as to feed back the results of the fourth service to the access service respectively.
[0142] The comparison module 63 can also be used to provide access services to compare the fourth service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0143] Optionally, the fourth service result includes the log identifier and URI.
[0144] The caching module can specifically provide caching services to lock one of two URI requests and send the other URI request to the downstream service if the third service result is not obtained; receive and store the fourth service result fed back by the downstream service and feed the fourth service result back to the service corresponding to the other URI request; and, in response to the log identifier and URI in the locked URI request, obtain the fourth service result corresponding to the log identifier and URI stored in the cache service and feed the fourth service result back to the service corresponding to the locked URI request.
[0145] Optionally, the interface consistency verification device may also include a verification module.
[0146] The comparison module 63 can be used to provide access services to send the first service result to the comparison tool.
[0147] The verification module provides a comparison tool to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0148] Optionally, the verification module can also be used to provide a comparison tool to configure the comparison fields according to the configuration instructions; compare the comparison fields in the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
[0149] Optionally, the interface consistency verification device may also include a playback module.
[0150] The replay module is used to provide access services to obtain traffic and replay the traffic based on the URI and log identifier corresponding to the consistency verification result.
[0151] Based on the above interface consistency verification method, this disclosure also provides an interface consistency verification device, applied to a device that accesses services, including the interface consistency verification device described above, such as... Figure 7 As shown, it includes:
[0152] The acquisition module 71 is used to acquire the traffic of the service to be injected, which includes new services and old services.
[0153] The conversion module 72 is used to convert traffic into Uniform Resource Identifier (URI) requests, wherein the URI request includes the log identifier corresponding to the URI request and the URI of the traffic;
[0154] Feedback module 73 is used to input the URI request into the new service and the old service respectively; so that the new service and the old service use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service;
[0155] The comparison module 74 is used to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0156] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0157] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0158] Optionally, the comparison module 74 can also be used to compare the service results fed back by the new service and the old service through the downstream service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0159] Optionally, comparison module 74 can be used for:
[0160] The first service result is sent to the comparison tool so that the comparison tool can compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
[0161] Optionally, the interface consistency verification device may further include a playback module.
[0162] The replay module is used to obtain traffic and replay the traffic based on the URI and log identifier corresponding to the consistency verification result.
[0163] Based on the above-described interface consistency verification method, this disclosure also provides an interface consistency verification device, applied to a device including the service to be injected, such as... Figure 8 As shown, it includes:
[0164] The receiving module 81 is used to receive a Uniform Resource Identifier (URI) request sent by the access service. The URI request is obtained by traffic conversion and includes the log identifier corresponding to the URI request and the URI of the traffic.
[0165] Processing module 82 is used to use the log identifier in the URI request as a random operator;
[0166] Feedback module 83 is used to obtain the first service result corresponding to the URI in the URI request using a random operator, and to feed back the first service result to the access service.
[0167] In the technical solution of this disclosure embodiment, the access service treats the URI request as a service request and inserts a log identifier into the URI request. Subsequently, the new service and the old service respectively use the log identifier in the URI request as a random operator to obtain the first service result corresponding to the URI in the URI request. This achieves the consistency of the random algorithm, ensures the alignment of the random results of the new service and the old service, and thus solves the problem that it is difficult to compare the interface data of the service feedback with random strategies. This also solves the problem that it is impossible to verify whether the current interface consistency check covers all types of interface data.
[0168] In addition, in the technical solution of this disclosure embodiment, the new service and the old service use a unified random operator and random algorithm to complete the interface consistency verification. The business code intrusion of the new service and the old service is only in the random operator, that is, the log identifier. This realizes the comparison of randomly fed service results in the case of light business code intrusion, and completes the interface consistency verification.
[0169] Optionally, the interface consistency verification device may further include:
[0170] The transmission module is used to transmit URI requests to downstream services so that the downstream services can obtain the second service result corresponding to the URI in the URI request and feed back the second service result to the new service and the old service.
[0171] Feedback module 83 can also be used to feed back the second service result to the access service.
[0172] Optionally, the interface consistency verification device may further include:
[0173] The transmission module is used to transmit URI requests to the caching service, so that the caching service can obtain the log identifier and the service result corresponding to the URI stored in the caching service; and then feed back the service results to the service to be injected.
[0174] Feedback module 83 can also be used to provide service results back to the access service.
[0175] The following is combined with Figure 9 The interface consistency verification device shown herein provides a detailed description of the interface consistency verification method provided in the embodiments of this disclosure.
[0176] Access layer of multiple traffic injection platforms, such as Figure 9 The examples shown include single-interface traffic injection, batch request log replay, and traffic redirection based on the go-replay tool.
[0177] Figure 9 In this context, the platform access layer can be understood as the access service. This layer includes a trace-logid generator, a parallel request module, and a data packaging module. The trace-logid generator generates the logid for the traffic injected into the platform access layer. The parallel request module inserts the logid into the URI request and concurrently sends the URI request to both the new and old services.
[0178] In scenario one, the new service and the old service use the logid in the URI request as a random operator to obtain the service result from the lib library, and then the lib library injects the service result into the new service and the old service respectively.
[0179] Scenario 2: The new service and the old service send the URI request to a regular downstream service, which is a service without randomization logic. The regular downstream service then returns the service result corresponding to the URI request to the new service and the old service, respectively.
[0180] Scenario 3: Both the new and old services send URI requests to the proxy layer, such as... Figure 9 The example shown is an nginx cache server. The proxy layer sends URI requests to special downstream services such as recommendation services and advertising services. These special downstream services are those with random logic. The special downstream services then return the service results corresponding to the URI requests to the proxy layer, which in turn returns the service results to the new service and the old service respectively.
[0181] The new and old services will respectively feed back the service results to the platform access layer. Then, the data packaging module of the platform access layer will package the service results and send the packaged service results to the DIFF tool. The DIFF tool will parse the packaged service results and compare them according to the set comparison fields to obtain a consistency verification result. This result will then be displayed through the DIFF tool's UI (e.g., ...). Figure 9 The DIFF-UI shown displays the consistency check results.
[0182] The above Figure 9 The descriptions in some parts are relatively simple; please refer to the above for details. Figures 1-8 The relevant descriptions will not be repeated here.
[0183] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0184] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0185] Figure 10 A schematic block diagram of an electronic device 1000 for implementing the interface consistency verification method of embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0186] like Figure 10 As shown, device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in read-only memory (ROM) 1002 or a computer program loaded into random access memory (RAM) 1003 from storage unit 1008. The RAM 1003 may also store various programs and data required for the operation of device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. Input / output (I / O) interface 1005 is also connected to bus 1004.
[0187] Multiple components in device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of monitors, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0188] The computing unit 1001 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as the interface conformance verification method. For example, in some embodiments, the interface conformance verification method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the interface conformance verification method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to perform an interface consistency verification method by any other suitable means (e.g., by means of firmware).
[0189] Figure 11 A schematic block diagram of an electronic device for implementing the interface consistency verification method of embodiments of the present disclosure is shown. The electronic device includes:
[0190] At least one processor 1101; and
[0191] Memory 1102 is communicatively connected to at least one processor 1101; wherein,
[0192] The memory 1102 stores instructions that can be executed by at least one processor 1101, which enables the at least one processor 1101 to perform any of the above-described interface consistency verification methods.
[0193] This disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute a consistency verification method according to any of the above interfaces.
[0194] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements a consistency verification method based on any of the above interfaces.
[0195] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0196] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0197] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0198] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0199] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0200] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0201] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0202] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. An interface consistency verification method, comprising: The access service obtains traffic from the service to be injected, which includes new services and old services. The acquired traffic is analyzed to obtain Uniform Resource Identifier (URI) information, and a URI request is generated. The URI request includes the log identifier corresponding to the URI request and the URI of the traffic. The URI request is then input into the new service and the old service respectively. The new service and the old service respectively use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service; The access service compares the first service results returned by the new service and the old service respectively to obtain the consistency verification result of the service to be injected; The method further includes: The new service and the old service respectively transmit the URI request to the cache service; If the caching service does not obtain the log identifier and the third service result corresponding to the URI stored in the caching service, it locks one of the two URI requests and sends the other URI request to the downstream service, so that the downstream service obtains the fourth service result corresponding to the URI in the URI request and feeds back the fourth service result to the caching service. The fourth service result includes the log identifier and the URI. The caching service receives and stores the fourth service result fed back by the downstream service, and feeds back the fourth service result to the service corresponding to the other URI request; in response to obtaining the fourth service result corresponding to the log identifier and the URI stored in the caching service based on the log identifier and the URI in the locked URI request, the fourth service result is fed back to the service corresponding to the locked URI request. The new service and the old service respectively feed back the result of the fourth service to the access service; The access service compares the fourth service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
2. The method according to claim 1, further comprising: The new service and the old service respectively transmit the URI request to the downstream service, so that the downstream service obtains the second service result corresponding to the URI in the URI request, and feeds back the second service result to the new service and the old service; The new service and the old service respectively feed back the result of the second service to the access service; The access service compares the second service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
3. The method according to claim 1, after the new service and the old service respectively transmit the URI request to the cache service, the method further includes: The caching service obtains the third service result corresponding to the log identifier and the URI stored in the caching service; The results of the third service are fed back to the new service and the old service respectively; The new service and the old service respectively feed back the result of the third service to the access service; The access service compares the third service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
4. The method according to any one of claims 1-3, wherein the step of comparing the first service results returned by the new service and the old service respectively to obtain the consistency verification result of the service to be injected includes: The access service sends the first service result to the comparison tool; The comparison tool compares the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected.
5. The method according to claim 4, further comprising: The comparison tool configures the comparison fields according to the configuration instructions; The comparison fields in the first service results returned by the new service and the old service are compared to obtain the consistency verification result corresponding to the service to be injected.
6. The method according to any one of claims 1-3, further comprising: The access service obtains the traffic based on the URI corresponding to the consistency verification result and the log identifier, and then replays the traffic.
7. An interface consistency verification method, applied to a device performing the access service in any one of claims 1-6, the method comprising: Obtain the traffic of the service to be injected, which includes new services and old services; The acquired traffic is analyzed to obtain Uniform Resource Identifier (URI) information, and a URI request is generated. The URI request includes the log identifier corresponding to the URI request and the URI of the traffic. The URI request is input into the new service and the old service respectively; so that the new service and the old service use the log identifier in the URI request as a random operator, and use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service; or the new service and the old service respectively transmit the URI request to the cache service, and if the cache service does not obtain the log identifier and the third service result corresponding to the URI stored in the cache service, it locks one of the two URI requests and sends the other URI request to the downstream service, so that the downstream service obtains the URI request. The fourth service result corresponding to the URI in the request is obtained and fed back to the cache service. The fourth service result includes the log identifier and the URI. The cache service receives and stores the fourth service result fed back by the downstream service and feeds back the fourth service result to the service corresponding to the other URI request. In response to the fourth service result corresponding to the log identifier and the URI in the locked URI request, the cache service obtains the fourth service result corresponding to the log identifier and the URI stored in the cache service and feeds back the fourth service result to the service corresponding to the locked URI request, so that the new service and the old service respectively feed back the fourth service result to the access service. The first service results returned by the new service and the old service are compared to obtain the consistency verification result corresponding to the service to be injected. The fourth service results returned by the new service and the old service are compared to obtain the consistency verification result corresponding to the service to be injected.
8. The method according to claim 7, wherein the step of comparing the first service results returned by the new service and the old service respectively to obtain the consistency verification result corresponding to the service to be injected includes: The first service result is sent to the comparison tool so that the comparison tool compares the first service results returned by the new service and the old service respectively, and obtains the consistency verification result corresponding to the service to be injected.
9. The method according to claim 7, further comprising: Based on the URI corresponding to the consistency verification result and the log identifier, the traffic is obtained and the traffic is replayed.
10. An interface consistency verification method, applied to a device executing the service to be injected in any one of claims 1-6, the method comprising: Receive a Uniform Resource Identifier (URI) request sent by the access service, wherein the URI request is obtained by converting the traffic, and the URI request includes the log identifier corresponding to the URI request and the URI of the traffic; Use the log identifier in the URI request as a random operator; Using the random operator, obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service; The method further includes: The URI request is transmitted to the caching service, so that if the caching service does not obtain the log identifier and the third service result corresponding to the URI stored in the caching service, it locks one of the two URI requests sent by the new service and the old service respectively, and sends the other URI request to the downstream service, so that the downstream service obtains the fourth service result corresponding to the URI in the URI request, and feeds back the fourth service result to the caching service. The fourth service result includes the log identifier and the URI, so that the caching service receives and stores the fourth service result fed back by the downstream service, and feeds back the fourth service result to the service corresponding to the other URI request, and in response to the log identifier and the URI in the locked URI request, obtains the fourth service result corresponding to the log identifier and the URI stored in the caching service, and feeds back the fourth service result to the service corresponding to the locked URI request; The fourth service result is fed back to the access service, so that the access service compares the fourth service results fed back by the new service and the old service respectively, and obtains the consistency verification result corresponding to the service to be injected.
11. The method of claim 10, further comprising: The URI request is transmitted to the downstream service so that the downstream service obtains the second service result corresponding to the URI in the URI request and feeds back the second service result to the new service and the old service. The second service result is fed back to the access service.
12. An interface consistency verification device, comprising: The acquisition module is used to provide access services to acquire traffic of the service to be injected, which includes new services and old services. The acquired traffic is analyzed to obtain Uniform Resource Identifier (URI) information, and a URI request is generated. The URI request includes the log identifier corresponding to the URI request and the URI of the traffic. The URI request is then input into the new service and the old service respectively. The feedback module is used to provide the new service and the old service, respectively using the log identifier in the URI request as a random operator, using the random operator to obtain the first service result corresponding to the URI in the URI request, and feeding back the first service result to the access service; The comparison module is used to provide the access service to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result of the service to be injected. The device further includes: The feedback module is also used to provide the new service and the old service, so as to transmit the URI request to the cache service respectively; A caching module is configured to provide the caching service, which, in the absence of obtaining the third service result corresponding to the log identifier and the URI stored in the caching service, locks one of the two URI requests and sends the other URI request to a downstream service, so that the downstream service obtains the fourth service result corresponding to the URI in the URI request and feeds back the fourth service result to the caching service, wherein the fourth service result includes the log identifier and the URI; The caching module is further configured to provide the caching service to receive and store the fourth service result fed back by the downstream service, and to feed back the fourth service result to the service corresponding to the other URI request; in response to obtaining the fourth service result corresponding to the log identifier and the URI stored in the caching service based on the log identifier and the URI in the locked URI request, and feeding back the fourth service result to the service corresponding to the locked URI request; The feedback module is also used to provide the new service and the old service, so as to respectively feed back the result of the fourth service to the access service; The comparison module is also used to provide the access service to compare the fourth service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
13. An interface consistency verification device, applied to a device including the device of claim 12 for accessing services, the device comprising: The acquisition module is used to acquire the traffic of the service to be injected, which includes new services and old services. The conversion module is used to analyze the acquired traffic, obtain Uniform Resource Identifier (URI) information, and generate a URI request. The URI request includes the log identifier corresponding to the URI request and the URI of the traffic. The feedback module is used to input the URI request into the new service and the old service respectively; so that the new service and the old service respectively use the log identifier in the URI request as a random operator, use the random operator to obtain the first service result corresponding to the URI in the URI request, and feed back the first service result to the access service; or so that the new service and the old service respectively transmit the URI request to the cache service, and if the cache service does not obtain the log identifier and the third service result corresponding to the URI stored in the cache service, the cache service locks one of the two URI requests and sends the other URI request to the downstream service, so that the downstream service obtains the URI. The fourth service result corresponding to the URI in the I request is fed back to the caching service. The fourth service result includes the log identifier and the URI. The caching service receives and stores the fourth service result fed back by the downstream service and feeds back the fourth service result to the service corresponding to the other URI request. In response to the fourth service result corresponding to the log identifier and the URI stored in the caching service based on the log identifier and the URI in the locked URI request, the fourth service result is fed back to the service corresponding to the locked URI request, so that the new service and the old service respectively feed back the fourth service result to the access service. The comparison module is used to compare the first service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected; The comparison module is also used to compare the fourth service results returned by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
14. An interface consistency verification device, applied to a device including the service to be injected in the device of claim 12, the device comprising: The receiving module is used to receive a Uniform Resource Identifier (URI) request sent by the access service. The URI request is obtained by converting the traffic, and the URI request includes the log identifier corresponding to the URI request and the URI of the traffic. The processing module is used to use the log identifier in the URI request as a random operator; The feedback module is used to obtain the first service result corresponding to the URI in the URI request using the random operator, and to feed back the first service result to the access service; The device further includes: A transmission module is configured to transmit the URI request to a caching service, so that if the caching service does not obtain the log identifier and the third service result corresponding to the URI stored in the caching service, it locks one of the two URI requests sent by the new service and the old service respectively, and sends the other URI request to a downstream service, so that the downstream service obtains the fourth service result corresponding to the URI in the URI request and feeds back the fourth service result to the caching service. The fourth service result includes the log identifier and the URI, so that the caching service receives and stores the fourth service result fed back by the downstream service and feeds back the fourth service result to the service corresponding to the other URI request. The module also includes a response to obtaining the fourth service result corresponding to the log identifier and the URI stored in the caching service based on the log identifier and the URI in the locked URI request, and feeding back the fourth service result to the service corresponding to the locked URI request. The feedback module is further configured to feed back the fourth service result to the access service, so that the access service can compare the fourth service results fed back by the new service and the old service respectively, and obtain the consistency verification result corresponding to the service to be injected.
15. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.
17. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-11.
Citation Information
Patent Citations
System mobility test method, system mobility test system, device and storage medium
CN112486814A