aboutsummaryrefslogtreecommitdiffstats
path: root/tests/report_tests
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-04-15 16:31:19 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-04-16 10:48:45 -0400
commitfbfe9765d3a3726af99b52d9c386133faa1745a7 (patch)
tree94d071db551bfe441e6e4703570f7b3276a8ddad /tests/report_tests
parent744c9c72a849f2233c832014ce37dcc392f73562 (diff)
downloadsos-fbfe9765d3a3726af99b52d9c386133faa1745a7.tar.gz
[process] Collect per-process files from /proc
Adds collection of per-process files from /proc/$pid, limited to a number of pids controlled by the new `process.numprocs` option. This option will default to the first 2048 processes. Using a value of `0` for this option will result in all pids being collected. In testing, the initial limit of 2048 process did not significantly raise collection time or archive size. Note however, that collection of 20k or more processes does show a significant increase in plugin execution time and archive size. This is however tempered, by the whole-plugin timeout that sos imposes. Related: #436 Closes: #542 Resolves: #1783 Resolves: #2498 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
Diffstat (limited to 'tests/report_tests')
-rw-r--r--tests/report_tests/plugin_tests/process.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/report_tests/plugin_tests/process.py b/tests/report_tests/plugin_tests/process.py
new file mode 100644
index 00000000..6f4ed7fc
--- /dev/null
+++ b/tests/report_tests/plugin_tests/process.py
@@ -0,0 +1,29 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+import glob
+import os
+
+from sos_tests import StageOneReportTest
+
+
+class ProcessPluginTest(StageOneReportTest):
+ """
+ :avocado: tags=stageone
+ """
+
+ sos_cmd = '-o process -k process.numprocs=100'
+
+ def test_proc_files_collected(self):
+ self.assertFileGlobInArchive('/proc/*/status')
+ self.assertFileGlobInArchive('/proc/*/stack')
+ self.assertFileGlobInArchive('/proc/*/oom_*')
+
+ def test_option_limited_proc_collection(self):
+ count = glob.glob(os.path.join(self.archive_path, 'proc/*/status'))
+ self.assertTrue(len(count) < 101)