Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 1 | * Regression testing for HAProxy with VTest * |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 2 | |
| 3 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 4 | This little README file is about how to compile and run vtest test case files (VTC files) |
| 5 | to test HAProxy for any regression. |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 6 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 7 | To do so, you will have to compile vtest program sources which depends on |
| 8 | Varnish cache application sources. vtest, formerly varnishtest, is a very useful |
| 9 | program which has been developed to test Varnish cache application. vtest has been |
| 10 | modified in collaboration with Varnish cache conceptor Poul-Henning Kamp to support |
| 11 | HAProxy in addition to Varnish cache. |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 12 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 13 | See also: doc/regression-testing.txt |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 14 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 15 | * vtest compilation * |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 16 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 17 | $ git clone https://github.com/vtest/VTest |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 18 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 19 | $ cd VTest |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 20 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 21 | $ make vtest |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 22 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 23 | Then vtest program may be found at the root directory of vtest sources directory. |
| 24 | The Varnish cache manuals are located in 'man' directory of Varnish cache sources |
| 25 | directory. You will have to have a look at varnishtest(7) and vtc(7) manuals to |
| 26 | use vtest. |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 27 | |
| 28 | Some information may also be found in doc/regression-testing.txt in HAProxy |
| 29 | sources. |
| 30 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 31 | Note that VTC files for Varnish cache may be found in bin/varnishtest/tests directory |
| 32 | of Varnish cache sources directory which may be found here: |
| 33 | https://github.com/varnishcache/varnish-cache |
| 34 | |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 35 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 36 | * vtest execution * |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 37 | |
| 38 | You must set HAPROXY_PROGRAM environment variable to give the location |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 39 | of the HAProxy program to test to vtest: |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 40 | |
Tim Duesterhus | a9334df | 2021-05-31 23:07:29 +0200 | [diff] [blame] | 41 | $ HAPROXY_PROGRAM=<my haproxy program> vtest ... |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 42 | |
| 43 | The HAProxy VTC files found in HAProxy sources may be run with the reg-tests |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 44 | Makefile target. You must set the VTEST_PROGRAM environment variable to |
| 45 | give the location of the vtest program which has been previously compiled. |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 46 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 47 | $ VTEST_PROGRAM=<my vtest program> make reg-tests |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 48 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 49 | "reg-tests" Makefile target run scripts/run-regtest.sh script. |
| 50 | To get more information about this script run it with --help option. |
| 51 | |
| 52 | Note that vtest is run with -t10 and -l option. -l option is to keep |
| 53 | keep vtest temporary directory in case of failed test cases. core files |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 54 | may be found in this directory (if enabled by ulimit). |
| 55 | |
| 56 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 57 | * vtest patches for HAProxy VTC files * |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 58 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 59 | When producing a patch to add a VTC regression testing file to reg-tests directory, |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 60 | please follow these simple rules: |
| 61 | |
Frédéric Lécaille | 617d4f5 | 2019-01-11 10:10:22 +0100 | [diff] [blame] | 62 | - If your VTC file needs others files, if possible, use the same basename as that |
| 63 | of the VTC file, |
Frédéric Lécaille | 4891e40 | 2018-06-19 14:06:07 +0200 | [diff] [blame] | 64 | - Put these files in a directory with the same name as the code area concerned |
| 65 | by the bug ('peers', 'lua', 'acl' etc). |
Willy Tarreau | f673923 | 2021-11-18 17:46:22 +0100 | [diff] [blame] | 66 | |
| 67 | Please note that most tests use a common set of timeouts defined by the |
| 68 | environment variable HAPROXY_TEST_TIMEOUT. As much as possible, for regular I/O |
| 69 | (i.e. not errors), please try to reuse that setting so that the value may |
| 70 | easily be adjusted when running in some particularly slow environments, or be |
| 71 | shortened to fail faster on developers' machines. |