Hi Wiliam,

On Sat, Jan 09, 2021 at 05:26:20PM +0100, William Dauchy wrote:
> 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

This is great, I really like it. Whatever we do to make haproxy more
"discoverable" by external tools is useful, and this does certainly
contribute.

I suspect that at some point we'll have to add a features list, which
is not taken from the makefile, and which is not necessarily only a
list of service, but is based on init-level registrations (like the
services). For example if some platform-specific features are tested
at boot time, they could be reported there, a bit like we've long been
doing with the pollers. We could also mention there some of the
available security protections, such as PR_SET_NO_NEW_PRIVS or other
stuff. In this case maybe the services list would move to the same
list as regular features.

Anyway in the mean time I've merged your patch.

Thanks!
Willy

Reply via email to