Skip to content

feat(utils): add robust SplitList utility with unit tests (Fixes #555)#785

Merged
ispeakc0de merged 3 commits intolitmuschaos:masterfrom
xnaveenx:fix-comma-split
Jan 21, 2026
Merged

feat(utils): add robust SplitList utility with unit tests (Fixes #555)#785
ispeakc0de merged 3 commits intolitmuschaos:masterfrom
xnaveenx:fix-comma-split

Conversation

@xnaveenx
Copy link
Contributor

What this PR does / why we need it:

This PR introduces a centralized helper function SplitList in pkg/utils/stringutils to safely handle comma-separated strings. It addresses the logic bug described in #555 where empty strings incorrectly resulted in a slice of length 1.

Improvements over previous attempts: This PR supersedes stale PRs #564 and #686 by:

Centralizing Logic: Instead of fixing individual experiment files inline, this provides a reusable, tested function.

Edge Case Handling: Automatically trims spaces ("a, b" -> ["a","b"]) and filters empty elements ("a,,b" -> ["a","b"]).

Robust Testing: Includes unit tests covering edge cases like inputs containing only commas (,,,), satisfying the feedback left on PR #686.

Which issue this PR fixes:

fixes #555

Special notes for your reviewer:

Strategy: I have purposefully limited this PR to the utility implementation and unit tests to keep the review atomic and clean. Once this is merged, I will open a follow-up "refactor" PR to update the experiment files (e.g., pod_delete.go) to use this new SplitList function.

Checklist:

[x] Fixes #555

[ ] PR messages has document related information

[ ] Labelled this PR & related issue with breaking-changes tag

[ ] PR messages has breaking changes related information

[ ] Labelled this PR & related issue with requires-upgrade tag

[ ] PR messages has upgrade related information

[x] Commit has unit tests

[ ] Commit has integration tests

[ ] E2E run Required for the changes

…uschaos#555)

Signed-off-by: Naveen <107784608+xnaveenx@users.noreply.github.com>
ispeakc0de and others added 2 commits January 14, 2026 18:18
Signed-off-by: Naveen <107784608+xnaveenx@users.noreply.github.com>
@ispeakc0de ispeakc0de merged commit 548066d into litmuschaos:master Jan 21, 2026
8 of 9 checks passed
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.

Logic for splitting comma-separated inputs need to be fixed

2 participants