Commit Graph

64 Commits

Author SHA1 Message Date
Tim Duesterhus
b229f018ee BUG/MEDIUM: compression: Rewrite strong ETags
RFC 7232 section 2.3.3 states:

> Note: Content codings are a property of the representation data,
> so a strong entity-tag for a content-encoded representation has to
> be distinct from the entity tag of an unencoded representation to
> prevent potential conflicts during cache updates and range
> requests.  In contrast, transfer codings (Section 4 of [RFC7230])
> apply only during message transfer and do not result in distinct
> entity-tags.

Thus a strong ETag must be changed when compressing. Usually this is done
by converting it into a weak ETag, which represents a semantically, but not
byte-by-byte identical response. A conversion to a weak ETag still allows
If-None-Match to work.

This should be backported to 1.9 and might be backported to every supported
branch with compression.
2019-01-29 20:26:06 +01:00
Willy Tarreau
1915ca2738 BUG/MINOR: mux-h2: always compare content-length to the sum of DATA frames
This is mandated by RFC7541#8.1.2.6. Till now we didn't have a copy of
the content-length header field. But now that it's already parsed, it's
easy to add the check.

The reg-test was updated to match the new behaviour as the previous one
expected unadvertised data to be silently discarded.

This should be backported to 1.9 along with previous patch (MEDIUM: h2:
always parse and deduplicate the content-length header) after it has got
a bit more exposure.
2019-01-24 19:45:27 +01:00
PiBa-NL
b07e7b4dc1 REGTEST: checks basic stats webpage functionality
This regtest verifies that the stats webpage can be used to change a
server state to maintenance or drain, and that filtering the page scope
will result in a filtered page.
2019-01-17 11:32:12 +01:00
Frédéric Lécaille
617d4f5276 REGTEST: Adapt reg test doc files to vtest.
This is a first patch to switch from varnishtest to new standalone
varnish cache reg testing program: vtest.

More information may be found here:

