On 17.07.23 16:47, Daniel Swarbrick wrote:
> But now we get to the ugly stuff. There are several testable examples in 
> the client_golang package, which compare the example code's text marshaled 
> metrics output to the golden "// Output:" text. As you've probably guessed, 
> these now all fail. Even if the golden text were to be updated to the new 
> text marshal format, they would still fail *intermittently*, since the 
> format is non-deterministic. Some of these tests can be fixed by ensuring 
> that the example outputs "compacted" text, using a function such as the 
> compact() 
> <https://github.com/golang/protobuf/blob/master/proto/text_test.go> 
> function in the legacy protobuf library. Other tests are trickier, because 
> they are comparing entire HTTP response bodies, albeit with a protobuf 
> error message part way through (which are *also* no longer deterministic).
> I've done some initial work in 
> https://github.com/dswarbrick/client_golang/tree/client_model-0.4.0, but 
> would appreciate if anybody has some bright ideas how to handle the 
> testable examples.

Hi Daniel, I think your analysis is spot on. For classical text, we
can do stuff do compare in different ways, but for the Go example
tests, we need text output, so we have to do something pretty
involved. (The current way of writing those example tests were really
driven by pragmatism – use the easiest way to got a more or less
readable and deterministic output, and the latter doesn't work
anymore.) Unfortunately, I couldn't come up with any bright ideas for
an easy way out.

Thanks for tackling this.
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email] bjo...@rabenste.in

You received this message because you are subscribed to the Google Groups 
"Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prometheus-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to