Closed k0ste closed 1 year ago
I am not really convinced that this is necessary, to be honest. I don't know of any other exporter that has this. Also, either you write your config file manually, in which case you should test it manually, or you generate it, in which case you should test the implementation to not generate structurally broken files (like the snippet above). Once that is verified, there is no reason why a generator would generate broken files, unless you're doing really funky things.
If for some reason you really have a need to automatically test config files, you could still do so, e.g. using timeout
:
$ timeout 1s ./ipmi_exporter --config.file=ipmi_remote.yml &> /dev/null; echo $?
124
$ timeout 1s ./ipmi_exporter --config.file=broken.yml &> /dev/null; echo $?
1
Would that do the trick for you?
With
dry-run
feature we will can to putipmi_exporter
configuration and perform syntax test (exporter can run with this YAML) before restart with new configuration (useful for IaC's)For example, this YAML seems legit
But
Will be nice if we can check it, like
./ipmi_exporter --config.file=/path/to/file.yaml --dry-run
and check for non-zero exit-code