https://github.com/vtest/VTest
https://varnish-cache.org/docs/trunk/reference/varnishtest.html
https://varnish-cache.org/docs/trunk/reference/vtc.html
2019-01-14 14:24:29 +01:00
Jarno Huuskonen
1261a87df9 DOC: REGTESTS README varnishtest -Dno-htx= define.
Add -Dno-htx= to varnishtest command line, because without no-htx most
vtc tests fail (${no-htx} macro). Also link to doc/regression-testing.txt
2019-01-14 10:52:28 +01:00
Jarno Huuskonen
3759fe76a7 REGTESTS: Basic tests for using maps to redirect requests / select backend 2019-01-14 10:52:28 +01:00
Jarno Huuskonen
3e5c772ebb REGTESTS: Basic tests for concat,strcmp,word,field,ipmask converters 2019-01-14 10:52:28 +01:00
Jarno Huuskonen
3f0f578286 REGTESTS: test case for map_regm commit 271022150d
Minimal test case for map_regm commit 271022150d.
Config and test is adapted from: Daniel Schneller's example
(https://www.mail-archive.com/haproxy@formilux.org/msg30523.html).
2019-01-14 10:52:28 +01:00
PiBa-NL
4dc3f3b4bb REGTEST: filters: add compression test
This test checks that data transferred with compression is correctly received at
different download speeds
2019-01-09 14:36:22 +01:00
Frédéric Lécaille
61ae5ca1f4 REGTEST: "capture (request|response)" regtest. 2019-01-09 10:06:10 +01:00
Frédéric Lécaille
0656d9ca75 REGTEST: Add a reg test for health-checks over SSL/TLS.
This script runs two tests. One with "httpchk" over SSL/TLS and another
one with "check-ssl" option. As varnishtest does not support SSL/TLS
we use two haproxy processes to run these tests. h2 haproxy process
be2 and be4 backends declare one server each wich are the frontend
of h1 haproxy process. We check the layer6/7 checks thanks to syslog
messages.

Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2019-01-08 10:10:18 +01:00
PiBa-NL
c3949d4c00 REGTEST: mailers: add new test for 'mailers' section
This test verifies the mailers section works properly by checking that
it sends the proper amount of mails when health-checks are changing and
or marking a server up/down

The test currently fails on all versions of haproxy i tried with varying
results:

- 1.9.0 produces thousands of mails.
- 1.8.14 only sends 1 mail, needs a 200ms 'timeout mail' to succeed
- 1.7.11 only sends 1 mail, needs a 200ms 'timeout mail' to succeed
- 1.6 only sends 1 mail, (does not have the 'timeout mail' setting implemented)
2019-01-08 10:03:52 +01:00
Willy Tarreau
9832a37b16 REGTESTS: remove the expected window updates from H2 handshakes
These ones are not needed anymore since commit 97aaa67 ("MINOR: mux-h2:
only increase the connection window with the first update"). The tests
should now be more reliable. It might be worth simply removing all the
explicit handshake though it doesn't hurt and still serves as documentation.
2018-12-23 09:58:41 +01:00
Frédéric Lécaille
02a16690d7 REGTEST: A basic test for "http-buffer-request" 2018-12-21 18:33:36 +01:00
Christopher Faulet
e98ce25b61 REGTEST: Add a basic test for the compression 2018-12-21 15:33:26 +01:00
Frédéric Lécaille
15685c7912 REGTEST: Exclude freebsd target for some reg tests.
This patch excludes freebsd target for health-checks reg tests
which rely on TCP_DEFER_ACCEPT usage. This is specific to Linux.
2018-12-20 11:00:17 +01:00
Frédéric Lécaille
a702947bef REGTEST: Missing enclosing quotes for ${tmpdir} macro. 2018-12-20 11:00:17 +01:00
Frédéric Lécaille
9ffb88d3cf REGTEST: Be less Linux specific with a syslog regex.
This patch makes at least this test pass on FreeBSD systems.
The regex to be matched with syslog message was too much Linux specific.
2018-12-20 11:00:17 +01:00
Frédéric Lécaille
3b3a883171 REGTEST: Fix a typo about barrier type.
Fix a typo, furthermore there is no reason to use a barrier with "sock" as type
which are more varnish cache specific: used to synchronize the VCL.
2018-12-20 11:00:17 +01:00
Christopher Faulet
8f16148df7 REGTEST: Add option to use HTX prefixed by the macro 'no-htx'
So some tests have been removed.
2018-12-20 10:37:32 +01:00
Christopher Faulet
fdafd9a3f8 REGTEST: Require the option LUA to run lua tests 2018-12-20 10:33:18 +01:00
Christopher Faulet
cc26b13ea5 BUG/MINOR: lua: Return an error if a legacy HTTP applet doesn't send anything
In legacy mode, if an HTTP applet does not send any response, an error 500 is
returned.
2018-12-19 13:45:53 +01:00
Frédéric Lécaille
c11ec4a6d5 REGTEST: Add a reg test for HTTP cookies.
This script tests the "cookie <name> insert indirect" directive with
header checks on server and client side. syslog messages are also
checked, especially --II (invalid, insert) flags logging.

Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2018-12-15 16:18:14 +01:00
Willy Tarreau
4a7b5b3fdb REGTEST: http-messaging: add "option http-buffer-request" for H2 tests
These tests upload contents and randomly make the server start to
respond before the client finishes to upload data, making the test
occasionally fail. Waiting for a body in the server doesn't always
work, depending on the method or how the data are advertised. Thus,
let's ask haproxy to wait for the request using the aforementioned
option, it guarantees that the DATA frame is sent before the response
HEADERS frame is delivered.
2018-12-14 09:51:48 +01:00
Willy Tarreau
f3ec86ad89 REGTEST: fix missing space in checks/s00001
I accidently dropped one space when fixing this 3k-long line in the
VTC script, causing the test to fail.
2018-12-14 09:50:38 +01:00
Willy Tarreau
7b8d203876 REGTEST: add a few HTTP messaging tests
These tests send GET/HEAD/POST requests in H1 and H2, with and without
HTX, with and without a body, and verify that the behaviour is the expected
one. For now HEAD requests have been commented out because in H1 they are
not really testable as varnishtest expects to read a body, and in H2 the
behaviour depends on HTX/legacy, indicating a bug in haproxy (it looks
like we can deliver some data in response to HEAD in legacy mode).
2018-12-14 06:51:15 +01:00
Frederic Lecaille
3ec7bfbc7e REGTEST: Add miscellaneous reg tests for health-checks.
Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2018-12-14 06:50:45 +01:00
Frederic Lecaille
573d289dba REGTEST: level 1 health-check test 2.
With this test we check that the health-checks do not consume any connection on
the backend side.

Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2018-12-14 06:50:45 +01:00
Frederic Lecaille
8b77c0581d REGTEST: Reg test for "check" health-check option.
Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2018-12-14 06:50:45 +01:00
Frederic Lecaille
9be3489c22 REGTEST: Add a first test for health-checks.
Signed-off-by: Frdric Lcaille <flecaille@haproxy.com>
2018-12-14 06:50:45 +01:00
Willy Tarreau
211d540a81 REGTESTS: adjust the http-rules regtest to support window updates
Varnishtest is not happy to see the window update come before the
settings ACK, as by default it expects exactly tx/rx/txack/rxack.
One workaround could consist in making haproxy send the WU after
the settings ACK but this would be a real hack as the preface is
already finished when sending this ack. Instead, let's make the
initial sequence explicit in the tests.
2018-12-13 17:29:20 +01:00
Willy Tarreau
86ff9c8f3a REGTEST: the cache regtest requires haproxy 1.9
The chunks and the max-object-size features require version 1.9.
2018-12-12 15:21:56 +01:00
Willy Tarreau
64225e1f88 REGTEST: add the HTTP rules test involving HTX processing
It's the exact same test as the HTTP rules test except that it runs
with HTX enabled.
2018-12-11 09:14:59 +01:00
PiBa-NL
fefb9e3771 REGTEST/MINOR: remove health-check that can make the test fail
The reg-tests/log/b00000.vtc should not try to perform a health-check
of server s1 as it only allows 1 request/connection
2018-12-09 00:11:09 +01:00
PiBa-NL
e6b11e1c73 REGTEST/MINOR: skip seamless-reload test with abns socket on freebsd
abns sockets are not available on freebsd as such mark the test to skip
this OS and expose-fd was implemented first in 1.8 so require that
2018-12-08 22:01:13 +01:00
PiBa-NL
425f17a6af REGTEST/MINOR: remove double body specification for server txresp
fix http-rules/h00000.vtc / http-rules/h00000.vtc as both 'bodylen' and
'body' are specified, these settings conflict with each other as they
both generate/present the body to send.
2018-12-08 19:56:48 +01:00
Willy Tarreau
1298948aa0 REGTEST: make the HTTP rules test compatible with HTTP/2 as well
The HTTP rules test now runs an H1 and an H2 client. Since the H2 one
requires the "proto" directive on the bind line, a new file has been
created requiring version 1.9 and the previous one was marked as usable
below 1.9 so that it's skipped by default but still usable when testing
backports.
2018-12-07 18:21:21 +01:00
Willy Tarreau
4d58ba79dd REGTEST: add a basic test for HTTP rules manipulating headers
There is always a risk of breaking HTTP processing when performing certain
code changes. This test modifies a request's start line, uses variables,
adds and modifies headers, interleaves them with the start-line changes,
and makes use of different header formats involving duplicated names,
duplicated values, empty fields and spaces around values. These operations
are performed both in the frontend and in the backend, for both the request
and the response. A CRC is computed on the concatenation of all the values,
and the concatenations are sent as individual header fields as well to help
debugging when the test fails.

The test reliably works since 1.6, implying that the HTTP processing did
not change. It currently fails on HTX.
2018-12-07 15:31:09 +01:00
Willy Tarreau
6b6736b0fd REGTEST: fix the Lua test file name in test lua/h00002 :-)
The file was moved but the lua file was not renamed in the VTC, leading
to a failure when launched from a clean tree.
2018-12-07 15:31:09 +01:00
Frdric Lcaille
ce7fad5232 REGTEST: Move LUA reg test 4 to level 1.
This Pieter script deserves to be moved to level 1 (feature test).
2018-12-07 11:58:29 +01:00
Frdric Lcaille
d92ae75a90 REGTEST: Fix LEVEL 4 script 0 of "connection" module.
Prevent this script from creating a UNIX socket in ${testdir} which
is the parent directory of the script. Prefer use ${tmpdir} which
is the temporary working directory for the script.
2018-12-02 13:35:31 +01:00
PiBa-NL
0527639cd9 REGTEST: lua: check socket functionality from a lua-task
Adding a new test /reg-tests/lua/b00004.vtc which checks if the core.tcp()
socket basic functions properly when used from a lua-task
2018-11-30 22:09:15 +01:00
Frdric Lcaille
a3fe1bb901 REGTEST: Add a basic test for the cache.
The client makes the same HTTP request four times.
The varnishtest HTTP server serves the first client request and quits.
So, the three last requests are handled by the haproxy cache.
2018-11-29 08:42:01 +01:00
Willy Tarreau
f490f30ed8 REGTEST: add a test for connections to a "dispatch" address
The test includes both TCP and HTTP modes.
2018-11-23 08:36:06 +01:00
Joseph Herlant
ec4abdec09 CLEANUP: fix typos in reg-tests
Fix typos in comments and error messages of reg-tests. Note that this
has not been qualified as minor as it is used for testing purposes, not
end-users.
2018-11-18 22:23:15 +01:00
Willy Tarreau
9c27ea0a6a REGTEST: fix scripts 1 and 3 to accept development version
These scripts were checking that the program's name was exactly "haproxy"
which clearly is not workable during development.
2018-11-16 15:54:23 +01:00
Willy Tarreau
f95838ca2d REGTEST: make the IP+port logging test more reliable
On my machine, test log/b00000.vtc fails ~9/10 times. Apparently, the
connection is often marked as reset before the timeout strikes, so the
log shows "CD" flags instead of "cD". This fix does two things :
  1) shorten the client timeout to 1 millisecond instead of 5
  2) accept both "cD" and "CD" as valid termination states since the
     purpose is to validate the source address and port, and not the
     status itself.
2018-10-28 19:19:48 +01:00
PiBa-NL
d3ff20f0ae REGTEST/MINOR: compatibility: use unix@ instead of abns@ sockets
Changes the /reg-tests/connection/b00000.vtc test to use unix@ instead of abns@ sockets.
This to allow the test to complete on other operating systems like FreeBSD that do not have 'namespaces'.
2018-10-04 04:18:47 +02:00
Frdric Lcaille
5afb3cfbcc BUG/MINOR: server: Crash when setting FQDN via CLI.
This patch ensures that a DNS resolution may be launched before
setting a server FQDN via the CLI. Especially, it checks that
resolvers was set.

A LEVEL 4 reg testing file is provided.

Thanks to Lukas Tribus for having reported this issue.

Must be backported to 1.8.
2018-09-12 07:41:41 +02:00
Frdric Lcaille
233afc70ba REGTEST/MINOR: lua: Add reg testing files for 70d318c. 2018-09-04 17:36:56 +02:00