Skip to main content

Capture Diffs

Traffic Capture Diffs

The http module has support for traffic capture. When used in a Smart Test, traffic capture produces relevancy based diffs against the baseline using a model of the baseline traffic to highlight important changes.

We extend the starlet http module to accept two optional flags for each request: capture (type bool) and reqName (type string).

For example:

resp = http.get("...", capture=True, name="getLocations")

When capture is true, the library will inject headers based on environment variables to interface with our system of traffic capture. In this case, one can name the request with reqName.

Am example Smart Test is shown below:

res = http.get(
url="https://my-api:8081/locations", # can also be cluster internal URLs like http://name.namespace.svc
capture=True, # enables Smart Diff
name="getLocations"
)

print(res.status_code)
print(res.body())

This test runs on a sandbox and a baseline, and presents a Relevancy Diff of the requests and responses received in both of these contexts. The requests are modeled so that the most relevant differences are highlighted. You can read more about how that works in the concept docs. The result is presented similar to the below via the Signadot Dashboard.

Smart Diff Results