Skip to content

refactor: Phase 2 cleanup — filter extraction, panic fixes, tests#296

Merged
alexei-led merged 2 commits intomasterfrom
refactor/phase2-cleanup
Feb 18, 2026
Merged

refactor: Phase 2 cleanup — filter extraction, panic fixes, tests#296
alexei-led merged 2 commits intomasterfrom
refactor/phase2-cleanup

Conversation

@alexei-led
Copy link
Owner

Phase 2.4/2.5 cleanup

Filter extraction (Phase 2.5)

  • Move matchNames, matchPattern, applyContainerFilter from util.go to filter.go
  • Clean separation: util.go = listing/random, filter.go = filtering logic

Bug fixes

  • Fix panic on empty container name in matchNames and matchPattern
    (containerName[1:] panics when containerName is empty string)

Test improvements

Package Before After
chaos 16.3% 51.2%
  • splitLabels: 9 table-driven cases
  • RunChaosCommand: single run, error propagation, skip-errors, context cancel
  • Edge case tests for empty container names in filter functions

- Move matchNames, matchPattern, applyContainerFilter from util.go to filter.go
- Fix potential panic on empty containerName in matchNames and matchPattern
  (containerName[1:] panics when containerName is empty string)
- Add edge case tests for empty container names
- Lint: use containerName != "" instead of len() > 0
- splitLabels: 9 cases (nil, empty, comma-separated, mixed, whitespace)
- RunChaosCommand: single run, error propagation, skip-errors, context cancel
@github-actions
Copy link

Test Results

391 tests   389 ✅  0s ⏱️
 11 suites    2 💤
  1 files      0 ❌

Results for commit ee904dc.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.52%. Comparing base (0f8dab2) to head (d0040a1).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
pkg/container/filter.go 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #296      +/-   ##
==========================================
+ Coverage   45.29%   53.52%   +8.23%     
==========================================
  Files          40       41       +1     
  Lines        1488     1502      +14     
==========================================
+ Hits          674      804     +130     
+ Misses        814      698     -116     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexei-led alexei-led merged commit 7a35eab into master Feb 18, 2026
7 checks passed
@alexei-led alexei-led deleted the refactor/phase2-cleanup branch February 18, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments