Search

CN-122027532-A - Flow playback method and device, computer equipment and storage medium

CN122027532ACN 122027532 ACN122027532 ACN 122027532ACN-122027532-A

Abstract

The embodiment of the application relates to the technical field of application testing, in particular to a flow playback method, a device, computer equipment and a storage medium. The method mainly comprises the steps of determining recording information of a target call chain according to a target chain identification, sequentially sending corresponding historical request data to service nodes in the target call chain according to a historical request sequence based on the recording information of the target call chain, intercepting a call request sent to a downstream service node by a target playback node, acquiring corresponding target historical response data from the recording information of the target call chain based on the target chain identification and characteristic information of the call request, and returning the target historical response data to the target playback node to obtain actual response data. By locating the complete link record information based on the target link identification, consistency problems and time sequence defects related to the execution sequence can be found, and the depth of the test and the capability of finding complex problems are improved.

Inventors

  • Ji Quanwei

Assignees

  • 北京白驹易行科技有限公司

Dates

Publication Date
20260512
Application Date
20260114

Claims (10)

  1. 1. A method of playback of a stream, the method comprising: Determining recording information of a target call chain according to the target chain identification, wherein the recording information of the target call chain comprises history request data and history response data of a plurality of service nodes, and the plurality of service nodes are sequentially associated according to a history request sequence; based on the recording information of the target call chain, sequentially sending corresponding historical request data to service nodes in the target call chain according to the historical request sequence; Intercepting a call request sent to a downstream service node by a target playback node, and acquiring corresponding target historical response data from recording information of a target call chain based on the target chain identification and characteristic information of the call request; and returning the target historical response data to the target playback node to obtain actual response data.
  2. 2. The method according to claim 1, wherein the method further comprises: And comparing the actual response data with the target historical response data to obtain a test result aiming at the target playback node.
  3. 3. The method of claim 2, wherein said comparing said actual response data with said target historical response data comprises: Consistency comparison is carried out on the actual response data and preset keywords in the target historical response data; And obtaining an actual call chain corresponding to the target chain identification based on the actual response data, and comparing the integrity of the actual call chain with that of the downstream call in the target call chain, wherein the downstream call is a call request sent to a downstream service node by each service node.
  4. 4. A method according to claim 3, wherein said consistency comparison of said actual response data with preset keywords in said historical response data comprises: And respectively extracting static fields of preset keywords in the actual response data and the historical response data, and performing equivalence comparison on the static fields.
  5. 5. The method according to claim 1, wherein the obtaining, based on the target chain identifier and the feature information of the call request, corresponding target history response data from the record information of the target call chain includes: Generating a feature code based on a service identifier, a method identifier and a request parameter corresponding to the call request; The target historical response data is determined based on the target chain identification and the feature code.
  6. 6. The method of claim 5, wherein generating the feature code based on the service identification, the method identification, and the request parameter corresponding to the call request comprises: Normalizing the request parameters, wherein the normalizing comprises removing or replacing dynamic fields in the request parameters; Splicing the normalized request parameters, the service identification and the method identification into characteristic character strings according to a preset sequence; and carrying out hash operation on the characteristic character string, and taking the obtained hash value as the characteristic code.
  7. 7. The method according to claim 1, wherein the method further comprises: Collecting an entrance request and distributing a chain identifier for the entrance request; and storing request data and response data corresponding to the entry request in a plurality of service nodes, and obtaining recording information of the calling chain corresponding to the chain identifier.
  8. 8. A flow playback device, the device comprising: the system comprises a determining module, a determining module and a processing module, wherein the determining module is used for determining recording information of a target call chain according to a target chain identifier, the recording information of the target call chain comprises history request data and history response data of a plurality of service nodes, and the plurality of service nodes are sequentially associated according to a history request sequence; the playback module is used for sequentially sending corresponding history request data to the service nodes in the target call chain according to the history request sequence based on the recording information of the target call chain; The interception module is used for intercepting a call request sent to a downstream service node by a target playback node, and acquiring corresponding target historical response data from recording information of the target call chain based on the target chain identification and characteristic information of the call request; and the test module is used for returning the target historical response data to the target playback node so as to obtain actual response data.
  9. 9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 7 when the computer program is executed by the processor.
  10. 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 7.

Description

Flow playback method and device, computer equipment and storage medium Technical Field The present application relates to the field of application testing technologies, and in particular, to a method, a system, a computer device, and a storage medium for playback of traffic. Background With the development of distributed systems and micro-service architecture technologies, a flow playback technology has emerged, which resends real requests on the recording line in a test environment to verify the correctness and performance of the service after modification. The technology generally comprises the basic links of flow collection, storage, playback and result comparison, and can ensure the stability of system upgrading to a certain extent. However, most existing traffic playback systems focus on independent verification of a single service, i.e. playback and response comparison can only be performed for the target service corresponding to the recording request. In a practical distributed environment, a user request often needs to be cooperatively processed through multiple services to form a complete call link. Only a single service is verified, and interaction logic between upstream and downstream dependencies of the service cannot be covered, so that the influence of service change on the upstream and downstream dependencies is difficult to discover. Disclosure of Invention Based on this, it is necessary to provide a method, an apparatus, a computer device and a storage medium for playback of a stream in view of at least one of the above technical problems. In a first aspect, an embodiment of the present application provides a method for playback of a stream, the method including: determining recording information of a target call chain according to the target chain identification; Based on the recording information of the target call chain, sequentially sending corresponding historical request data to service nodes in the target call chain according to the historical request sequence; Intercepting a call request sent to a downstream service node by a target playback node, and acquiring corresponding target historical response data from recording information of a target call chain based on a target chain identification and characteristic information of the call request; the target historical response data is returned to the target playback node to obtain actual response data. The recording information of the target call chain comprises historical request data and historical response data of a plurality of service nodes, and the plurality of service nodes are sequentially associated according to the historical request sequence; In some embodiments, the method of traffic playback further comprises: And comparing the actual response data with the target historical response data to obtain a test result aiming at the target playback node. In some embodiments, comparing the actual response data with the target historical response data further comprises the steps of: Consistency comparison is carried out on the actual response data and preset keywords in the target historical response data; based on the actual response data, an actual call chain corresponding to the target chain identification is obtained, and integrity comparison is carried out on the downstream call in the actual call chain and the target call chain, wherein the downstream call is a call request sent to a downstream service node by each service node. In some embodiments, the consistency comparison is performed on the actual response data and the preset keywords in the historical response data, and the method further comprises the following steps: And respectively extracting static fields of preset keywords in the actual response data and the historical response data, and performing equivalent comparison on the static fields. In some embodiments, based on the target chain identifier and the feature information of the call request, corresponding target historical response data is obtained from the record information of the target call chain, and the method further comprises the following steps: Generating a feature code based on a service identifier, a method identifier and a request parameter corresponding to the call request; target historical response data is determined based on the target chain identification and the feature code. In some embodiments, the feature code is generated based on the service identifier, the method identifier and the request parameter corresponding to the call request, and further comprising the steps of: carrying out standardization processing on the request parameters, wherein the standardization processing comprises removing or replacing dynamic fields in the request parameters; splicing the request parameters, the service identifiers and the method identifiers after normalization processing into characteristic character strings according to a preset sequence; and carrying out hash operation on the characteristic ch