Repository navigation
Fixing log cleanup candidate selection and adding a test for it. - #6096
Conversation
8597425 to
927d9fc
Compare
927d9fc to
3b6ee47
Compare
3b6ee47 to
18151f3
Compare
|
Would be nice, in a follow-on PR, if the gold test checked whether deletion occurred and brought space used by log files below the configured maximum. |
| tr = Test.AddTestRun() | ||
| # At 5K a log entry, we need a lot of curl'd requests to get to the 10 MB roll | ||
| # minimum. | ||
| curl_commands = 'for i in {{1..2500}}; do curl "http://127.1.1.1:{0}" --verbose; done'.format( |
There was a problem hiding this comment.
Nitpick: you don't need the double braces here:
$ echo {1..2} {{1..2}}
1 2 {1} {2}
I think using the while loop in my original suggestion might be more portable. Generating a string with more than 10,000 characters may exceeded internal buffer limitations of some bash implementations.
| curl_commands = 'for i in {{1..2500}}; do curl "http://127.1.1.1:{0}" --verbose; done'.format( | ||
| ts.Variables.port) | ||
| tr.Processes.Default.Command = curl_commands | ||
| tr.Processes.Default.ReturnCode = 0 |
There was a problem hiding this comment.
I ran this test:
wkaras ~/REPOS/TS2
M$ for i in 1 2 ; do \rm not-there ; echo x ; done ; echo $?
rm: not-there: No such file or directory
x
rm: not-there: No such file or directory
x
0
wkaras ~/REPOS/TS2
M$ for i in 1 2 ; do \rm not-there ; done ; echo $?
rm: not-there: No such file or directory
rm: not-there: No such file or directory
1
wkaras ~/REPOS/TS2
M$
This indicates that we would only have to worry about the last curl command failing and causing a non-zero return code. But if Jason is correct that the curl command is flakey, then checking the return code does seem to create some risk of occasional spurious failures of this gold test.
|
Cherry-picked to v9.0.x branch. |
I added comments which I hope make it clear what the change fixes. We were not determining the base (pre-rolled) log file name correctly when trying to derive the deleting_info key. This broke log cleanup because the rolled candidates list for deletion options never got populated.
This also adds a log retention test that verifies this fix.