btest/files/x509/files: Sort analyzers in baseline

This test is very sensitive to new enum values that perturb the final
order of the output. Listing the commits that modify that file in the
past clearly shows changes to the baseline happen when a new component
with an enum value is introduced.

    40f04d4ccf broker: Add WebSocketShim backend
    51836d08ae protocol: Add StreamEvent analyzer
    fdde1e9841 cluster/serializer: Add binary-serialization-format
    6fb73aa9da broker: Add shim plugin adding a backend component
    85ca59484b postgresql: Initial parser implementation
    efc2681152 WebSocket: Introduce new analyzer and log
    ...

That's just distraction. Point fix the test to sort the analyzers before
writing the final log line.

I've previously attempted this in a more complete fashion in PR #3365
(issue #3364), but seems this direct fix might just make more sense.

(cherry picked from commit 2f6c31df89)
This commit is contained in:
Arne Welzel 2025-04-10 13:51:52 +02:00
parent 4021a0c654
commit e85a12f286
2 changed files with 21 additions and 6 deletions

View file

@ -7,3 +7,18 @@
@load base/protocols/ssl
redef X509::log_x509_in_files_log = T;
event file_state_remove(f: fa_file)
{
local analyzers_vec: vector of string = vector();
for ( a in f$info$analyzers )
analyzers_vec += a;
sort(analyzers_vec, strcmp);
local analyzers_ordered: set[string] = set() &ordered;
for ( _, a in analyzers_vec )
add analyzers_ordered[a];
f$info$analyzers = analyzers_ordered;
}