Re: Declarative HTTP Spec Test Suite

Poul-Henning Kamp <phk@phk.freebsd.dk> Mon, 27 May 2024 13:05 UTC

Return-Path: <ietf-http-wg-request+bounce-httpbisa-archive-bis2juki=ietf.org@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 695CCC18DB91 for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 27 May 2024 06:05:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.749
X-Spam-Level:
X-Spam-Status: No, score=-2.749 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=w3.org header.b="Q/bQh4G/"; dkim=pass (2048-bit key) header.d=w3.org header.b="IS/QzsUI"
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5wcl0eu3t5js for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Mon, 27 May 2024 06:05:46 -0700 (PDT)
Received: from mab.w3.org (mab.w3.org [IPv6:2600:1f18:7d7a:2700:d091:4b25:8566:8113]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D7090C1840EB for <httpbisa-archive-bis2Juki@ietf.org>; Mon, 27 May 2024 06:05:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=w3.org; s=s1; h=Subject:Date:Content-Type:MIME-Version:References:From:In-reply-to:cc :To:Message-Id:Reply-To; bh=Rs6K5x0WR8iSKJt0MUKzfwzvk1SvIilg7uWAVvmJVgg=; b=Q /bQh4G/RfvdqfKhN54spSFQdkfoxtt5kgohmWablZP3xn9XOYfxQq0iXpQ7MS/lykoMw4t9CdCmP9 Mb1SMyxIGkyazY5j2b54IopGsBBVVwK7QyubkR2HutZc1eyfb+EnimTRxh5fLJCtME8JvIM/1VR8G 90QvcT0YIGRaujP2rD4J+iODzUgjD8W68+w+LttkgAK7xiy76zNp72RN2dSgv5TYeAcM4ooOfny/G v7/Yfj1T//aAWMl60l+1j2Vu+tm/KHahvXQe3try8k/fsbLIDgwjt1LGCIAFc0J8cA8gFZMJV2l1v slOIvWrfaCFcDGQo5es/YVVln8i6BSiPg==;
Received: from lists by mab.w3.org with local (Exim 4.96) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1sBa21-00CDuL-06 for ietf-http-wg-dist@listhub.w3.org; Mon, 27 May 2024 13:04:53 +0000
Resent-Date: Mon, 27 May 2024 13:04:53 +0000
Resent-Message-Id: <E1sBa21-00CDuL-06@mab.w3.org>
Received: from ip-10-0-0-224.ec2.internal ([10.0.0.224] helo=puck.w3.org) by mab.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <phk@critter.freebsd.dk>) id 1sBa1y-00CDtL-2e for ietf-http-wg@listhub.w3.internal; Mon, 27 May 2024 13:04:50 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=w3.org; s=s1; h=Date:Content-Type:MIME-Version:References:From:In-reply-to:Subject:cc :To:Message-Id:Reply-To; bh=Rs6K5x0WR8iSKJt0MUKzfwzvk1SvIilg7uWAVvmJVgg=; t=1716815090; x=1717679090; b=IS/QzsUIUjTFxugH8SwzjOGf71dfLfUV/R6pAZdjutTem4f mGojDcdmGXaytIx0VqY28Z/11Ppuj5m22+Chs034Ef73969IO6h/JMtTSpkr8GyvL1jHwr9qXCTMQ GM/rBwXAHT0gtCZVMr0OmS10PlIOyk2LLQBs2IfRcCDJx98qR7a2dzGS5QB5hfeE6YxdpWhtkx74i hCBpswBudC0mZnbUZk0bAIDdE0lb0oI6ujTFb7+calz1TlJb8yiFDR/r62dUt3Nr4WwpkqNgTgb1W Vu4W2AsJI2Km0qrS9v/p4Y8GguLJ5iWp7YIQDocErhRpp51bMiZWzthpxKA2cQUg==;
Received-SPF: pass (puck.w3.org: domain of critter.freebsd.dk designates 130.225.244.222 as permitted sender) client-ip=130.225.244.222; envelope-from=phk@critter.freebsd.dk; helo=phk.freebsd.dk;
Received: from phk.freebsd.dk ([130.225.244.222]) by puck.w3.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <phk@critter.freebsd.dk>) id 1sBa1x-001P4H-2M for ietf-http-wg@w3.org; Mon, 27 May 2024 13:04:50 +0000
Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id B363D892B4; Mon, 27 May 2024 13:04:44 +0000 (UTC)
Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.18.1/8.16.1) with ESMTPS id 44RD4iug027669 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 27 May 2024 13:04:44 GMT (envelope-from phk@critter.freebsd.dk)
Received: (from phk@localhost) by critter.freebsd.dk (8.18.1/8.16.1/Submit) id 44RD4iQj027668; Mon, 27 May 2024 13:04:44 GMT (envelope-from phk)
Message-Id: <202405271304.44RD4iQj027668@critter.freebsd.dk>
To: Mohammed Al Sahaf <mohammed@caffeinatedwonders.com>
cc: "ietf-http-wg@w3.org" <ietf-http-wg@w3.org>
In-reply-to: <tPxvQGS7_bxKqrFish00m9LtTT_JQfE0RU1bthEcxYNTZR_uzbkEWKNOTg9c5azoZSYuDWt9pLCiS7Kd4nIWK8DPN1sOtcgbDGx4L7BeeU4=@caffeinatedwonders.com>
From: Poul-Henning Kamp <phk@phk.freebsd.dk>
References: <tPxvQGS7_bxKqrFish00m9LtTT_JQfE0RU1bthEcxYNTZR_uzbkEWKNOTg9c5azoZSYuDWt9pLCiS7Kd4nIWK8DPN1sOtcgbDGx4L7BeeU4=@caffeinatedwonders.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-ID: <27666.1716815084.1@critter.freebsd.dk>
Content-Transfer-Encoding: quoted-printable
Date: Mon, 27 May 2024 13:04:44 +0000
X-W3C-Hub-Spam-Status: No, score=-4.9
X-W3C-Hub-Spam-Report: BAYES_00=-1.9, DMARC_MISSING=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, W3C_AA=-1, W3C_IRA=-1, W3C_WL=-1
X-W3C-Scan-Sig: puck.w3.org 1sBa1x-001P4H-2M bc13d1ddcd51b9993e0afe9d52f8a631
X-Original-To: ietf-http-wg@w3.org
Subject: Re: Declarative HTTP Spec Test Suite
Archived-At: <https://www.w3.org/mid/202405271304.44RD4iQj027668@critter.freebsd.dk>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/51969
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <https://www.w3.org/email/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

