On a Thursday in 2024, Peter Krempa wrote:
On Wed, Aug 14, 2024 at 23:40:19 +0200, Ján Tomko wrote:
> Some earlier versions of json-c format empty elements differently.
> Run the tests who use the pretty formatting for readability and
> diffability through a function that unifies the output.
Hmm so for test/output stability IMO it'd be better to fix the output
inside virJSONValueToString(..., true) (so when we're prettifying).
This would cover all existing instances in the tests, but also all
future XMLs. Additionally it'd unify the output of prettified JSON we
have e.g. in 'virsh qemu-monitor-command --pretty'.
Too bad that it basically requires duplicating the output string which
makes me think twice whether it's really worth doing.
What do you think?
I don't think the duplication is worth it. And we don't really guarantee
stability of the pretty formatting.
On the other hand, if the output really is intended for human
consumption, the overhead would be negligible.
The following systems from our CI need this workaround:
AlmaLinux 9: 0.14
CentOS Stream 9: 0.14
Ubuntu 22.04: 0.15
Debian 12: 0.16
OpenSUSE Leap 15.6: 0.16
So we would be able to drop it two years after a new major version of
all of these gets out, if I'm remembering our rules right.
Jano
Regardless, what's here works:
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>