Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend tests and description of EventList* classes to include multiline messages matching #500

Open
jbliznak opened this issue Aug 10, 2022 · 0 comments
Labels
Milestone

Comments

@jbliznak
Copy link
Contributor

jbliznak commented Aug 10, 2022

There is a slightly non-obvious gotcha when one wants to filter Events by message and that message happens to be a multiline one

EventList events = new EventList(Arrays.asList(
        event("2020-01-01T00:00:00Z", "Pod", "1", "Created", "Normal", "message"),
        event("2020-01-01T00:00:00Z", "Pod", "5", "Created", "Normal", "message\\nmessage")));

EventList filtered = events.filter()
        .ofMessages("message.*")
        .collect();
Assertions.assertEquals(2, filtered.size());

This will fail as the second event does not match the pattern message.*.
To be able to match the it one would have to write it like .ofMessages("(?s)message.*") to allow . to match newlines too (DOTALL).

Now the question is whether we want to keep this on user's choice/knowledge to use correct patterns or whether we somehow enforce the XTF to always perform DOTALL matching in this case.

The expected solution of this is one of:

  1. enforce DOTALL by default, update javadocs, extend tests
  2. document current behaviour ~ update javadocs, extend tests

BTW I noticed this when hitting difference between OCP3 and OCP4 behavior which resulted in hours of debugging 🤯

#OCP3 event message
message=Failed to pull image "helloworld-rs-app:latest": rpc error: code = Unknown desc = repository docker.io/helloworld-rs-app not found: does not exist or no pull access

#OCP4 event message
message=Failed to pull image "helloworld-rs-app:latest": rpc error: code = Unknown desc = reading manifest latest in docker.io/library/helloworld-rs-app: errors:
denied: requested access to the resource is denied
unauthorized: authentication required
@mnovak1 mnovak1 added the major label Aug 24, 2022
@tommaso-borgato tommaso-borgato added this to the BACKLOG milestone Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants