Context and Terminology
=======================

Traffic Server implements automated end to end testing via autest. These
tests make use of a variety of tools to exercise traffic that verifies
proper Traffic Server behavior. Curl, microserver, and tcp_client.py are
examples of such tools. Further, to make the use of these tools more
convenient, the Traffic Server autest suite contains autest extensions for
some of these tools. The extensions are found in
tests/gold_tests/autest-site.

Challenges
==========

Currently, none of these test tools provide a convenient mechanism for
crafting arbitrary HTTP traffic across specified sessions and connections.
Curl is a handy HTTP client for creating single, simple HTTP transactions
in a single connection, but it doesn't support multiple transactions in a
single connection. Further, the crafting of more than a single header on
the command line in Python with Curl, and then configuring microserver to
respond to those requests as expected, becomes unwieldy in the autest files.

Proposal
========

Proxy Verifier is a test tool designed to conveniently replay HTTP traffic
and verify proxy behavior:

https://github.com/yahoo/proxy-verifier

Proxy Verifier delivers a verifier-client and verifier-server that function
as an HTTP client and server which talk through a proxy, the entity under
test.  The HTTP traffic to replay and verification directives are described
via a set of one or more YAML files. Here's an example replay file
describing two transactions:

https://github.com/yahoo/proxy-verifier/blob/76db9d9856c72782cc8f4ddef9cdaeb25de86f58/test/autests/gold_tests/field_parsing/replay_files/transaction_fields/transaction_fields.yaml

This proposal suggests we update Traffic Server's autest suite to support
the use of Proxy Verifier as a tool for use by the tests. Analogous to the
MakeOriginServer microserver extension, convenience autest extensions will
be created to start and configure the Proxy Verifier client and server
processes:

 * MakeVerifierClientProcess
 * MakeVerifierServerProcess

These will expose an API to configure the client and the server concerning
such things as which ports to use and the location of the YAML files
describing the replay traffic. Expectations concerning Traffic Server's
behavior will also be described in the YAML replay files, and the
extensions will set expectations to verify that these validation criteria
are not violated.

Initially, the user will build the Proxy Verifier binaries separately from
Traffic Server.  The location of these binaries will be provided via a
--verifier-bin command line argument, similar to the --ats-bin command line
argument currently provided. Tests that use Proxy Verifier can be
configured conditional upon the presence of these binaries, just as certain
tests are conditional upon the presence of Curl. In the future, we can
consider updating the Verifier autest extensions to grab the Proxy Verifier
source and build it locally if that is deemed helpful by the community.

As a result of these efforts, we will have in Proxy Verifier a more
convenient and natural mechanism for describing HTTP test traffic in our
autests along with an expressive way to verify Traffic Server's proxying of
this traffic.

Please share any suggestions or concerns.

Thanks,
Brian

-- 
"Come to Me, all who are weary and heavy-laden, and I will
give you rest. Take My yoke upon you and learn from Me, for
I am gentle and humble in heart, and you will find rest for
your souls. For My yoke is easy and My burden is light."

    ~ Matthew 11:28-30

Reply via email to