Files
troubleshoot/test/baselines
Benjamin Yang a9d2180dd6 102 redactor newline corruption clean (#1947)
* fix: prevent redactors from corrupting binary files (#102)

Redactors were adding newlines to files without them, corrupting binary
files during support bundle collection (51 bytes → 53 bytes).

Created LineReader to track original newline state and only restore
newlines when they were present in the original file.

- Added pkg/redact/line_reader.go
- Refactored single_line.go, multi_line.go, literal.go
- Added 48 tests, all passing
- Verified: binary files now preserved byte-for-byte

Fixes #102


* fix: handle empty lines correctly in MultiLineRedactor

- Check line1 == nil instead of len(line1) == 0 for empty file detection
- Fixes edge case where file containing only '\n' would be dropped
- Addresses bugbot finding about empty line handling


* fix: handle empty lines correctly in MultiLineRedactor

- Check line1 != nil instead of len(line1) > 0 in both locations
- Fixes edge case where empty trailing lines would be dropped
- Fix test isolation in literal_test.go (move ResetRedactionList to parent)
- Addresses bugbot findings about empty line handling

* fmt

* chore: update regression baselines from run 20107431959

* adding defense

* fix: propagate non-EOF errors in all early return paths

Ensure non-EOF errors (like buffer overflow) are properly propagated
to caller in both pre-loop early returns. Addresses bugbot finding.

* fix: use unique test names to prevent redaction list pollution

Use t.Name() instead of hardcoded 'test' to ensure each test
has unique redactor name, preventing parallel test interference

---------

Co-authored-by: hedge-sparrow <sparrow@spooky.academy>
2025-12-10 16:55:54 -06:00
..
2025-10-08 10:22:11 -07:00

Regression Test Baselines

This directory contains known-good baseline bundles used for regression testing.

Directory Structure

  • preflight-v1beta3/ - Baseline for complex-v1beta3.yaml spec
  • preflight-v1beta2/ - Baseline for all-analyzers-v1beta2.yaml spec
  • supportbundle/ - Baseline for all-kubernetes-collectors.yaml spec
  • metadata.json - Metadata about when baselines were last updated

Creating Initial Baselines

If this directory is empty, baselines need to be created:

  1. Run the regression test workflow manually
  2. Download the artifacts
  3. Inspect bundles to verify correctness
  4. Use scripts/update_baselines.sh to copy them here

See test/README.md for detailed instructions.

Updating Baselines

Baselines should only be updated when:

  • New collectors are added
  • Collector output format changes intentionally
  • Kubernetes version is upgraded
  • Bug fixes that change collector behavior

Never update baselines to make failing tests pass without investigation!

Use scripts/update_baselines.sh to update from a workflow run.