Skip to content

Commit

Permalink
Updating to Proxy Verifier v2.0.0 (#7454)
Browse files Browse the repository at this point in the history
We will want to use Proxy Verifier v2.0.0 for it's delayed transaction
and HTTP/2 to server capabilities. This updates the AuTest extensions to
properly handle the new version.
  • Loading branch information
bneradt committed Feb 1, 2021
1 parent dc2dbb0 commit 8dc2cbe
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 16 deletions.
26 changes: 24 additions & 2 deletions ci/jenkins/bin/autest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ URL="https://ci.trafficserver.apache.org/autest"
JOB_ID=${ghprbPullId:-${ATS_BRANCH:-master}}
AUSB="ausb-${JOB_ID}.${BUILD_NUMBER}"
SANDBOX="/var/tmp/${AUSB}"
PROXY_VERIFIER_VERSIONS="/home/jenkins/proxy-verifier"
PROXY_VERIFIER_VERSION_FILE="tests/proxy-verifier-version.txt"
PROXY_VERIFIER_PREPARE="tests/prepare_proxy_verifier.sh"

# Optional settings
CCACHE=""
Expand All @@ -57,6 +60,7 @@ QUIC=""
CURL=""
AUTEST_DEBUG=""
AUTEST_VERBOSE=""
PROXY_VERIFIER_ARGUMENT=""

[ "1" == "$enable_ccache" ] && CCACHE="--enable-ccache"
[ "1" == "$enable_werror" ] && WERROR="--enable-werror"
Expand Down Expand Up @@ -86,7 +90,8 @@ set -x

# Configure
autoreconf -if
./configure --prefix="${INSTALL}" \
./configure \
--prefix="${INSTALL}" \
--with-user=jenkins \
--enable-experimental-plugins \
--enable-example-plugins \
Expand All @@ -111,7 +116,24 @@ AUTEST="/usr/bin/autest"
[ ! -x ${AUTEST} ] && AUTEST="/usr/local/bin/autest"
set -x

${AUTEST} -D ./tests/gold_tests --sandbox "$SANDBOX" --ats-bin "${INSTALL}/bin" $AUTEST_DEBUG $AUTEST_VERBOSE
pv_version=""
if [ -f "${PROXY_VERIFIER_VERSION_FILE}" ]; then
pv_version=`cat "${PROXY_VERIFIER_VERSION_FILE}"`
elif [ -f "${PROXY_VERIFIER_PREPARE}" ]; then
pv_version=`awk -F'"' '/^pv_version/ {print $2}' "${PROXY_VERIFIER_PREPARE}"`
fi
if [ "x${pv_version}" != "x" ]; then
PROXY_VERIFIER_BIN="${PROXY_VERIFIER_VERSIONS}/${pv_version}/bin"
PROXY_VERIFIER_ARGUMENT="--proxy-verifier-bin ${PROXY_VERIFIER_BIN}"
fi

${AUTEST} \
-D ./tests/gold_tests \
--sandbox "$SANDBOX" \
--ats-bin "${INSTALL}/bin" \
$PROXY_VERIFIER_ARGUMENT \
$AUTEST_DEBUG \
$AUTEST_VERBOSE
status=$?

set +x
Expand Down
4 changes: 4 additions & 0 deletions tests/gold_tests/autest-site/conditions.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def HasCurlVersion(self, version):
return self.EnsureVersion(["curl", "--version"], min_version=version)


def HasProxyVerifierVersion(self, version):
return self.EnsureVersion(["verifier-client", "--version"], min_version=version)


def HasCurlFeature(self, feature):

def default(output):
Expand Down
21 changes: 20 additions & 1 deletion tests/gold_tests/autest-site/setup.cli.ext
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import pprint
import subprocess
import shutil

PROXY_VERIFIER_VERSION_FILENAME = 'proxy-verifier-version.txt'

test_root = dirname(dirname(AutestSitePath))
repo_root = dirname(test_root)

Expand All @@ -38,6 +40,9 @@ else:

host.WriteVerbose(['ats'], "Test build root: {}:".format(ENV['BUILD_ROOT']))

proxy_verifer_version_file = os.path.join(test_root, PROXY_VERIFIER_VERSION_FILENAME)
proxy_verifer_version = open(proxy_verifer_version_file, "rt").read().strip()

if Arguments.proxy_verifier_bin is not None:
ENV['VERIFIER_BIN'] = Arguments.proxy_verifier_bin
host.WriteVerbose(
Expand All @@ -47,7 +52,7 @@ if Arguments.proxy_verifier_bin is not None:
else:
# No Verifier bin path was specified. First see if a Proxy Verifier was
# unpacked as a part of preparing for this test.
unpack_bin = os.path.join(test_root, 'proxy-verifier', 'unpack', 'bin')
unpack_bin = os.path.join(test_root, 'proxy-verifier', 'unpack', proxy_verifer_version, 'bin')
if os.path.exists(os.path.join(unpack_bin, 'verifier-client')):
ENV['VERIFIER_BIN'] = unpack_bin
host.WriteVerbose(
Expand All @@ -68,6 +73,20 @@ else:
host.WriteError("Could not find Proxy Verifier binaries. "
"Try running: ", prepare_proxy_verifier_path)

required_pv_version = Version(proxy_verifer_version[1:])
verifier_client = os.path.join(ENV['VERIFIER_BIN'], 'verifier-client')
pv_version_out = subprocess.check_output([verifier_client, "--version"])
pv_version = Version(pv_version_out.decode("utf-8").split()[1])
if pv_version < required_pv_version:
host.WriteError(
f"Proxy Verifier at {verifier_client} is too old. "
f"Version required: {required_pv_version}, version found: {pv_version}")
else:
host.WriteVerbose(
['ats'],
f"Proxy Verifier at {verifier_client} has version: {pv_version}")


if ENV['ATS_BIN'] is not None:
# Add variables for Tests
traffic_layout = os.path.join(ENV['ATS_BIN'], "traffic_layout")
Expand Down
13 changes: 10 additions & 3 deletions tests/gold_tests/autest-site/verifier_client.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ from verifier_common import create_address_argument

def _configure_client(obj, process, name, replay_path, http_ports=None,
https_ports=None, keys=None, ssl_cert='', ca_cert='',
other_args='--verbose diag'):
verbose=True, other_args=''):
"""
Configure the process for running the verifier-client.

Expand Down Expand Up @@ -61,12 +61,14 @@ def _configure_client(obj, process, name, replay_path, http_ports=None,
if not http_ports:
http_ports = [8080]
if http_ports:
command += "--connect-http "
command += create_address_argument(http_ports)
command += " "

if not https_ports:
https_ports = [4443]
if https_ports:
command += "--connect-https "
command += create_address_argument(https_ports)
command += " "

Expand Down Expand Up @@ -94,6 +96,9 @@ def _configure_client(obj, process, name, replay_path, http_ports=None,
process.Setup.Copy(ca_cert, run_ca_cert, CopyLogic.SoftFiles)
command += ' --ca-certs "{}" '.format(run_ca_cert)

if verbose:
command += ' --verbose diag '

if other_args:
command += " {}".format(other_args)

Expand All @@ -110,7 +115,7 @@ def _configure_client(obj, process, name, replay_path, http_ports=None,

def AddVerifierClientProcess(run, name, replay_path, http_ports=None,
https_ports=None, keys=None, ssl_cert='', ca_cert='',
other_args='--verbose diag'):
verbose=True, other_args=''):
"""
Set the Default process of the test run to a verifier-client Process.

Expand All @@ -134,6 +139,8 @@ def AddVerifierClientProcess(run, name, replay_path, http_ports=None,
ca_cert: (path) The location of the CA for HTTPS encryption. If this
is not provided a stock CA will be used.

verbose: (bool) Whether to enable debug level logging.

other_args: (str) Any other arbitrary options to pass to verifier-client.

Returns:
Expand All @@ -143,7 +150,7 @@ def AddVerifierClientProcess(run, name, replay_path, http_ports=None,

p = run.Processes.Default
_configure_client(run, p, name, replay_path, http_ports, https_ports,
keys, ssl_cert, ca_cert, other_args)
keys, ssl_cert, ca_cert, verbose, other_args)
return p


Expand Down
17 changes: 11 additions & 6 deletions tests/gold_tests/autest-site/verifier_server.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ from verifier_common import create_address_argument


def _configure_server(obj, process, name, replay_path, http_ports=None, https_ports=None,
ssl_cert='', ca_cert='', other_args='--verbose diag'):
ssl_cert='', ca_cert='', verbose=True, other_args=''):
"""
Configure the provided process to run a verifier-server command.

Expand Down Expand Up @@ -55,7 +55,7 @@ def _configure_server(obj, process, name, replay_path, http_ports=None, https_po
process.Variables['http_port'] = http_ports[0]

if len(http_ports) > 0:
command += "--listen "
command += "--listen-http "
command += create_address_argument(http_ports)
command += " "

Expand Down Expand Up @@ -100,6 +100,9 @@ def _configure_server(obj, process, name, replay_path, http_ports=None, https_po
process.Setup.Copy(replay_path, run_replay_path, CopyLogic.SoftFiles)
command += "{} ".format(run_replay_path)

if verbose:
command += ' --verbose diag '

if other_args:
command += "{} ".format(other_args)
process.Command = command
Expand All @@ -114,7 +117,7 @@ def _configure_server(obj, process, name, replay_path, http_ports=None, https_po

def MakeVerifierServerProcess(test, name, replay_path, http_ports=None,
https_ports=None, ssl_cert='', ca_cert='',
other_args='--verbose diag'):
verbose=True, other_args=''):
"""
Create a verifier-server process for the Test.

Expand All @@ -140,6 +143,8 @@ def MakeVerifierServerProcess(test, name, replay_path, http_ports=None,
ca_cert: (path) The location of the CA for HTTPS encryption. If this
is not provided a stock CA will be used.

verbose: (bool) Whether to enable debug level logging.

other_args: (str) Any other arbitrary options to pass to verifier-server.

Raises:
Expand All @@ -148,13 +153,13 @@ def MakeVerifierServerProcess(test, name, replay_path, http_ports=None,
"""
server = test.Processes.Process(name)
_configure_server(test, server, name, replay_path, http_ports, https_ports,
ssl_cert, ca_cert, other_args)
ssl_cert, ca_cert, verbose, other_args)
return server


def AddVerifierServerProcess(run, name, replay_path, http_ports=None,
https_ports=None, ssl_cert='', ca_cert='',
other_args='--verbose diag'):
verbose=True, other_args=''):
"""
Create a verifier-server process and configure it for the given TestRun.

Expand All @@ -169,7 +174,7 @@ def AddVerifierServerProcess(run, name, replay_path, http_ports=None,

server = run.Processes.Process(name)
_configure_server(run, server, name, replay_path, http_ports, https_ports,
ssl_cert, ca_cert, other_args)
ssl_cert, ca_cert, verbose, other_args)

client = run.Processes.Default
client.StartBefore(server)
Expand Down
8 changes: 4 additions & 4 deletions tests/prepare_proxy_verifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
# limitations under the License.

ROOT=${ROOT:-$(cd $(dirname $0) && git rev-parse --show-toplevel)}
pv_name="proxy-verifier"
pv_version=`cat ${ROOT}/tests/proxy-verifier-version.txt`
pv_top_dir="${ROOT}/tests/proxy-verifier"
pv_unpack_dir="${pv_top_dir}/unpack"
pv_unpack_dir="${pv_top_dir}/unpack/${pv_version}"
bin_dir="${pv_unpack_dir}/bin"
pv_name="proxy-verifier"
pv_version="v1.10.0"
pv_dir="${pv_name}-${pv_version}"
pv_tar_filename="${pv_dir}.tar.gz"
pv_tar="${pv_top_dir}/${pv_tar_filename}"
pv_tar_url="https://ci.trafficserver.apache.org/bintray/${pv_tar_filename}"
expected_sha1="f9ad11942f9098733e0286112a3c17975ebed363"
expected_sha1="f644ac9838ba74e674b9efe7e7b3d244037faf21"
pv_client="${bin_dir}/verifier-client"
pv_server="${bin_dir}/verifier-server"
TAR=${TAR:-tar}
Expand Down
1 change: 1 addition & 0 deletions tests/proxy-verifier-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v2.0.0

0 comments on commit 8dc2cbe

Please sign in to comment.