[pve-devel] [PATCH v4 pve-storage 13/16] test: add tests for 'ceph.conf' parser and writer

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 19 10:36:08 CET 2024


On March 5, 2024 4:07 pm, Max Carrara wrote:
> These tests attempt to cover all syntax quirks that the format of
> 'ceph.conf' currently allows.
> 
> One known exception however is the handling of "quoted" and "unquoted"
> strings, as Ceph's own parser appears to not actually differ between
> them either. Curiously, if a "quoted string" isn't able to be
> parsed by Ceph's implementation, it goes on to parse it as an
> "unquoted string" anyway. [0] In both cases, the result is the same -
> the string is parsed with quotes.

I don't think this is true - quoted strings do behave differently w.r.t.
in-line comments and line continuations inside the quoted string (both
break parsing on the ceph side ;)), and in general a missing closing
quote seems to be fatal.

> Each test case is first tested against the parser - if the resulting
> hash matches the expected hash, it is consequently passed into the
> writer. The writer's result is then parsed another time and compared
> against the expected hash once more.

I think it would make a lot of sense to also test our parser against
`ceph-conf -c TEST_INPUT_FILE [--name X.Y] --show-config-value KEY`

in particular for all the edge cases surrounding quoting and so on it
might help find some more discrepancies, but also help keeping current
with ceph changes..

> [0]: https://git.proxmox.com/?p=ceph.git;a=blob;f=ceph/src/common/ConfUtils.cc;h=2f78fd02bf9e27467275752e6f3bca0c5e3946ce;hb=refs/heads/master#l189
> 
> Signed-off-by: Max Carrara <m.carrara at proxmox.com>




More information about the pve-devel mailing list