MINOR: reg-tests: add a way to add service dependency
authorWilliam Dauchy <wdauchy@gmail.com>
Sat, 9 Jan 2021 16:26:20 +0000 (17:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 10 Jan 2021 06:42:33 +0000 (07:42 +0100)
commitaabde7133242563109b4f36c42e732f083bddf4d
treecc3667226c1430345a0ca76d4ac7a7c6cbd126a6
parent5417e898ff0334c9693c1e773a840a4f37512b3d
MINOR: reg-tests: add a way to add service dependency

I was looking at writing a simple first test for prometheus but I
realised there is no proper way to exclude it if haproxy was not built
with prometheus plugin.

Today we have `REQUIRE_OPTIONS` in reg-tests which is based on `Feature
list` from `haproxy -vv`. Those options are coming from the Makefile
itself.

A plugin is build this way:
  EXTRA_OBJS="contrib/prometheus-exporter/service-prometheus.o"

It does register service actions through `service_keywords_register`.
Those are listed through `list_services` in `haproxy -vv`.
To facilitate parsing, I slightly changed the output to a single line
and integrate it in regtests shell script so that we can now specify a
dependency while writing a reg-test for prometheus, e.g:

  #REQUIRE_SERVICE=prometheus-exporter
  #REQUIRE_SERVICES=prometheus-exporter,foo

There might be other ways to handle this, but that's the cleanest I
found; I understand people might be concerned by this output change in
`haproxy -vv` which goes from:

  Available services :
          foo
          bar

to:

  Available services : foo bar

Signed-off-by: William Dauchy <wdauchy@gmail.com>
scripts/run-regtests.sh
src/stream.c