aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-04-22 13:58:53 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-04-30 10:24:55 -0400
commitcebe909988b90a6ebf6e596438c5cdb47001ab76 (patch)
tree3753cd8a1f5f2c0374945093bf83e4343a629c62 /tests
parent25ccc0eab1c1c1cbf32e109be727ffdd79413a70 (diff)
downloadsos-cebe909988b90a6ebf6e596438c5cdb47001ab76.tar.gz
[Plugin] Make command output size limiting obvious
When command output is size limited it should be made obvious that it is not the whole output of the command, beyond the collected output (most likely) starting in the middle of a string. To do this, we add a 'truncated' key to the results dict returned by `sos_get_command_output()`, which is set based on if the `AsyncReader` was filled during command execution. From that, first log if a command was truncated. Second, instead of dropping the collected output in the normal plugin directory, instead drop it into `sos_strings` with a `.tailed` extention to mimic how we handled tailed file collections. Finally, add a symlink from the plugin dir with the original filename that points to the `sos_strings` path. Closes: #1332 Resolves: #2506 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/report_tests/plugin_tests/logs.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/report_tests/plugin_tests/logs.py b/tests/report_tests/plugin_tests/logs.py
index 9148bbff..cc6a8365 100644
--- a/tests/report_tests/plugin_tests/logs.py
+++ b/tests/report_tests/plugin_tests/logs.py
@@ -67,3 +67,7 @@ class LogsSizeLimitTest(StageTwoReportTest):
assert jsize <= 105906176, "Collected journal is larger than 100MB"
assert jsize > 27262976, "Collected journal limited by --log-size"
+ def test_journal_tailed_and_linked(self):
+ self.assertFileCollected('sos_strings/logs/journalctl_--no-pager_--catalog_--boot.tailed')
+ journ = self.get_name_in_archive('sos_commands/logs/journalctl_--no-pager_--catalog_--boot')
+ assert os.path.islink(journ), "Journal in sos_commands/logs is not a symlink"