PostProcessPlugin will inspect the files in the given directory (representing the location of the results directory for a sonobuoy run, not the plugin specific results directory). Based on the type of plugin results, it will record what tests passed/failed (if junit) or record what files were produc
(p plugin.Interface, dir string)
| 179 | // passed/failed (if junit) or record what files were produced (if raw) and return |
| 180 | // that information in an Item object. All errors encountered are returned. |
| 181 | func PostProcessPlugin(p plugin.Interface, dir string) (Item, []error) { |
| 182 | var i Item |
| 183 | var errs []error |
| 184 | |
| 185 | switch p.GetResultFormat() { |
| 186 | case ResultFormatE2E, ResultFormatJUnit: |
| 187 | logrus.WithField("plugin", p.GetName()).Trace("Using junit post-processor") |
| 188 | i, errs = processPluginWithProcessor(p, dir, JunitProcessFile, FileOrExtension(p.GetResultFiles(), ".xml")) |
| 189 | case ResultFormatGoJSON: |
| 190 | logrus.WithField("plugin", p.GetName()).Trace("Using gojson post-processor") |
| 191 | i, errs = processPluginWithProcessor(p, dir, GojsonProcessFile, FileOrExtension(p.GetResultFiles(), ".json")) |
| 192 | case ResultFormatRaw: |
| 193 | logrus.WithField("plugin", p.GetName()).Trace("Using raw post-processor") |
| 194 | i, errs = processPluginWithProcessor(p, dir, RawProcessFile, FileOrAny(p.GetResultFiles())) |
| 195 | case ResultFormatManual: |
| 196 | logrus.WithField("plugin", p.GetName()).Trace("Using manual post-processor") |
| 197 | // Only process the specified plugin result files or a Sonobuoy results file. |
| 198 | i, errs = processPluginWithProcessor(p, dir, manualProcessFile, FileOrExtension(p.GetResultFiles(), ".yaml", ".yml")) |
| 199 | default: |
| 200 | logrus.WithField("plugin", p.GetName()).Trace("Defaulting to raw post-processor") |
| 201 | // Default to raw format so that consumers can still expect the aggregate file to exist and |
| 202 | // can navigate the output of the plugin more easily. |
| 203 | i, errs = processPluginWithProcessor(p, dir, RawProcessFile, FileOrAny(p.GetResultFiles())) |
| 204 | } |
| 205 | |
| 206 | return i, errs |
| 207 | } |
| 208 | |
| 209 | // processNodesWithProcessor is called to invoke ProcessDir on each node-specific directory contained |
| 210 | // underneath the given dir. The directory is assumed to be either the results directory or errors directory |