[YUNIKORN-3111] Limit event size to 1024#1026
Conversation
There was a problem hiding this comment.
@kousei47747 please add a short unit test (less than, equal, greater than than 1024) - it doesn't have to be one for AddEvent(), it can be one for truncateEventMessage().
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1026 +/- ##
==========================================
+ Coverage 82.66% 82.69% +0.02%
==========================================
Files 98 98
Lines 15694 15703 +9
==========================================
+ Hits 12974 12986 +12
+ Misses 2444 2442 -2
+ Partials 276 275 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @pbacsko, thanks for reviewing! I've added the unit test. |
| }, | ||
| { | ||
| name: "message length exactly 1024 characters", | ||
| message: "Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos. Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus duis convallis. Tempus leo eu aenean sed diam urna tempor. Pulvinar vivamus fringilla lacus nec metus bibendum egestas. Iaculis massa nisl malesuada lacinia integer nunc posuere. Ut hendrerit semper vel class aptent taciti sociosqu. Ad litora torquent per conubia nostra inceptos himenaeos. Lorem ipsum dolor sit amet consectetur adipiscing elit. Quisque faucibus ex sapien vitae pellentesque sem placerat. In id cursus mi pretium tellus d", |
There was a problem hiding this comment.
I suggest a more simplistic approach. Just use a helper function which generates a string (eg. "xxxxxx") with the specifed number of characters (getTestString(5) --> "xxxxx"). Also, compare the contents as well, not just the length.
pbacsko
left a comment
There was a problem hiding this comment.
Avoid long literals, use a helper function.
What is this PR for?
Truncate event message to 1024 characters for k8s compatibility.
What type of PR is it?
What is the Jira issue?
https://issues.apache.org/jira/browse/YUNIKORN-3111