> This is a proposal that is triggered by some of my involvement with the Caddy
> web server project. We (Caddy team) have been working towards developing a
> declarative test suite for the Caddy server.
> […]
> Prior Art:
> […]
> Indeed some of the listed projects have not been updated for a while.

Mohammed,

I may be misunderstanding you, but using repository activity as a
screen will make you miss stuff which Just Works™.

I will argue that VTest (https://github.com/vtest/VTest) is one
such:  It chugs away, day in and day out, in both the Varnish Cache
and HAproxy projects.

A specific reason for repository inactivity, which you might not
have noticed, is that VTest is just the test program code and the
test-cases do not live in the VTest respository, but in the "parent"
projects which use VTest:

	https://github.com/haproxy/haproxy/tree/master/reg-tests

and 

	https://github.com/varnishcache/varnish-cache/tree/master/bin/varnishtest/tests

Full VTest documentation is under "Varnishtest" in the varnish project:

	http://varnish-cache.org/docs/trunk/reference/index.html

I started writing VTest a dozen years ago for many of the same
reasons you touch in your analysis, but one of my other reasons
was that I wanted a good language to write test-cases in.

Here is a basic test from Varnish Cache, checking that chunked
encoding works at all:

	varnishtest "Check chunked encoding from backend works"
	
	server s1 {
        	rxreq
        	expect req.url == "/bar"
        	send "HTTP/1.1 200 OK\r\n"
        	send "Transfer-encoding: chunked\r\n"
        	send "\r\n"
        	send "00000004\r\n1234\r\n"
        	send "00000000\r\n"
        	send "\r\n"
	
        	rxreq
        	expect req.url == "/foo"
        	send "HTTP/1.1 200 OK\r\n"
        	send "Transfer-encoding: chunked\r\n"
        	send "\r\n"
        	send "00000004\r\n1234\r\n"
        	chunked "1234"
        	chunked ""
	} -start
	
	varnish v1 -vcl+backend {} -start
	
	client c1 {
        	txreq -url "/bar"
        	rxresp
        	expect resp.status == 200
        	expect resp.bodylen == "4"
        	txreq -url "/foo"
        	rxresp
        	expect resp.status == 200
        	expect resp.bodylen == "8"
	} -run

First, notice the lack of "boilerplate" code, getting a bog standard
varnish instance is one line in the test-description and the VTest
tool takes it from there.  There is another module in VTest which
does the same for HAproxy with the "haproxy" command.

Second, notice how VTest allows you to work at different levels of
the HTTP protocol from one "instruction" to the next: The "s1" server
receives an entire request with "rxreq" but in this particular test-case
it formulates the first response at the bytelevel, while the second
response uses the "chunked" command which automatically generates the
length.

As I read your long analysis, VTest is not a perfect fit for you,
but I think it is more than half way there, and you are more than
welcome to help us make it even better.

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.